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