2 #ifndef HYDROData_PolylineXY_HeaderFile
3 #define HYDROData_PolylineXY_HeaderFile
5 #include "HYDROData_IPolyline.h"
7 DEFINE_STANDARD_HANDLE(HYDROData_PolylineXY, HYDROData_IPolyline)
13 /**\class HYDROData_PolylineXY
14 * \brief Class that stores/retreives information about the
15 * parametric profile points.
17 class HYDROData_PolylineXY : public HYDROData_IPolyline
21 * Enumeration of tags corresponding to the persistent object parameters.
25 DataTag_First = HYDROData_IPolyline::DataTag_First + 100, ///< first tag, to reserve
29 DEFINE_STANDARD_RTTI(HYDROData_PolylineXY);
33 * Returns the kind of this object. Must be redefined in all objects of known type.
35 HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_POLYLINEXY;}
38 * Dump object to Python script representation.
40 HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
43 * Returns data of object wrapped to QVariant.
44 * Reimplemented to wrap and return saved path.
46 HYDRODATA_EXPORT virtual QVariant GetDataVariant();
51 * Returns the presentation of polyline section in CAS maner.
53 HYDRODATA_EXPORT static TopoDS_Wire BuildWire( const SectionType& theType,
54 const bool& theIsClosed,
55 const NCollection_Sequence<gp_XYZ>& thePoints );
58 * Returns the presentation of polyline section in Qt maner.
60 HYDRODATA_EXPORT static void BuildPainterPath( QPainterPath& thePath,
61 const SectionType& theType,
62 const bool& theIsClosed,
63 const NCollection_Sequence<gp_XYZ>& thePoints );
68 * Returns the 3D presentation of all points.
70 HYDRODATA_EXPORT virtual TopoDS_Shape GetShape();
73 * Update the wire contour on the basis of the polyline data.
74 * Call this method whenever you made changes for polyline data.
76 HYDRODATA_EXPORT virtual void Update();
80 * Returns true if polyline is closed
82 HYDRODATA_EXPORT bool IsClosed() const;
85 * Returns the distance beetwen first and point with index thePointIndex
86 * at the section with index theSectionIndex. -1 is returned if error is occurred.
88 HYDRODATA_EXPORT double GetDistance( const int theSectionIndex,
89 const int thePointIndex ) const;
93 * Returns number of sections.
95 HYDRODATA_EXPORT virtual int NbSections() const;
98 * Adds new one section.
99 * \param theSectName name of the section
100 * \param theSectionType type of section
101 * \param theIsClosed flag indicates closures of section
103 HYDRODATA_EXPORT virtual void AddSection( const TCollection_AsciiString& theSectName,
104 const SectionType theSectionType,
105 const bool theIsClosed );
108 * Returns name of section with given index.
109 * \param theSectionIndex index of section
111 HYDRODATA_EXPORT virtual TCollection_AsciiString GetSectionName( const int theSectionIndex ) const;
114 * Set name for section with given index.
115 * \param theSectionIndex index of section
116 * \param theSectionName new section name
118 HYDRODATA_EXPORT virtual void SetSectionName( const int theSectionIndex,
119 const TCollection_AsciiString& theSectionName );
122 * Returns type of section with given index.
123 * \param theSectionIndex index of section
125 HYDRODATA_EXPORT virtual SectionType GetSectionType( const int theSectionIndex ) const;
128 * Set type for section with given index.
129 * \param theSectionIndex index of section
130 * \param theSectionType new section type
132 HYDRODATA_EXPORT virtual void SetSectionType( const int theSectionIndex,
133 const SectionType theSectionType );
136 * Returns true if section with given index is closed.
137 * \param theSectionIndex index of section
139 HYDRODATA_EXPORT virtual bool IsClosedSection( const int theSectionIndex ) const;
142 * Set closed flag for section with given index.
143 * \param theSectionIndex index of section
144 * \param theIsClosed new closures state
146 HYDRODATA_EXPORT virtual void SetSectionClosed( const int theSectionIndex,
147 const bool theIsClosed );
150 * Adds new one section.
151 * \param theSectName name of the section
152 * \param theSectionType type of section
153 * \param theIsClosed flag indicates closures of section
155 HYDRODATA_EXPORT virtual void GetSections( NCollection_Sequence<TCollection_AsciiString>& theSectNames,
156 NCollection_Sequence<SectionType>& theSectTypes,
157 NCollection_Sequence<bool>& theSectClosures ) const;
160 * Removes section with given index.
161 * \param theSectionIndex index of section
163 HYDRODATA_EXPORT virtual void RemoveSection( const int theSectionIndex );
166 * Removes all sections.
168 HYDRODATA_EXPORT virtual void RemoveSections();
172 * Adds new point for section with index "theSectionIndex".
173 * \param theSectionIndex index of section
174 * \param thePoint point to add
175 * \param theBeforeIndex if not equal -1 then insert point in this pos
177 HYDRODATA_EXPORT virtual void AddPoint( const int theSectionIndex,
178 const Point& thePoint,
179 const int thePointIndex = -1 );
182 * Replaces point for section with index "theSectionIndex".
183 * \param theSectionIndex index of section
184 * \param thePoint new point
185 * \param thePointIndex index of point to replace
187 HYDRODATA_EXPORT virtual void SetPoint( const int theSectionIndex,
188 const Point& thePoint,
189 const int thePointIndex );
192 * Removes point from section with index "theSectionIndex".
193 * \param theSectionIndex index of section
194 * \param thePointIndex index of point
196 HYDRODATA_EXPORT virtual void RemovePoint( const int theSectionIndex,
197 const int thePointIndex );
201 * Returns list of points.
202 * \param theSectionIndex if not equal -1 then list of points returned
203 * only for section with this index
204 * \return list of points
206 HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1 ) const;
210 * Returns the painter path.
211 * Note: currently only the first section of the polyline data is taken into account.
212 * \return polyline painter path.
214 HYDRODATA_EXPORT virtual QPainterPath GetPainterPath() const;
219 friend class HYDROData_Profile;
220 friend class HYDROData_Iterator;
223 * Creates new object in the internal data structure. Use higher level objects
224 * to create objects with real content.
226 HYDRODATA_EXPORT HYDROData_PolylineXY();
229 * Destructs properties of the object and object itself, removes it from the document.
231 HYDRODATA_EXPORT ~HYDROData_PolylineXY();