Fade2D Documentation pages v2.14
Delaunay Features
VtkWriter.h
Go to the documentation of this file.
1 // Copyright (C) Geom Software e.U, Bernhard Kornberger, Graz/Austria
2 //
3 // This file is part of the Fade2D library. The student license is free
4 // of charge and covers personal non-commercial research. Licensees
5 // holding a commercial license may use this file in accordance with
6 // the Commercial License Agreement.
7 //
8 // This software is provided AS IS with NO WARRANTY OF ANY KIND,
9 // INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS
10 // FOR A PARTICULAR PURPOSE.
11 //
12 // Please contact the author if any conditions of this licensing are
13 // not clear to you.
14 //
15 // Author: Bernhard Kornberger, bkorn (at) geom.at
16 // http://www.geom.at
17 
19 #pragma once
20 #include "common.h"
21 #include "Point2.h"
22 #include "Segment2.h"
23 #include "Edge2.h"
24 #include "Triangle2.h"
25 
26 #if GEOM_PSEUDO3D == GEOM_TRUE
27 namespace GEOM_FADE25D {
28 #elif GEOM_PSEUDO3D == GEOM_FALSE
29 namespace GEOM_FADE2D {
30 #else
31 #error GEOM_PSEUDO3D is not defined
32 #endif
33 
34 struct Dat3; // FWD
35 
39 {
40  VTK_RED,
41  VTK_GREEN,
42  VTK_BLUE,
43  VTK_YELLOW,
44  VTK_CYAN,
45  VTK_MAGENTA,
46  VTK_BLACK,
47  VTK_WHITE,
48  VTK_GRAY,
49  VTK_ORANGE,
50  VTK_PINK,
51  VTK_LIGHTBLUE,
52  VTK_DARKBLUE,
53  VTK_LIGHTGREEN,
54  VTK_BROWN,
55  VTK_PURPLE,
57 };
58 
61 class CLASS_DECLSPEC VtkWriter
62 {
63 public:
66  explicit VtkWriter(const char* name);
67 
70 
74 
78  void addPoint(const Point2& p, VtkColor color);
79 
83  void addPoints(const std::vector<Point2*>& vPoints, VtkColor color);
84  void addPoints(const std::vector<Point2>& vPoints, VtkColor color);
85 
90  void addSegment(const Segment2& segment, VtkColor color, bool bWithEndPoints = false);
91 
96  void addSegment(const Point2& source, const Point2& target, VtkColor color, bool bWithEndPoints = false);
97 
102  void addSegments(const std::vector<Segment2>& vSegments, VtkColor color, bool bWithEndPoints = false);
103 
108  void addSegments(const std::vector<Edge2>& vEdges, VtkColor color, bool bWithEndPoints = false);
109 
114  void addSegments(const std::vector<Point2>& vSegmentEndPoints, VtkColor color, bool bWithEndPoints = false);
115 
119  void addTriangles(const std::vector<Triangle2*>& vT, VtkColor color);
120 
124  void addTriangles(const std::vector<Point2>& vTriangleCorners, VtkColor color);
125 
129  void addTriangle(const Triangle2& t, VtkColor color);
130 
134  void addTriangle(const Point2& p0, const Point2& p1, const Point2& p2, VtkColor color);
135 
137  void writeFile();
138 
139 private:
141  VtkWriter(const VtkWriter&);
142 
144  VtkWriter& operator=(const VtkWriter&);
145 
146  Dat3* pDat;
147 };
148 
149 } // namespace GEOM_FADE25D or GEOM_FADE2D
150 
VtkColor
Enumeration of colors used by the VTKWriter.
Definition: VtkWriter.h:39
@ VTK_TRANSPARENT
Meaning: Don't draw.
Definition: VtkWriter.h:56
Point.
Definition: Point2.h:53
Segment.
Definition: Segment2.h:39
Triangle.
Definition: Triangle2.h:60
A writer for the VTK file format.
Definition: VtkWriter.h:62
void addSegments(const std::vector< Point2 > &vSegmentEndPoints, VtkColor color, bool bWithEndPoints=false)
Add multiple segments with a specified color.
void addTriangle(const Point2 &p0, const Point2 &p1, const Point2 &p2, VtkColor color)
Add a triangle defined by three points.
void addSegments(const std::vector< Edge2 > &vEdges, VtkColor color, bool bWithEndPoints=false)
Add multiple Edge2 objects with a specified color.
void addSegment(const Point2 &source, const Point2 &target, VtkColor color, bool bWithEndPoints=false)
Add a segment defined by source and target points.
void addPoints(const std::vector< Point2 * > &vPoints, VtkColor color)
Add multiple points with a specified color.
void addSegments(const std::vector< Segment2 > &vSegments, VtkColor color, bool bWithEndPoints=false)
Add multiple segments with a specified color.
~VtkWriter()
Destructor.
void addTriangles(const std::vector< Triangle2 * > &vT, VtkColor color)
Add multiple triangles with a specified color.
void writeFile()
Write the VTK file.
void addTriangles(const std::vector< Point2 > &vTriangleCorners, VtkColor color)
Add multiple triangles defined by their corner points.
void addSegment(const Segment2 &segment, VtkColor color, bool bWithEndPoints=false)
Add a segment with a specified color.
void addPoint(const Point2 &p, VtkColor color)
Add a point with a specified color.
VtkWriter(const char *name)
Constructor.
void addTriangle(const Triangle2 &t, VtkColor color)
Add a triangle with a specified color.
VtkColor getNextColor()
Get the next color in the sequence.