IPolyline.hpp
1 #ifndef DM_IPOLYLINE_HPP_INCLUDED
2 #define DM_IPOLYLINE_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 class DM_API IPolyline : public IGeometry, public IAddInfoContainer
20 {
21 public:
22  class IPart;
23  typedef ConstIterator<IPoint> const_iterator_point; ///< Point iterator
24  typedef ConstIterator<IPart> const_iterator_part; ///< Part iterator
25 
26  class IPart : public ObjectBase, public IAddInfoContainer {
27  public:
28  virtual ~IPart() {}
29 
30  virtual int sizePoint() const = 0;
31  virtual bool isClosed() const = 0;
32 
33  virtual double getArea() const = 0; ///< returns the 2d area of surrounded polygon if the polyline part is closed. For non-closed parts 0 is returned.
34 
35  virtual double getLength2D() const = 0; ///< returns the 2D polyline length
36  virtual double getLength3D() const = 0; ///< returns the 3D polyline length
37 
38  virtual const IPoint& operator[](int) const = 0;
39 
40  virtual const_iterator_point beginPoint() const = 0;
41  virtual const_iterator_point endPoint() const = 0;
42  };
43 
44  virtual ~IPolyline() {}
45 
46  virtual int sizePoint() const = 0;
47  virtual int sizePart() const = 0;
48 
49  virtual bool isClosed() const = 0;
50 
51  virtual const IPoint& operator[](int) const = 0;
52 
53  virtual const_iterator_point beginPoint() const = 0;
54  virtual const_iterator_point endPoint() const = 0;
55 
56  virtual const_iterator_part beginPart() const = 0;
57  virtual const_iterator_part endPart() const = 0;
58 
59  virtual void reverse() = 0;
60 
61  virtual double getLength2D() const = 0; ///< returns the 2D polyline length of all parts
62  virtual double getLength3D() const = 0; ///< returns the 3D polyline length of all parts
63 
64  /// \brief get add info statistic object for all line points
65  virtual AddInfoStatisticsHandle getPointAddInfoStatistics() const = 0;
66 };
67 
68 typedef Handle< IPolyline > PolylineHandle;
69 
70 DM_NAMESPACE_END
71 
72 #endif //DM_IPOLYLINE_HPP_INCLUDED