Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Polyline.h
Go to the documentation of this file.
1 
31 #pragma once
32 
33 #ifdef OGDF_INCLUDE_CGAL
34 
37 
38 namespace ogdf {
39 namespace internal {
40 namespace gcm {
41 namespace geometry {
42 
43 template<typename Kernel>
44 class Polyline_t : public std::vector<Point_t<Kernel>> {
45 private:
46 public:
47  Bbox bbox() const {
48  Bbox b = this->front().bbox();
49  for (auto& p : *this) {
50  b += p.bbox();
51  }
52  return b;
53  }
54 
55  bool is_degenerate() const {
56  bool degenerate = false;
57  for (std::size_t i = 0; i + 1 < this->size() && !degenerate; ++i) {
58  degenerate = (*this)[i] == (*this)[i + 1];
59  }
60  return degenerate;
61  }
62 };
63 
64 template<typename kernel>
65 std::ostream& operator<<(std::ostream& os, const Polyline_t<kernel>& pl) {
66  for (auto& p : pl) {
67  os << p << ", ";
68  }
69 
70  return os;
71 }
72 
73 }
74 }
75 }
76 }
77 
78 #endif
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
Point.h
ogdf::tlp::Attribute::size
@ size
Rectangle.h
ogdf::operator<<
std::ostream & operator<<(std::ostream &os, const ogdf::Array< E, INDEX > &a)
Prints array a to output stream os.
Definition: Array.h:978