1 /*
2  * eepic.h -- ePiX's eepic 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_EEPIC
34 #define EPIX_EEPIC
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 eepic : public format {
52   public:
53     eepic();
54 
55     eepic* clone() const;
56 
57     // Filled region with specified Cartesian edges, offset, and color
58     std::string print_fill(const std::list<edge2d>& edges,
59 			   const pair& offset,
60 			   const Color& fill,
61 			   const pen_data& line,
62 			   const std::string& len) const;
63 
64     // Unfilled region, specified Cartesian edges. Should generally be
65     // trivially implemented using one-pen function (supplied).
66     std::string print_line(const std::list<edge2d>& edges,
67 			   const pair& offset,
68 			   const pen_data& line_pen,
69 			   const pen_data& base_pen,
70 			   const path_state& style,
71 			   const std::string& len) const;
72 
73     // Print color declaration strings: model, name, densities
74     std::string print_color(const std::string&,
75 			    const std::string&,
76 			    double,
77 			    double,
78 			    double) const;
79 
80     std::string print_color(const std::string&,
81 			    const std::string&,
82 			    double,
83 			    double,
84 			    double,
85 			    double) const;
86 
87     // One-line comment
88     std::string print_comment(const std::string&) const;
89 
90     // Verbatim output
91     std::string print_verbatim(const std::string&) const;
92 
93     void reset_state() const;
94 
95   private:
96     mutable Color  m_ink;
97     mutable length m_nib;
98     mutable double m_hatch;
99 
100     std::string start_picture(const pair&, const pair&) const;
101     std::string end_picture() const;
102 
103     std::string set_unitlength(const std::string& len) const;
104 
105     std::string usepackages() const;
106 
107     // string argument for passing attributes local to this path/loop
108     std::string start_open_path(const std::string&) const;
109     std::string end_open_path(const std::string&) const;
110 
111     std::string start_closed_path(const std::string&) const;
112     std::string end_closed_path(const std::string&) const;
113 
114     // print declarations to set state of output format
115     std::string set_fill_state(const Color&) const;
116     std::string set_pen_state(const pen_data&) const;
117 
118     // place a LaTeX box of width zero (containing string) at location (pair)
119     std::string put_box(const pair&, const std::string&) const;
120 
121     std::string print_circle_marker(const pair& here, double diam,
122 				    bool fill, const Color& color,
123 				    const std::string& len) const;
124   }; // end of class eepic
125 } // end of namespace
126 
127 #endif /* EPIX_EEPIC */
128