1 /*
2  * pst.h -- ePiX's pstricks output format
3  *
4  * This file is part of ePiX, a C++ library for creating high-quality
5  * figures in LaTeX
6  *
7  * Version 1.1.15
8  * Last Change: September 07, 2007
9  */
10 
11 /*
12  * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
13  * Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
14  * Department of Mathematics and Computer Science
15  * College of the Holy Cross
16  * Worcester, MA, 01610-2395, USA
17  *
18  *
19  * ePiX is free software; you can redistribute it and/or modify it
20  * under the terms of the GNU General Public License as published by
21  * the Free Software Foundation; either version 2 of the License, or
22  * (at your option) any later version.
23  *
24  * ePiX is distributed in the hope that it will be useful, but WITHOUT
25  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
26  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
27  * License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with ePiX; if not, write to the Free Software Foundation, Inc.,
31  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
32  */
33 #ifndef EPIX_PST
34 #define EPIX_PST
35 
36 #include <string>
37 #include <list>
38 #include <set>
39 
40 #include "Color.h"
41 #include "length.h"
42 
43 #include "edge_data.h"
44 #include "format.h"
45 
46 namespace ePiX {
47 
48   class path_state;
49   class pen_data;
50 
51   class pst : public format {
52   public:
53     pst();
54 
55     pst* clone() const;
56 
57     std::string print_fill(const std::list<edge2d>& edges,
58 			   const pair& offset,
59 			   const Color& fill,
60 			   const pen_data& line,
61 			   const std::string& len) const;
62 
63     std::string print_line(const std::list<edge2d>& edges,
64 			   const pair& offset,
65 			   const pen_data& line,
66 			   const pen_data& base,
67 			   const path_state& style,
68 			   const std::string& len) const;
69 
70 
71     // model, name, densities
72     std::string print_color(const std::string&, const std::string&,
73 			    double, double,
74 			    double) const;
75 
76     std::string print_color(const std::string&, const std::string&,
77 			    double, double,
78 			    double, double) const;
79 
80 
81     // output file comment
82     std::string print_comment(const std::string&) const;
83 
84     std::string print_verbatim(const std::string&) const;
85 
86     void reset_state() const;
87 
88   private:
89     mutable Color m_fill;
90     mutable Color m_line;
91     mutable Color m_base;
92 
93     mutable length m_lwidth;
94     mutable length m_bwidth;
95 
96     // start, end pspicture, set unit and default linewidth
97     std::string start_picture(const pair&, const pair&) const;
98     std::string end_picture() const;
99 
100     std::string set_unitlength(const std::string& len) const;
101 
102     std::string usepackages() const;
103 
104     // string argument for passing attributes local to this path/loop
105     std::string start_open_path(const std::string&) const;
106     std::string end_open_path(const std::string&) const;
107 
108     std::string start_closed_path(const std::string&) const;
109     std::string end_closed_path(const std::string&) const;
110 
111     // print declarations to set state of output format
112     std::string set_fill_state(const Color&) const;
113     std::string set_pen_state(const pen_data&) const;
114 
115     // place a LaTeX box of width zero (containing string) at location (pair)
116     std::string put_box(const pair&, const std::string&) const;
117 
118     std::string print_circle_marker(const pair& here, double diam,
119 				    bool fill, const Color& color,
120 				    const std::string& len) const;
121   }; // end of class pst
122 } // end of namespace
123 
124 #endif /* EPIX_PST */
125