EpsDrawer Class Reference
[Postscript exporting]


Detailed Description

A simple tool to create .eps files
Author:
Alpar Juttner
#include <lemon/eps.h>

List of all members.

Public Types

enum  NodeShapes {
  CIRCLE = 0, SQUARE = 1, DIAMOND = 2, MALE = 3,
  FEMALE = 4
}

Public Member Functions

 EpsDrawer (std::ostream &os, int x, int y)
 
 EpsDrawer (std::ostream &os, int x1, int y1, int x2, int y2)
 
 EpsDrawer (std::ostream &os, dim2::Point< double > s)
 
 EpsDrawer (std::ostream &os, dim2::Point< double > a, dim2::Point< double > b)
 
 EpsDrawer (const std::string &name, int x, int y)
 
 EpsDrawer (const std::string &name, int x1, int y1, int x2, int y2)
 
 EpsDrawer (const std::string &name, dim2::Point< double > s)
 
 EpsDrawer (const std::string &name, dim2::Point< double > a, dim2::Point< double > b)
 
EpsDrawersave ()
 Save the current graphic state.
EpsDrawerrestore ()
 Restore the saves graphic state.
EpsDrawerline (double x1, double y1, double x2, double y2)
 Draw a line.
EpsDrawerlineTo (double x1, double y1)
 Draw a line from the current point.
EpsDrawermoveTo (double x1, double y1)
 Move the current point.
EpsDrawercircle (double x, double y, double r)
 Draw a circle.
template<class T >
EpsDrawerline (dim2::Point< T > p1, dim2::Point< T > p2)
 Draw a line.
template<class T >
EpsDrawerlineTo (dim2::Point< T > p)
 Draw a line from the current point.
template<class T >
EpsDrawermoveTo (dim2::Point< T > p)
 Move the current point.
template<class T >
EpsDrawercircle (dim2::Point< T > p, double r)
 Draw a circle.
EpsDrawerfontSize (double si)
 Set the font size.
EpsDrawerfont (std::string)
 Set the fint type.
EpsDrawercenterMode (bool m)
 Sets whether text output is centerized of not.
EpsDrawercollect ()
 Turn to collect mode.
EpsDrawerclosePath ()
 Close the current drawing path.
EpsDrawerstroke ()
 Stroke (draw) a path.
EpsDrawerfill ()
 Fill a path.
EpsDrawereoFill ()
 Even-odd fill a path.
EpsDrawerclip ()
 Set a clipping area.
EpsDrawereoClip ()
 Set a clipping area using even-odd rule.
EpsDrawerlineWidth (double w)
 Set the line width.
EpsDrawerlineCap (int i)
 Set the style of the line ends.
EpsDrawerlineJoin (int i)
 Set the style of the line joins.
EpsDrawermiterLimit (double w)
 Set the cut length of near parallel joining lines.
EpsDrawercolor (double r, double g, double b)
 Set the drawing color.
EpsDrawercolor (Color c)
 Set the drawing color.
EpsDrawernode (NodeShapes t, double x, double y, double r, Color col=WHITE, Color brd=BLACK)
 Draw a node shape.
template<class T >
EpsDrawernode (NodeShapes t, dim2::Point< T > pos, double r, Color col=WHITE, Color brd=BLACK)
 Draw a node shape.
EpsDrawertranslate (double x, double y)
 Translate the coordinate system.
template<class T >
EpsDrawertranslate (dim2::Point< T > p)
 Translate the coordinate system.
EpsDrawerrotate (double r)
 Rotate the coordinate system.
EpsDrawerscale (double sx, double sy)
 Scale the coordinate system.
EpsDrawerscale (double s)
 Scale the coordinate system.
template<class T >
EpsDrawerscale (dim2::Point< T > p)
 Scale the coordinate system.
EpsDrawerflush ()
 
EpsDrawerclear ()
 Clear the image.
EpsDraweroperator<< (const std::string &s)
 Print a text at the current point.
EpsDraweroperator<< (const char *s)
 Print a text at the current point.
EpsDraweroperator<< (int i)
 Print a number at the current point.
EpsDraweroperator<< (double d)
 Print a number at the current point.
template<class T >
EpsDraweroperator<< (dim2::Point< T > p)
 Print a coordinate at the current point.


Member Enumeration Documentation

enum NodeShapes

Node shapes

Enumerator:
CIRCLE  = 0
nodeshape_0.png
SQUARE  = 1
nodeshape_1.png
DIAMOND  = 2
nodeshape_2.png
MALE  = 3
nodeshape_3.png

Warning:
Not implemented
FEMALE  = 4
nodeshape_4.png

Warning:
Not implemented


Constructor & Destructor Documentation

EpsDrawer ( std::ostream &  os,
int  x,
int  y 
)

The generated file is put to os.

x and y determine the upper right corner of the bounding box. The lower left corner is (0,0).

EpsDrawer ( std::ostream &  os,
int  x1,
int  y1,
int  x2,
int  y2 
)

The generated file is put to os.

(x1,y1) and (x2,y2) determine the lower left and the upper right corners of the bounding box, respectively.

EpsDrawer ( std::ostream &  os,
dim2::Point< double >  s 
)

The generated file is put to os.

s determines the upper right corner of the bounding box. The lower left corner is (0,0).

EpsDrawer ( std::ostream &  os,
dim2::Point< double >  a,
dim2::Point< double >  b 
)

The generated file is put to os.

a and b determine the lower left and the upper right corners of the bounding box, respectively.

EpsDrawer ( const std::string &  name,
int  x,
int  y 
)

The generated picture is put to the file name.

x and y determine the upper right corner of the bounding box. The lower left corner is (0,0).

EpsDrawer ( const std::string &  name,
int  x1,
int  y1,
int  x2,
int  y2 
)

The generated picture is put to the file name.

(x1,y1) and (x2,y2) determine the lower left and the upper right corners of the bounding box, respectively.

EpsDrawer ( const std::string &  name,
dim2::Point< double >  s 
)

The generated picture is put to the file name.

s determines the upper right corner of the bounding box. The lower left corner is (0,0).

EpsDrawer ( const std::string &  name,
dim2::Point< double >  a,
dim2::Point< double >  b 
)

The generated picture is put to the file name.

a and b determine the lower left and the upper right corners of the bounding box, respectively.


Member Function Documentation

EpsDrawer & save (  ) 

This function saves the current coordinate system, and the parameters set by color(), lineWidth() etc. The can be restore()d later.

The save() - restore() pairs can be nested.

EpsDrawer & centerMode ( bool  m  ) 

Sets whether text output is centerized of not.

Warning:
save() doesn't save this setting.

EpsDrawer & collect (  ) 

If you call this function, then the drawing operations like line(), lineTo(), moveTo() will not take place immediately, but istead they are collected. These operations form a path. Then you can stroke(), fill(), eoFill(), clip() or eoClip() it. When drawing, you can also use closePath() to - surprise - close the current path.

This example draws a red filled diamond.

         EpsDraw ed("diamond.eps",-1,-1,1,1);
         ed.color(1,0,0,).collect().line(0,-1,1,0).lineTo(0,1)
           .lineTo(-1,0).closePath().fill();

EpsDrawer & stroke (  ) 

Stroke (draw) a path.

See also:
collect()

EpsDrawer & fill (  ) 

Fill a path.

See also:
collect()

EpsDrawer & eoFill (  ) 

Even-odd fill a path.

See also:
collect()

EpsDrawer & clip (  ) 

This function sets a clipping area. After that, the drawing operations will affect only this area.

See also:
collect()

EpsDrawer & eoClip (  ) 

This function sets a clipping area using even-odd rule. After that, the drawing operations will affect only this area.

See also:
collect()

EpsDrawer & lineCap ( int  i  ) 

Parameters:
i It can be 0, 1 or 2

EpsDrawer & lineJoin ( int  i  ) 

Parameters:
i It can be 0, 1 or 2

EpsDrawer & node ( NodeShapes  t,
double  x,
double  y,
double  r,
Color  col = WHITE,
Color  brd = BLACK 
)

Draw a node shape.

Parameters:
t The shape of the drawn object
x The x coordinate of the node
y The y coordinate of the node
r The size (radius) of the node
col Color of the node. The default color is white
brd Color of the node border. The default color is black

EpsDrawer& node ( NodeShapes  t,
dim2::Point< T >  pos,
double  r,
Color  col = WHITE,
Color  brd = BLACK 
) [inline]

Draw a node shape.

Parameters:
t The shape of the drawn object
pos Position of the node
r The size (radius) of the node
col Color of the node. The default color is white
brd Color of the node border. The default color is black


Generated on Thu Jun 4 04:04:04 2009 for LEMON by  doxygen 1.5.9