Salome HOME
Invalidate method added.
[modules/hydro.git] / src / HYDROData / HYDROData_PolylineXY.h
1
2 #ifndef HYDROData_PolylineXY_HeaderFile
3 #define HYDROData_PolylineXY_HeaderFile
4
5 #include "HYDROData_IPolyline.h"
6
7 DEFINE_STANDARD_HANDLE(HYDROData_PolylineXY, HYDROData_IPolyline)
8
9 class QPainterPath;
10
11 /**\class HYDROData_PolylineXY
12  * \brief Class that stores/retreives information about the 
13  *        parametric profile points.
14  */
15 class HYDROData_PolylineXY : public HYDROData_IPolyline
16 {
17 protected:
18   /**
19    * Enumeration of tags corresponding to the persistent object parameters.
20    */
21   enum DataTag
22   {
23     DataTag_First = HYDROData_IPolyline::DataTag_First + 100, ///< first tag, to reserve
24   };
25
26 public:
27   DEFINE_STANDARD_RTTI(HYDROData_PolylineXY);
28
29
30   /**
31    * Returns the kind of this object. Must be redefined in all objects of known type.
32    */
33   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_POLYLINEXY;}
34
35   /**
36    * Dump object to Python script representation.
37    */
38   HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
39
40   /**
41    * Returns data of object wrapped to QVariant.
42    * Reimplemented to wrap and return saved path.
43    */
44   HYDRODATA_EXPORT virtual QVariant GetDataVariant();
45
46 public:
47
48   /**
49    * Returns the 3D presentation of all points.
50    */
51   HYDRODATA_EXPORT virtual TopoDS_Shape GetShape();
52
53   /**
54    * Update the wire contour on the basis of the polyline data.
55    * Call this method whenever you made changes for polyline data.
56    */
57   HYDRODATA_EXPORT virtual void Update();
58
59
60    /**
61    * Returns true if polyline is closed
62    */
63   HYDRODATA_EXPORT bool IsClosed() const;
64
65   
66   /**
67    * Returns number of sections.
68    */
69   HYDRODATA_EXPORT virtual int NbSections() const;
70
71   /**
72    * Adds new one section.
73    * \param theSectName name of the section
74    * \param theSectionType type of section
75    * \param theIsClosed flag indicates closures of section
76    */
77   HYDRODATA_EXPORT virtual void AddSection( const TCollection_AsciiString& theSectName,
78                                             const SectionType              theSectionType,
79                                             const bool                     theIsClosed );
80
81   /**
82    * Returns name of section with given index.
83    * \param theSectionIndex index of section
84    */
85   HYDRODATA_EXPORT virtual TCollection_AsciiString GetSectionName( const int theSectionIndex ) const;
86
87   /**
88    * Set name for section with given index.
89    * \param theSectionIndex index of section
90    * \param theSectionName new section name
91    */
92   HYDRODATA_EXPORT virtual void SetSectionName( const int                      theSectionIndex, 
93                                                 const TCollection_AsciiString& theSectionName );
94
95   /**
96    * Returns type of section with given index.
97    * \param theSectionIndex index of section
98    */
99   HYDRODATA_EXPORT virtual SectionType GetSectionType( const int theSectionIndex ) const;
100
101   /**
102    * Set type for section with given index.
103    * \param theSectionIndex index of section
104    * \param theSectionType new section type
105    */
106   HYDRODATA_EXPORT virtual void SetSectionType( const int         theSectionIndex, 
107                                                 const SectionType theSectionType );
108
109   /**
110    * Returns true if section with given index is closed.
111    * \param theSectionIndex index of section
112    */
113   HYDRODATA_EXPORT virtual bool IsClosedSection( const int theSectionIndex ) const;
114
115   /**
116    * Set closed flag for section with given index.
117    * \param theSectionIndex index of section
118    * \param theIsClosed new closures state
119    */
120   HYDRODATA_EXPORT virtual void SetSectionClosed( const int  theSectionIndex, 
121                                                   const bool theIsClosed );
122
123   /**
124    * Adds new one section.
125    * \param theSectName name of the section
126    * \param theSectionType type of section
127    * \param theIsClosed flag indicates closures of section
128    */
129   HYDRODATA_EXPORT virtual void GetSections( NCollection_Sequence<TCollection_AsciiString>& theSectNames,
130                                              NCollection_Sequence<SectionType>&             theSectTypes,
131                                              NCollection_Sequence<bool>&                    theSectClosures ) const;
132
133   /**
134    * Removes section with given index.
135    * \param theSectionIndex index of section
136    */
137   HYDRODATA_EXPORT virtual void RemoveSection( const int theSectionIndex );
138
139   /**
140    * Removes all sections.
141    */
142   HYDRODATA_EXPORT virtual void RemoveSections();
143
144
145   /**
146    * Adds new point for section with index "theSectionIndex".
147    * \param theSectionIndex index of section
148    * \param thePoint point to add
149    * \param theBeforeIndex if not equal -1 then insert point in this pos
150    */
151   HYDRODATA_EXPORT virtual void AddPoint( const int    theSectionIndex,
152                                           const Point& thePoint,
153                                           const int    thePointIndex = -1 );
154
155   /**
156    * Replaces point for section with index "theSectionIndex".
157    * \param theSectionIndex index of section
158    * \param thePoint new point
159    * \param thePointIndex index of point to replace
160    */
161   HYDRODATA_EXPORT virtual void SetPoint( const int    theSectionIndex,
162                                           const Point& thePoint,
163                                           const int    thePointIndex );
164
165   /**
166    * Removes point from section with index "theSectionIndex".
167    * \param theSectionIndex index of section
168    * \param thePointIndex index of point
169    */
170   HYDRODATA_EXPORT virtual void RemovePoint( const int theSectionIndex,
171                                              const int thePointIndex );
172
173
174   /**
175    * Returns list of points.
176    * \param theSectionIndex if not equal -1 then list of points returned
177    *                        only for section with this index
178    * \return list of points
179    */
180   HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1 ) const;
181
182
183   /**
184    * Returns the painter path.
185    * Note: currently only the first section of the polyline data is taken into account.
186    * \return polyline painter path.
187    */
188   HYDRODATA_EXPORT virtual QPainterPath GetPainterPath() const;
189
190
191 protected:
192
193   friend class HYDROData_Profile;
194   friend class HYDROData_Iterator;
195
196   /**
197    * Creates new object in the internal data structure. Use higher level objects 
198    * to create objects with real content.
199    */
200   HYDRODATA_EXPORT HYDROData_PolylineXY();
201
202   /**
203    * Destructs properties of the object and object itself, removes it from the document.
204    */
205   HYDRODATA_EXPORT ~HYDROData_PolylineXY();
206 };
207
208 #endif