Loading [MathJax]/extensions/tex2jax.js
IPolygon.hpp
1 #pragma once
2 
3 #include "DM/config.hpp"
4 #include "DM/Handle.hpp"
5 #include "DM/IGeometry.hpp"
6 #include "DM/IPoint.hpp"
7 #include "DM/IAddInfo.hpp"
8 #include "DM/IAddInfoContainer.hpp"
9 #include "DM/Iterator.hpp"
10 #include "DM/IAddInfoStatistics.hpp"
11 
12 DM_NAMESPACE_BEGIN
13 
14 /// \brief interface to a 2.5d polygon of arbitrary complexity
15 /**
16  The DM polygon object can handle arbitrary nested polygons (often called multi part polygons). The implementation is based
17  on the CGAL nef polygons, a 2d polyhedron representation. Hence, positive regions (=part of the polygon) may contain an arbitrary number of negative
18  regions (=not part of the polygon. also called holes) contains positive regions again and so on defining a hierarchy (=levels of polygons)
19  Additionally the number of level 0 polygons (top level hierarchy) is not limited.
20 
21  Such polygon objects can only be constructed by a corresponding polygon factory object. However, it has to be considered that there are some
22  prerequisites regarding the topological correctness of the input data. see the IPolylineFactory for details
23 
24  The polygon object is structured in a hierarchy and can be traversed with the corresponding part iterators. To identify positive and negative
25  region use the IFace::positveFace member function of the corresponding part object. The part object has no nested parts if the IPart::sizePart
26  retruns zero or the distance of the part iterators is empty.
27 
28  For accessing the points of part object use the corresponding point iterator functions. Note that points of positive regions are sorted
29  counterclockwise and points of negative regions clockwise.
30 
31  For listing all polygon points in a non-hierarchical manner use the point iterator function of the polygon object itself
32 */
33 class DM_API IPolygon : public IGeometry, public IAddInfoContainer
34 {
35 public:
36  class IFace;
37  typedef ConstIterator<IPoint> const_iterator_point; ///< Point iterator
38  typedef ConstIterator<IFace> const_iterator_face; ///< Face iterator
39 
40  class IFace : public ObjectBase {
41  public:
42  virtual ~IFace() {}
43 
44  virtual bool positveFace() const = 0; ///< returns true if part is a positive region (=belongs to polygon) or false otherise
45 
46  virtual bool isDegenerated() const = 0; ///< flag if the current part is degenerated (2d aera is zero)
47 
48  virtual int sizePoint() const = 0; ///< number of points of the outer boundary
49  virtual int sizePart() const = 0; ///< number of nested parts
50 
51  virtual const_iterator_point beginPoint() const = 0; ///< begin point iterator of outer boundary
52  virtual const_iterator_point endPoint() const = 0; ///< end point iterator of outer boundary
53 
54  virtual const_iterator_face beginPart() const = 0;
55  virtual const_iterator_face endPart() const = 0;
56  };
57 
58  IPolygon* clone() const override = 0;
59  virtual ~IPolygon() {}
60 
61  virtual bool isEmpty() const = 0; ///< check if polygon is empty
62 
63  virtual int sizePoint() const = 0; ///< number of all points within the polygon
64  virtual int sizeFace() const = 0; ///< number of all faces within the polygon
65  virtual int sizePart() const = 0; ///< number of parts (level-0 faces) of the polygons
66 
67  virtual const_iterator_point beginPoint() const = 0;
68  virtual const_iterator_point endPoint() const = 0;
69 
70  virtual const_iterator_face beginFace() const = 0;
71  virtual const_iterator_face endFace() const = 0;
72 
73  virtual const_iterator_face beginPart() const = 0;
74  virtual const_iterator_face endPart() const = 0;
75 
76  virtual double getArea() const = 0; ///< returns the 2d area of the polygon
77 
78  /// \brief returns the maximum hierarchy depth for this poylgon
79  /** If a polygon is empty, then 0 is returned. If the polygon consists of one part or
80  spatially separated parts (=positive faces) only, the depth is 1. If parts have one or multiples
81  holes (=negative face) than the depth is 2. If holes contains islands then the depth is 2 and so on.
82 
83  \param ignorDegeneratedFaces flag if degenerated faces should be considered or not
84  \returns maximum hierarchy depth
85  */
86  virtual unsigned getMaxDepth(bool ignorDegeneratedFaces=false) const = 0;
87 
88  /// \brief get add info statistic object for all line points
89  virtual AddInfoStatisticsHandle getPointAddInfoStatistics() const = 0;
90 };
91 
92 typedef Handle< IPolygon > PolygonHandle;
93 
94 DM_NAMESPACE_END
virtual IGeometry * clone() const =0
get an object copy
Definition: Iterator.hpp:96
interface to a 2.5d polygon of arbitrary complexity
Definition: IPolygon.hpp:33
Definition: IPolygon.hpp:40
ConstIterator< IFace > const_iterator_face
Face iterator.
Definition: IPolygon.hpp:38
ConstIterator< IPoint > const_iterator_point
Point iterator.
Definition: IPolygon.hpp:36
Interface of an add info container object (used by geometry objects)
Definition: IAddInfoContainer.hpp:14
Base class of all geometry objects.
Definition: IGeometry.hpp:26
Smart pointer class using reference counting with support for DM objects (see ObjectBase)
Definition: Handle.hpp:75
Definition: M/c++_api/inc/DM/ObjectBase.hpp:8