Fade2D Documentation pages v2.16.7
Delaunay Features
GEOM_FADE2D::Visualizer2 Class Reference

A PDF and Postscript Writer for 2D Visualization. More...

#include <Visualizer2.h>

Public Member Functions

CLASS_DECLSPEC Visualizer2 (const char *filename_)
 Constructor for Visualizer2. More...
 
CLASS_DECLSPEC ~Visualizer2 ()
 Destructor.
 
CLASS_DECLSPEC void addHeaderLine (const char *s)
 Add a header line to the visualization. More...
 
CLASS_DECLSPEC void addObject (const Circle2 &circ, const Color &c)
 Add a Circle2 object to the visualization. More...
 
CLASS_DECLSPEC void addObject (const Edge2 &edge, const Color &c)
 Add an Edge2 object to the visualization. More...
 
CLASS_DECLSPEC void addObject (const Label &lab, const Color &c)
 Add a Label object to the visualization. More...
 
CLASS_DECLSPEC void addObject (const Point2 &pnt, const Color &c)
 Add a Point2 object to the visualization. More...
 
CLASS_DECLSPEC void addObject (const PShape &polygonalShape, const Color &c)
 Add a single polygonal shape to the visualization. More...
 
CLASS_DECLSPEC void addObject (const Segment2 &seg, const Color &c)
 Add a Segment2 object to the visualization. More...
 
CLASS_DECLSPEC void addObject (const std::vector< ConstraintSegment2 * > &vConstraintSegments, const Color &c)
 Add a vector of ConstraintSegment2 pointers to the visualization. More...
 
CLASS_DECLSPEC void addObject (const std::vector< Edge2 > &vEdges, const Color &c)
 Add a vector of Edge2 objects to the visualization. More...
 
CLASS_DECLSPEC void addObject (const std::vector< Point2 * > &vPoints, const Color &c)
 Add a vector of Point2 pointers to the visualization. More...
 
CLASS_DECLSPEC void addObject (const std::vector< Point2 > &vPoints, const Color &c)
 Add a vector of Point2 objects to the visualization. More...
 
CLASS_DECLSPEC void addObject (const std::vector< PShape > &vPolygonalShapes, const Color &c)
 Add polygonal shapes to the visualization. More...
 
CLASS_DECLSPEC void addObject (const std::vector< Segment2 > &vSegments, const Color &c)
 Add a vector of Segment2 objects to the visualization. More...
 
CLASS_DECLSPEC void addObject (const std::vector< Triangle2 * > &vT, const Color &c)
 Add a vector of Triangle2 pointers to the visualization. More...
 
CLASS_DECLSPEC void addObject (const std::vector< Triangle2 > &vT, const Color &c)
 Add a vector of Triangle2 objects to the visualization. More...
 
CLASS_DECLSPEC void addObject (const std::vector< VertexPair2 > &vVertexPairs, const Color &c)
 Add a vector of VertexPair2 objects defining segments to the visualization. More...
 
CLASS_DECLSPEC void addObject (const std::vector< VoroCell2 * > &vC, const Color &c)
 Add Voronoi cells to the visualization. More...
 
CLASS_DECLSPEC void addObject (const Triangle2 &tri, const Color &c)
 Add a Triangle2 object to the visualization. More...
 
CLASS_DECLSPEC void addObject (ConstraintGraph2 *pCG, const Color &c)
 Add a ConstraintGraph2 object to the visualization. More...
 
CLASS_DECLSPEC void addObject (VoroCell2 *pVoroCell, const Color &c)
 Add a Voronoi cell to the visualization. More...
 
CLASS_DECLSPEC void writeFile ()
 Finish and write the output file. More...
 

Protected Member Functions

 Visualizer2 (const Visualizer2 &)
 
void changeColor (const Color &c)
 
void changeColor (float r, float g, float b, float linewidth, bool bFill)
 
Visualizer2operator= (const Visualizer2 &)
 
void periodicStroke ()
 
double scaledDouble (const double &d)
 
Point2 scaledPoint (const Point2 &p)
 
void writeCircle (const Point2 &p1_, double radius, bool bFill)
 
void writeFooter ()
 
void writeHeader (const char *title)
 
void writeHeaderLines ()
 
void writeLabel (Label l)
 
void writeLine (const Point2 &pSource, const Point2 &pTarget)
 
void writeMark (const Point2 &p1_, float size)
 
void writePoint (const Point2 &p1_, float size)
 
void writePolygon (PShape &pshape, bool bFill, double width)
 
void writeTriangle (const Point2 &p0_, const Point2 &p1_, const Point2 &p2_, bool bFill, double width)
 
void writeTriangle (const Triangle2 *pT, bool bFill_, double width)
 
void writeVoroCell (VoroCell2 *pVoroCell, bool bFill, double width)
 

Protected Attributes

Bbox2 bbox
 
bool bFileClosed
 
bool bFill
 
bool bTypePS
 
Color lastColor
 
std::ofstream outFile
 
Dat * pDat
 
int updateCtr
 
std::vector< std::pair< Circle2, Color > > vCircles
 
std::vector< std::pair< Label, Color > > vLabels
 
std::vector< std::pair< Point2, Color > > vPoints
 
std::vector< std::pair< PShape, Color > > vPolygons
 
std::vector< std::pair< Segment2, Color > > vSegments
 
std::vector< std::pair< Triangle2, Color > > vTriangles
 
std::vector< std::pair< VoroCell2 *, Color > > vVoroCells
 

Detailed Description

The Visualizer2 class provides functionality to draw Fade_2D or Zone2 instances, as well as custom 2D geometric elements. It supports writing the output to PDF or Postscript files.

Example output of the Visualizer
See also
C++-Example: Traversing and Drawing a Triangulation.
VtkWriter An alternative class suited for visualizing both 2D and 3D scenes.

Constructor & Destructor Documentation

◆ Visualizer2()

CLASS_DECLSPEC GEOM_FADE2D::Visualizer2::Visualizer2 ( const char *  filename_)
explicit

Initializes a new Visualizer2. The file extension determines whether the output will be written to a PDF or Postscript file.

Parameters
filename_Name of the output file. Must end with .ps or .pdf.

Member Function Documentation

◆ addHeaderLine()

CLASS_DECLSPEC void GEOM_FADE2D::Visualizer2::addHeaderLine ( const char *  s)
Parameters
sA header line.

◆ addObject() [1/19]

CLASS_DECLSPEC void GEOM_FADE2D::Visualizer2::addObject ( const Circle2 circ,
const Color c 
)
Parameters
circCircle2 object.
cColor for the circle. Define the Color with bFill=true, i.e., Color(CRED,0.01,true), to fill the circle.

◆ addObject() [2/19]

CLASS_DECLSPEC void GEOM_FADE2D::Visualizer2::addObject ( const Edge2 edge,
const Color c 
)
Parameters
edgeEdge2 object.
cColor for the edge. Define the Color with bFill=true, i.e., Color(CRED,0.01,true), to draw marks at the endpoints.

◆ addObject() [3/19]

CLASS_DECLSPEC void GEOM_FADE2D::Visualizer2::addObject ( const Label lab,
const Color c 
)
Parameters
labLabel object.
cColor for the label.

◆ addObject() [4/19]

CLASS_DECLSPEC void GEOM_FADE2D::Visualizer2::addObject ( const Point2 pnt,
const Color c 
)
Parameters
pntPoint2 object.
cColor for the point.

◆ addObject() [5/19]

CLASS_DECLSPEC void GEOM_FADE2D::Visualizer2::addObject ( const PShape polygonalShape,
const Color c 
)
Parameters
polygonalShapeA polygonal shape.
cColor for the shape. To fill the shape, set bFill to true in the Color constructor (e.g., Color(CRED, 0.01, true)).

◆ addObject() [6/19]

CLASS_DECLSPEC void GEOM_FADE2D::Visualizer2::addObject ( const Segment2 seg,
const Color c 
)
Parameters
segSegment2 object.
cColor for the segment. Define the Color with bFill=true, i.e., Color(CRED,0.01,true), to draw marks at the endpoints.

◆ addObject() [7/19]

CLASS_DECLSPEC void GEOM_FADE2D::Visualizer2::addObject ( const std::vector< ConstraintSegment2 * > &  vConstraintSegments,
const Color c 
)
Parameters
vConstraintSegmentsVector of pointers to ConstraintSegment2 objects.
cColor for the constraint segments. Define the Color with bFill=true, i.e., Color(CRED,0.01,true), to draw marks at the endpoints.

◆ addObject() [8/19]

CLASS_DECLSPEC void GEOM_FADE2D::Visualizer2::addObject ( const std::vector< Edge2 > &  vEdges,
const Color c 
)
Parameters
vEdgesVector of Edge2 objects.
cColor for the edges. Define the Color with bFill=true, i.e., Color(CRED,0.01,true), to draw marks at the endpoints.

◆ addObject() [9/19]

CLASS_DECLSPEC void GEOM_FADE2D::Visualizer2::addObject ( const std::vector< Point2 * > &  vPoints,
const Color c 
)
Parameters
vPointsVector of pointers to Point2 objects.
cColor for the points.

◆ addObject() [10/19]

CLASS_DECLSPEC void GEOM_FADE2D::Visualizer2::addObject ( const std::vector< Point2 > &  vPoints,
const Color c 
)
Parameters
vPointsVector of Point2 objects.
cColor for the points.

◆ addObject() [11/19]

CLASS_DECLSPEC void GEOM_FADE2D::Visualizer2::addObject ( const std::vector< PShape > &  vPolygonalShapes,
const Color c 
)
Parameters
vPolygonalShapesVector of polygonal shapes.
cColor for the shapes. To fill the shapes, set bFill to true in the Color constructor (e.g., Color(CRED, 0.01, true)).

◆ addObject() [12/19]

CLASS_DECLSPEC void GEOM_FADE2D::Visualizer2::addObject ( const std::vector< Segment2 > &  vSegments,
const Color c 
)
Parameters
vSegmentsVector of Segment2 objects.
cColor for the segments.

◆ addObject() [13/19]

CLASS_DECLSPEC void GEOM_FADE2D::Visualizer2::addObject ( const std::vector< Triangle2 * > &  vT,
const Color c 
)
Parameters
vTVector of pointers to Triangle2 objects.
cColor for the triangles. Define the Color with bFill=true, i.e., Color(CRED,0.01,true), to fill the triangles.

◆ addObject() [14/19]

CLASS_DECLSPEC void GEOM_FADE2D::Visualizer2::addObject ( const std::vector< Triangle2 > &  vT,
const Color c 
)
Parameters
vTVector of Triangle2 objects.
cColor for the triangles. Define the Color with bFill=true, i.e., Color(CRED,0.01,true), to fill the triangles.

◆ addObject() [15/19]

CLASS_DECLSPEC void GEOM_FADE2D::Visualizer2::addObject ( const std::vector< VertexPair2 > &  vVertexPairs,
const Color c 
)
Parameters
vVertexPairsVector of VertexPair2 objects defining segments.
cColor for the segments defined by the vertex pairs. Define the Color with bFill=true, i.e., Color(CRED,0.01,true), to draw marks at the endpoints.

◆ addObject() [16/19]

CLASS_DECLSPEC void GEOM_FADE2D::Visualizer2::addObject ( const std::vector< VoroCell2 * > &  vC,
const Color c 
)
Parameters
vCVector of pointers to Voronoi cells.
cColor for the Voronoi cells. To fill the cells, set bFill to true in the Color constructor (e.g., Color(CRED, 0.01, true)).

◆ addObject() [17/19]

CLASS_DECLSPEC void GEOM_FADE2D::Visualizer2::addObject ( const Triangle2 tri,
const Color c 
)
Parameters
triTriangle2 object.
cColor for the triangle. Define the Color with bFill=true, i.e., Color(CRED,0.01,true), to fill the triangle.

◆ addObject() [18/19]

CLASS_DECLSPEC void GEOM_FADE2D::Visualizer2::addObject ( ConstraintGraph2 pCG,
const Color c 
)
Parameters
pCGPointer to a ConstraintGraph2
cColor for the ConstraintGraph2. Define the Color with bFill=true, i.e., Color(CRED,0.01,true), to draw marks at the endpoints of the individual segments.

◆ addObject() [19/19]

CLASS_DECLSPEC void GEOM_FADE2D::Visualizer2::addObject ( VoroCell2 pVoroCell,
const Color c 
)
Parameters
pVoroCellPointer to a Voronoi cell.
cColor for the Voronoi cell. To fill the Voronoi cell, set bFill to true in the Color constructor (e.g., Color(CRED, 0.01, true)).

◆ writeFile()

CLASS_DECLSPEC void GEOM_FADE2D::Visualizer2::writeFile ( )
Note
This method must be called after all objects have been added in order to write the output file.

The documentation for this class was generated from the following file: