2 #ifndef HYDROData_IPolyline_HeaderFile
3 #define HYDROData_IPolyline_HeaderFile
5 #include "HYDROData_Entity.h"
8 DEFINE_STANDARD_HANDLE(HYDROData_IPolyline, HYDROData_Entity)
12 class Handle(TDataStd_RealList);
13 class Handle(TDataStd_ExtStringList);
14 class Handle(TDataStd_BooleanList);
15 class Handle(TDataStd_IntegerList);
18 /**\class HYDROData_IPolyline
19 * \brief Base class that stores/retreives information about the 2D points.
21 class HYDROData_IPolyline : public HYDROData_Entity
25 enum SectionType{ SECTION_POLYLINE = 0, SECTION_SPLINE = 1 };
28 typedef NCollection_Sequence<Point> PointsList;
32 * Enumeration of tags corresponding to the persistent object parameters.
36 DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
39 DataTag_PolylineShape,
44 DEFINE_STANDARD_RTTI(HYDROData_IPolyline);
49 * Sets wire color for object.
51 HYDRODATA_EXPORT virtual void SetWireColor( const QColor& theColor );
54 * Returns wire color of object.
56 HYDRODATA_EXPORT virtual QColor GetWireColor() const;
59 * Returns default wire color for new object.
61 HYDRODATA_EXPORT static QColor DefaultWireColor();
66 * Returns the 3D presentation of all points.
68 HYDRODATA_EXPORT virtual TopoDS_Shape GetShape() const = 0;
72 * Returns number of sections.
74 HYDRODATA_EXPORT virtual int NbSections() const = 0;
77 * Adds new one section.
78 * \param theSectName name of the section
79 * \param theSectionType type of section
80 * \param theIsClosed flag indicates closures of section
82 HYDRODATA_EXPORT virtual void AddSection( const TCollection_AsciiString& theSectName,
83 const SectionType theSectionType,
84 const bool theIsClosed ) = 0;
87 * Returns name of section with given index.
88 * \param theSectionIndex index of section
90 HYDRODATA_EXPORT virtual TCollection_AsciiString GetSectionName( const int theSectionIndex ) const = 0;
93 * Set name for section with given index.
94 * \param theSectionIndex index of section
95 * \param theSectionName new section name
97 HYDRODATA_EXPORT virtual void SetSectionName( const int theSectionIndex,
98 const TCollection_AsciiString& theSectionName ) = 0;
101 * Returns type of section with given index.
102 * \param theSectionIndex index of section
104 HYDRODATA_EXPORT virtual SectionType GetSectionType( const int theSectionIndex ) const = 0;
107 * Set type for section with given index.
108 * \param theSectionIndex index of section
109 * \param theSectionType new section type
111 HYDRODATA_EXPORT virtual void SetSectionType( const int theSectionIndex,
112 const SectionType theSectionType ) = 0;
115 * Returns true if section with given index is closed.
116 * \param theSectionIndex index of section
118 HYDRODATA_EXPORT virtual bool IsClosedSection( const int theSectionIndex ) const = 0;
121 * Set closed flag for section with given index.
122 * \param theSectionIndex index of section
123 * \param theIsClosed new closures state
125 HYDRODATA_EXPORT virtual void SetSectionClosed( const int theSectionIndex,
126 const bool theIsClosed ) = 0;
129 * Removes section with given index.
130 * \param theSectionIndex index of section
132 HYDRODATA_EXPORT virtual void RemoveSection( const int theSectionIndex ) = 0;
135 * Removes all sections.
137 HYDRODATA_EXPORT virtual void RemoveSections() = 0;
141 * Return number of profile points.
142 * \return number of points
144 HYDRODATA_EXPORT int NbPoints( const int theSectionIndex = -1 ) const;
147 * Adds new point for section with index "theSectionIndex".
148 * \param theSectionIndex index of section
149 * \param thePoint point to add
150 * \param theBeforeIndex if not equal -1 then insert point before this index
152 HYDRODATA_EXPORT virtual void AddPoint( const int theSectionIndex,
153 const Point& thePoint,
154 const int theBeforeIndex = -1 ) = 0;
157 * Replaces point for section with index "theSectionIndex".
158 * \param theSectionIndex index of section
159 * \param thePoint new point
160 * \param thePointIndex index of point to replace
162 HYDRODATA_EXPORT virtual void SetPoint( const int theSectionIndex,
163 const Point& thePoint,
164 const int thePointIndex ) = 0;
167 * Removes point from section with index "theSectionIndex".
168 * \param theSectionIndex index of section
169 * \param thePointIndex index of point
171 HYDRODATA_EXPORT virtual void RemovePoint( const int theSectionIndex,
172 const int thePointIndex ) = 0;
176 * Returns list of points.
177 * \param theSectionIndex if not equal -1 then list of points returned
178 * only for section with this index
179 * \return list of points
181 HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1 ) const = 0;
185 TopoDS_Shape getPolylineShape() const;
187 void setPolylineShape( const TopoDS_Shape& theShape );
189 void removePolylineShape();
192 void getSectionsLists( Handle(TDataStd_ExtStringList)& theNamesList,
193 Handle(TDataStd_IntegerList)& theTypesList,
194 Handle(TDataStd_BooleanList)& theClosuresList,
195 const bool theIsCreate = true ) const;
197 void removeSectionsLists();
199 void getPointsLists( const int theSectionIndex,
200 Handle(TDataStd_RealList)& theListX,
201 Handle(TDataStd_RealList)& theListY,
202 const bool theIsCreate = true ) const;
204 void removePointsLists( const int theSectionIndex = -1 ) const;
209 * Creates new object in the internal data structure. Use higher level objects
210 * to create objects with real content.
212 HYDRODATA_EXPORT HYDROData_IPolyline();
215 * Destructs properties of the object and object itself, removes it from the document.
217 HYDRODATA_EXPORT ~HYDROData_IPolyline();