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,
43 DEFINE_STANDARD_RTTI(HYDROData_IPolyline);
46 * Returns the 3D presentation of all points.
48 HYDRODATA_EXPORT virtual TopoDS_Shape GetShape() = 0;
52 * Returns number of sections.
54 HYDRODATA_EXPORT virtual int NbSections() const = 0;
57 * Adds new one section.
58 * \param theSectName name of the section
59 * \param theSectionType type of section
60 * \param theIsClosed flag indicates closures of section
62 HYDRODATA_EXPORT virtual void AddSection( const TCollection_AsciiString& theSectName,
63 const SectionType theSectionType,
64 const bool theIsClosed ) = 0;
67 * Returns name of section with given index.
68 * \param theSectionIndex index of section
70 HYDRODATA_EXPORT virtual TCollection_AsciiString GetSectionName( const int theSectionIndex ) const = 0;
73 * Set name for section with given index.
74 * \param theSectionIndex index of section
75 * \param theSectionName new section name
77 HYDRODATA_EXPORT virtual void SetSectionName( const int theSectionIndex,
78 const TCollection_AsciiString& theSectionName ) = 0;
81 * Returns type of section with given index.
82 * \param theSectionIndex index of section
84 HYDRODATA_EXPORT virtual SectionType GetSectionType( const int theSectionIndex ) const = 0;
87 * Set type for section with given index.
88 * \param theSectionIndex index of section
89 * \param theSectionType new section type
91 HYDRODATA_EXPORT virtual void SetSectionType( const int theSectionIndex,
92 const SectionType theSectionType ) = 0;
95 * Returns true if section with given index is closed.
96 * \param theSectionIndex index of section
98 HYDRODATA_EXPORT virtual bool IsClosedSection( const int theSectionIndex ) const = 0;
101 * Set closed flag for section with given index.
102 * \param theSectionIndex index of section
103 * \param theIsClosed new closures state
105 HYDRODATA_EXPORT virtual void SetSectionClosed( const int theSectionIndex,
106 const bool theIsClosed ) = 0;
109 * Removes section with given index.
110 * \param theSectionIndex index of section
112 HYDRODATA_EXPORT virtual void RemoveSection( const int theSectionIndex ) = 0;
115 * Removes all sections.
117 HYDRODATA_EXPORT virtual void RemoveSections() = 0;
121 * Return number of profile points.
122 * \return number of points
124 HYDRODATA_EXPORT int NbPoints( const int theSectionIndex = -1 ) const;
127 * Adds new point for section with index "theSectionIndex".
128 * \param theSectionIndex index of section
129 * \param thePoint point to add
130 * \param theBeforeIndex if not equal -1 then insert point before this index
132 HYDRODATA_EXPORT virtual void AddPoint( const int theSectionIndex,
133 const Point& thePoint,
134 const int theBeforeIndex = -1 ) = 0;
137 * Replaces point for section with index "theSectionIndex".
138 * \param theSectionIndex index of section
139 * \param thePoint new point
140 * \param thePointIndex index of point to replace
142 HYDRODATA_EXPORT virtual void SetPoint( const int theSectionIndex,
143 const Point& thePoint,
144 const int thePointIndex ) = 0;
147 * Removes point from section with index "theSectionIndex".
148 * \param theSectionIndex index of section
149 * \param thePointIndex index of point
151 HYDRODATA_EXPORT virtual void RemovePoint( const int theSectionIndex,
152 const int thePointIndex ) = 0;
156 * Returns list of points.
157 * \param theSectionIndex if not equal -1 then list of points returned
158 * only for section with this index
159 * \return list of points
161 HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1 ) const = 0;
165 TopoDS_Shape getPolylineShape() const;
167 void setPolylineShape( const TopoDS_Shape& theShape );
169 void removePolylineShape();
172 void getSectionsLists( Handle(TDataStd_ExtStringList)& theNamesList,
173 Handle(TDataStd_IntegerList)& theTypesList,
174 Handle(TDataStd_BooleanList)& theClosuresList,
175 const bool theIsCreate = true ) const;
177 void removeSectionsLists();
179 void getPointsLists( const int theSectionIndex,
180 Handle(TDataStd_RealList)& theListX,
181 Handle(TDataStd_RealList)& theListY,
182 const bool theIsCreate = true ) const;
184 void removePointsLists( const int theSectionIndex = -1 ) const;
189 * Creates new object in the internal data structure. Use higher level objects
190 * to create objects with real content.
192 HYDRODATA_EXPORT HYDROData_IPolyline();
195 * Destructs properties of the object and object itself, removes it from the document.
197 HYDRODATA_EXPORT ~HYDROData_IPolyline();