Salome HOME
New calculation case dialog layout is implemented. Two lists of geometry objects...
[modules/hydro.git] / src / HYDROData / HYDROData_IPolyline.h
1
2 #ifndef HYDROData_IPolyline_HeaderFile
3 #define HYDROData_IPolyline_HeaderFile
4
5 #include "HYDROData_Entity.h"
6
7
8 DEFINE_STANDARD_HANDLE(HYDROData_IPolyline, HYDROData_Entity)
9
10 class gp_XY;
11 class TopoDS_Wire;
12 class Handle(TDataStd_RealList);
13
14 /**\class HYDROData_IPolyline
15  * \brief Base class that stores/retreives information about the 2D points.
16  */
17 class HYDROData_IPolyline : public HYDROData_Entity
18 {
19 public:
20
21   typedef gp_XY                       Point;
22   typedef NCollection_Sequence<Point> PointsList;
23
24 protected:
25   /**
26    * Enumeration of tags corresponding to the persistent object parameters.
27    */
28   enum DataTag
29   {
30     DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
31     DataTag_Points,
32   };
33
34 public:
35   DEFINE_STANDARD_RTTI(HYDROData_IPolyline);
36
37   /**
38    * Returns the 3D presentation of all points.
39    */
40   HYDRODATA_EXPORT virtual TopoDS_Wire GetWire() const = 0;
41
42
43   /**
44    * Returns number of sections.
45    */
46   HYDRODATA_EXPORT virtual int NbSections() const = 0;
47
48   /**
49    * Adds new one section.
50    * \param theIsClosed flag indicates type of polyline
51    */
52   HYDRODATA_EXPORT virtual void AddSection( const bool theIsClosed ) = 0;
53
54   /**
55    * Returns true if section with given index is closed.
56    * \param theSectionIndex index of section
57    */
58   HYDRODATA_EXPORT virtual bool IsClosedSection( const int theSectionIndex ) const = 0;
59
60   /**
61    * Removes section with given index.
62    * \param theSectionIndex index of section
63    */
64   HYDRODATA_EXPORT virtual void RemoveSection( const int theSectionIndex ) = 0;
65
66   /**
67    * Removes all sections.
68    */
69   HYDRODATA_EXPORT virtual void RemoveSections() = 0;
70
71
72   /**
73    * Return number of profile points.
74    * \return number of points
75    */
76   HYDRODATA_EXPORT int NbPoints( const int theSectionIndex = -1 ) const;
77
78   /**
79    * Adds new point for section with index "theSectionIndex".
80    * \param theSectionIndex index of section
81    * \param thePoint point to add
82    * \param theBeforeIndex if not equal -1 then insert point before this index
83    */
84   HYDRODATA_EXPORT virtual void AddPoint( const int    theSectionIndex,
85                                           const Point& thePoint,
86                                           const int    theBeforeIndex = -1 ) = 0;
87
88   /**
89    * Replaces point for section with index "theSectionIndex".
90    * \param theSectionIndex index of section
91    * \param thePointIndex index of point to replace
92    * \param thePoint new point
93    */
94   HYDRODATA_EXPORT virtual void SetPoint( const int    theSectionIndex,
95                                           const int    thePointIndex,
96                                           const Point& thePoint ) = 0;
97
98   /**
99    * Removes point from section with index "theSectionIndex".
100    * \param theSectionIndex index of section
101    * \param thePointIndex index of point
102    */
103   HYDRODATA_EXPORT virtual void RemovePoint( const int theSectionIndex,
104                                              const int thePointIndex ) = 0;
105
106
107   /**
108    * Returns list of points.
109    * \param theSectionIndex if not equal -1 then list of points returned
110    *                        only for section with this index
111    * \return list of points
112    */
113   HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1 ) const = 0;
114
115 protected:
116
117   void getPointsLists( const int                  theSectionIndex,
118                        Handle(TDataStd_RealList)& theListX,
119                        Handle(TDataStd_RealList)& theListY,
120                        const bool                 theIsCreate = true ) const;
121
122   void removePointsLists( const int theSectionIndex ) const;
123
124 protected:
125
126   /**
127    * Creates new object in the internal data structure. Use higher level objects 
128    * to create objects with real content.
129    */
130   HYDROData_IPolyline();
131
132   /**
133    * Destructs properties of the object and object itself, removes it from the document.
134    */
135   ~HYDROData_IPolyline();
136 };
137
138 #endif