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 QPainterPath BuildPainterPath( const SectionType& theType,
61 const bool& theIsClosed,
62 const NCollection_Sequence<gp_XYZ>& thePoints );
67 * Returns the 3D presentation of all points.
69 HYDRODATA_EXPORT virtual TopoDS_Shape GetShape();
72 * Update the wire contour on the basis of the polyline data.
73 * Call this method whenever you made changes for polyline data.
75 HYDRODATA_EXPORT virtual void Update();
79 * Returns true if polyline is closed
81 HYDRODATA_EXPORT bool IsClosed() const;
84 * Returns the distance beetwen first and point with index thePointIndex
85 * at the section with index theSectionIndex. -1 is returned if error is occurred.
87 HYDRODATA_EXPORT double GetDistance( const int theSectionIndex,
88 const int thePointIndex ) const;
92 * Returns number of sections.
94 HYDRODATA_EXPORT virtual int NbSections() const;
97 * Adds new one section.
98 * \param theSectName name of the section
99 * \param theSectionType type of section
100 * \param theIsClosed flag indicates closures of section
102 HYDRODATA_EXPORT virtual void AddSection( const TCollection_AsciiString& theSectName,
103 const SectionType theSectionType,
104 const bool theIsClosed );
107 * Returns name of section with given index.
108 * \param theSectionIndex index of section
110 HYDRODATA_EXPORT virtual TCollection_AsciiString GetSectionName( const int theSectionIndex ) const;
113 * Set name for section with given index.
114 * \param theSectionIndex index of section
115 * \param theSectionName new section name
117 HYDRODATA_EXPORT virtual void SetSectionName( const int theSectionIndex,
118 const TCollection_AsciiString& theSectionName );
121 * Returns type of section with given index.
122 * \param theSectionIndex index of section
124 HYDRODATA_EXPORT virtual SectionType GetSectionType( const int theSectionIndex ) const;
127 * Set type for section with given index.
128 * \param theSectionIndex index of section
129 * \param theSectionType new section type
131 HYDRODATA_EXPORT virtual void SetSectionType( const int theSectionIndex,
132 const SectionType theSectionType );
135 * Returns true if section with given index is closed.
136 * \param theSectionIndex index of section
138 HYDRODATA_EXPORT virtual bool IsClosedSection( const int theSectionIndex ) const;
141 * Set closed flag for section with given index.
142 * \param theSectionIndex index of section
143 * \param theIsClosed new closures state
145 HYDRODATA_EXPORT virtual void SetSectionClosed( const int theSectionIndex,
146 const bool theIsClosed );
149 * Adds new one section.
150 * \param theSectName name of the section
151 * \param theSectionType type of section
152 * \param theIsClosed flag indicates closures of section
154 HYDRODATA_EXPORT virtual void GetSections( NCollection_Sequence<TCollection_AsciiString>& theSectNames,
155 NCollection_Sequence<SectionType>& theSectTypes,
156 NCollection_Sequence<bool>& theSectClosures ) const;
159 * Removes section with given index.
160 * \param theSectionIndex index of section
162 HYDRODATA_EXPORT virtual void RemoveSection( const int theSectionIndex );
165 * Removes all sections.
167 HYDRODATA_EXPORT virtual void RemoveSections();
171 * Adds new point for section with index "theSectionIndex".
172 * \param theSectionIndex index of section
173 * \param thePoint point to add
174 * \param theBeforeIndex if not equal -1 then insert point in this pos
176 HYDRODATA_EXPORT virtual void AddPoint( const int theSectionIndex,
177 const Point& thePoint,
178 const int thePointIndex = -1 );
181 * Replaces point for section with index "theSectionIndex".
182 * \param theSectionIndex index of section
183 * \param thePoint new point
184 * \param thePointIndex index of point to replace
186 HYDRODATA_EXPORT virtual void SetPoint( const int theSectionIndex,
187 const Point& thePoint,
188 const int thePointIndex );
191 * Removes point from section with index "theSectionIndex".
192 * \param theSectionIndex index of section
193 * \param thePointIndex index of point
195 HYDRODATA_EXPORT virtual void RemovePoint( const int theSectionIndex,
196 const int thePointIndex );
200 * Returns list of points.
201 * \param theSectionIndex if not equal -1 then list of points returned
202 * only for section with this index
203 * \return list of points
205 HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1 ) const;
209 * Returns the painter path.
210 * Note: currently only the first section of the polyline data is taken into account.
211 * \return polyline painter path.
213 HYDRODATA_EXPORT virtual QPainterPath GetPainterPath() const;
218 friend class HYDROData_Profile;
219 friend class HYDROData_Iterator;
222 * Creates new object in the internal data structure. Use higher level objects
223 * to create objects with real content.
225 HYDRODATA_EXPORT HYDROData_PolylineXY();
228 * Destructs properties of the object and object itself, removes it from the document.
230 HYDRODATA_EXPORT ~HYDROData_PolylineXY();