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();
49 * Returns default wire color for new polyline.
51 HYDRODATA_EXPORT static QColor DefaultWireColor();
56 * Returns the presentation of polyline section in CAS maner.
58 HYDRODATA_EXPORT static TopoDS_Wire BuildWire( const SectionType& theType,
59 const bool& theIsClosed,
60 const NCollection_Sequence<gp_XYZ>& thePoints );
63 * Returns the presentation of polyline section in Qt maner.
65 HYDRODATA_EXPORT static void BuildPainterPath( QPainterPath& thePath,
66 const SectionType& theType,
67 const bool& theIsClosed,
68 const NCollection_Sequence<gp_XYZ>& thePoints );
73 * Returns the 2D presentation of all points.
75 HYDRODATA_EXPORT virtual TopoDS_Shape GetShape() const;
78 * Returns the 3D presentation of all points.
80 HYDRODATA_EXPORT virtual bool ImportShape( const TopoDS_Shape& theShape );
83 * Update the wire contour on the basis of the polyline data.
84 * Call this method whenever you made changes for polyline data.
86 HYDRODATA_EXPORT virtual void Update();
90 * Returns flag indicating that polyline can be edited or not.
92 HYDRODATA_EXPORT virtual bool IsEditable() const;
96 * Returns true if polyline is closed
97 * \param theIsSimpleCheck flag indicating the type of checking
98 * - if true then all wires checked on closures
99 * - if false then for positive result polyline should consist of
100 * only one wire and which must be closed
102 HYDRODATA_EXPORT bool IsClosed( const bool theIsSimpleCheck = true ) const;
105 * Returns the distance beetwen first and point with index thePointIndex
106 * at the section with index theSectionIndex. -1 is returned if error is occurred.
108 HYDRODATA_EXPORT double GetDistance( const int theSectionIndex,
109 const int thePointIndex ) const;
113 * Returns number of sections.
115 HYDRODATA_EXPORT virtual int NbSections() const;
118 * Adds new one section.
119 * \param theSectName name of the section
120 * \param theSectionType type of section
121 * \param theIsClosed flag indicates closures of section
123 HYDRODATA_EXPORT virtual void AddSection( const TCollection_AsciiString& theSectName,
124 const SectionType theSectionType,
125 const bool theIsClosed );
128 * Returns name of section with given index.
129 * \param theSectionIndex index of section
131 HYDRODATA_EXPORT virtual TCollection_AsciiString GetSectionName( const int theSectionIndex ) const;
134 * Set name for section with given index.
135 * \param theSectionIndex index of section
136 * \param theSectionName new section name
138 HYDRODATA_EXPORT virtual void SetSectionName( const int theSectionIndex,
139 const TCollection_AsciiString& theSectionName );
142 * Returns type of section with given index.
143 * \param theSectionIndex index of section
145 HYDRODATA_EXPORT virtual SectionType GetSectionType( const int theSectionIndex ) const;
148 * Set type for section with given index.
149 * \param theSectionIndex index of section
150 * \param theSectionType new section type
152 HYDRODATA_EXPORT virtual void SetSectionType( const int theSectionIndex,
153 const SectionType theSectionType );
156 * Returns true if section with given index is closed.
157 * \param theSectionIndex index of section
159 HYDRODATA_EXPORT virtual bool IsClosedSection( const int theSectionIndex ) const;
162 * Set closed flag for section with given index.
163 * \param theSectionIndex index of section
164 * \param theIsClosed new closures state
166 HYDRODATA_EXPORT virtual void SetSectionClosed( const int theSectionIndex,
167 const bool theIsClosed );
170 * Adds new one section.
171 * \param theSectName name of the section
172 * \param theSectionType type of section
173 * \param theIsClosed flag indicates closures of section
175 HYDRODATA_EXPORT virtual void GetSections( NCollection_Sequence<TCollection_AsciiString>& theSectNames,
176 NCollection_Sequence<SectionType>& theSectTypes,
177 NCollection_Sequence<bool>& theSectClosures ) const;
180 * Removes section with given index.
181 * \param theSectionIndex index of section
183 HYDRODATA_EXPORT virtual void RemoveSection( const int theSectionIndex );
186 * Removes all sections.
188 HYDRODATA_EXPORT virtual void RemoveSections();
192 * Adds new point for section with index "theSectionIndex".
193 * \param theSectionIndex index of section
194 * \param thePoint point to add
195 * \param theBeforeIndex if not equal -1 then insert point in this pos
197 HYDRODATA_EXPORT virtual void AddPoint( const int theSectionIndex,
198 const Point& thePoint,
199 const int thePointIndex = -1 );
202 * Replaces point for section with index "theSectionIndex".
203 * \param theSectionIndex index of section
204 * \param thePoint new point
205 * \param thePointIndex index of point to replace
207 HYDRODATA_EXPORT virtual void SetPoint( const int theSectionIndex,
208 const Point& thePoint,
209 const int thePointIndex );
212 * Replaces point for section with index "theSectionIndex".
213 * \param theSectionIndex index of section
214 * \param thePoints new points
216 HYDRODATA_EXPORT virtual void SetPoints( const int theSectionIndex,
217 const PointsList& thePoints );
220 * Removes point from section with index "theSectionIndex".
221 * \param theSectionIndex index of section
222 * \param thePointIndex index of point
224 HYDRODATA_EXPORT virtual void RemovePoint( const int theSectionIndex,
225 const int thePointIndex );
229 * Returns list of points.
230 * \param theSectionIndex if not equal -1 then list of points returned
231 * only for section with this index
232 * \return list of points
234 HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1 ) const;
238 * Returns the painter path.
239 * Note: currently only the first section of the polyline data is taken into account.
240 * \return polyline painter path.
242 HYDRODATA_EXPORT virtual QPainterPath GetPainterPath() const;
248 * Sets the flag indicating that polyline can be edited or not.
250 HYDRODATA_EXPORT virtual void setEditable( const bool theIsEditable );
254 friend class HYDROData_Profile;
255 friend class HYDROData_Iterator;
258 * Creates new object in the internal data structure. Use higher level objects
259 * to create objects with real content.
261 HYDRODATA_EXPORT HYDROData_PolylineXY();
264 * Destructs properties of the object and object itself, removes it from the document.
266 HYDRODATA_EXPORT ~HYDROData_PolylineXY();