Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
GeogebraExporter.h
Go to the documentation of this file.
1
31#pragma once
32
33#ifdef OGDF_INCLUDE_CGAL
34
37
38namespace ogdf {
39namespace internal {
40namespace gcm {
41
42namespace tools {
43
44template<typename stream = std::ostream>
45class GeogebraExporter {
46private:
48 unsigned int point_counter;
49
50public:
52 //nothing to do
53 }
54
55 template<typename type>
56 void add(const geometry::Point_t<type>& point) {
57 outstream << "A" << point_counter << "=" << point << "\n";
59 }
60
61 template<typename Polygon>
62 void add(const Polygon& polygon) {
63 unsigned int old_counter = point_counter;
64 for (unsigned int i = 0; i < polygon.size(); ++i) {
65 add(polygon[i]);
66 }
67
68 outstream << "input = polygon[";
69
70 for (unsigned int i = old_counter; i < point_counter; ++i) {
71 outstream << "A" << i;
72 if (i + 1 < point_counter) {
73 outstream << ", ";
74 }
75 }
76
77 outstream << "]\n";
78 }
79
80 template<typename type>
81 void add(const geometry::LineSegment_t<type>& l) {
82 unsigned int i = point_counter;
83 add(l.source());
84 add(l.target());
85 outstream << "segment[A" << i << ", A" << i + 1 << "]\n";
86 }
87};
88}
89}
90}
91}
92
93#endif
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.