An additional simplier interface for static size graphs.
Node operator()(int) for getting node by index
int index(Node node) for getting index by node
3 * This file is a part of LEMON, a generic C++ optimization library
5 * Copyright (C) 2003-2006
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
26 #include<lemon/color.h>
31 ///\brief Simple tool to create \c .eps files
33 ///\author Alpar Juttner
38 ///\brief A simple tool to create \c .eps files
40 ///A simple tool to create \c .eps files
41 ///\author Alpar Juttner
45 void init(int x1,int y1,int x2,int y2);
46 void init(double x1,double y1,double x2,double y2);
54 ///The generated file is put to \c os.
56 /// \c x and \c y determine the upper
57 ///right corner of the bounding box. The lower left corner is (0,0).
58 EpsDrawer(std::ostream &os,int x,int y);
61 ///The generated file is put to \c os.
63 ///(x1,y1) and (x2,y2)
64 /// determine the lower left and the upper right corners of
65 ///the bounding box, respectively.
66 EpsDrawer(std::ostream &os,int x1,int y1,int x2,int y2);
69 ///The generated file is put to \c os.
71 ///\c s determines the upper
72 ///right corner of the bounding box. The lower left corner is (0,0).
73 EpsDrawer(std::ostream &os,xy<double> s);
76 ///The generated file is put to \c os.
79 /// determine the lower left and the upper right corners of
80 ///the bounding box, respectively.
81 EpsDrawer(std::ostream &os,xy<double> a, xy<double> b);
84 ///The generated picture is put to the file \c name.
86 ///\c x and \c y determine the upper
87 ///right corner of the bounding box. The lower left corner is (0,0).
88 EpsDrawer(const std::string &name,int x,int y);
91 ///The generated picture is put to the file \c name.
93 ///(x1,y1) and (x2,y2)
94 /// determine the lower left and the upper right corners of
95 ///the bounding box, respectively.
96 EpsDrawer(const std::string &name,int x1,int y1,int x2,int y2);
99 ///The generated picture is put to the file \c name.
101 ///\c s determines the upper
102 ///right corner of the bounding box. The lower left corner is (0,0).
103 EpsDrawer(const std::string &name,xy<double> s);
106 ///The generated picture is put to the file \c name.
109 /// determine the lower left and the upper right corners of
110 ///the bounding box, respectively.
111 EpsDrawer(const std::string &name,xy<double> a, xy<double> b);
113 // template<class T> EpsDrawer(std::ostream &os,BoundingBox<T> b)
114 // template<class T> EpsDrawer(std::ostream &os,BoundingBox<T> b);
118 ///Save the current graphic state.
120 ///This function saves the current coordinate system, and the parameters
121 ///set by \ref color(), \ref lineWidth() etc.
122 ///The can be \ref restore "restore()"d later.
124 ///The \ref save() - \ref restore() pairs can be nested.
127 ///Restore the saves graphic state.
129 EpsDrawer &restore();
132 EpsDrawer &line(double x1,double y1,double x2,double y2);
133 ///Draw a line from the current point
134 EpsDrawer &lineTo(double x1,double y1);
135 ///Move the current point
136 EpsDrawer &moveTo(double x1,double y1);
138 EpsDrawer &circle(double x,double y, double r);
141 template<class T> EpsDrawer &line(xy<T> p1,xy<T> p2)
143 return line(p1.x,p1.y,p2.x,p2.y);
145 ///Draw a line from the current point
146 template<class T> EpsDrawer &lineTo(xy<T> p)
148 return lineTo(p.x,p.y);
150 ///Move the current point
151 template<class T> EpsDrawer &moveTo(xy<T> p)
153 return moveTo(p.x,p.y);
156 template<class T> EpsDrawer &circle(xy<T> p, double r)
158 return circle(p.x,p.y,r);
162 EpsDrawer &fontSize(double si);
164 EpsDrawer &font(std::string );
165 ///Sets whether text output is centerized of not
167 ///Sets whether text output is centerized of not.
169 ///\warning \ref save() doesn't save this setting.
171 EpsDrawer ¢erMode(bool m);
172 ///Turn to collect mode.
174 ///If you call this function, then the drawing operations like \ref line(),
175 ///\ref lineTo(), \ref moveTo() will not take place immediately, but istead
177 ///are collected. These operations form a \e path.
178 ///Then you can \ref stroke(), \ref fill(), \ref eofill(), \ref clip() or
180 ///When drawing, you can also use \ref closePath() to - surprise - close the
183 ///This example draws a red filled diamond.
185 /// EpsDraw ed("diamond.eps",-1,-1,1,1);
186 /// ed.color(1,0,0,).collect().line(0,-1,1,0).lineTo(0,1)
187 /// .lineTo(-1,0).closePath().fill();
189 EpsDrawer &collect();
190 ///Close the current drawing path
191 EpsDrawer &closePath();
192 ///Stroke (draw) a path
194 ///Stroke (draw) a path.
204 ///Even-odd fill a path
206 ///Even-odd fill a path.
210 ///Set a clipping area.
212 ///This function sets a clipping area. After that, the drawing operations
213 ///will affect only this area.
217 ///Set a clipping area using even-odd rule.
219 ///This function sets a clipping area using even-odd rule.
220 ///After that, the drawing operations
221 ///will affect only this area.
226 ///Set the line width.
227 EpsDrawer &lineWidth(double w);
228 ///Set the style of the line ends
230 ///\param i It can be 0, 1 or 2
232 EpsDrawer &lineCap(int i);
233 ///Set the style of the line joins
235 ///\param i It can be 0, 1 or 2
237 EpsDrawer &lineJoin(int i);
238 ///Set the cut length of near parallel joining lines.
239 EpsDrawer &miterLimit(double w);
241 ///Set the drawing color
242 EpsDrawer &color(double r, double g, double b);
243 ///Set the drawing color
244 EpsDrawer &color(Color c)
246 return color(c.red(),c.green(),c.blue());
249 ///Translate the coordinate system
250 EpsDrawer &translate(double x,double y);
251 ///Translate the coordinate system
252 template<class T> EpsDrawer &translate(xy<T> p)
254 return translate(p.x,p.y);
256 ///Rotate the coordinate system
257 EpsDrawer &rotate(double r);
258 ///Scale the coordinate system
259 EpsDrawer &scale(double sx, double sy);
260 ///Scale the coordinate system
261 EpsDrawer &scale(double s) { return scale(s,s); }
262 ///Scale the coordinate system
263 template<class T> EpsDrawer &scale(xy<T> p)
265 return scale(p.x,p.y);
273 ///Print a text at the current point
274 EpsDrawer &operator<<(const std::string &s);
275 ///Print a text at the current point
276 EpsDrawer &operator<<(const char *s);
277 ///Print a number at the current point
278 EpsDrawer &operator<<(int i);
279 ///Print a number at the current point
280 EpsDrawer &operator<<(double d);
281 ///Print a coordinate at the current point
283 EpsDrawer &operator<<(xy<T> p)
285 out << "((" << p.x << ',' << p.y <<")) show\n";