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
26 DataTag_GeomObjectEntry, ///< study entry of the imported GEOM object
30 DEFINE_STANDARD_RTTI(HYDROData_PolylineXY);
34 * Returns the kind of this object. Must be redefined in all objects of known type.
36 HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_POLYLINEXY;}
39 * Dump object to Python script representation.
41 HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
44 * Update the wire contour on the basis of the polyline data.
45 * Call this method whenever you made changes for polyline data.
47 HYDRODATA_EXPORT virtual void Update();
49 HYDRODATA_EXPORT virtual void UpdateLocalCS( double theDx, double theDy );
52 * Checks that object has 2D presentation. Reimlemented to retun true.
54 HYDRODATA_EXPORT virtual bool IsHas2dPrs() const;
57 * Returns data of object wrapped to QVariant.
58 * Reimplemented to wrap and return saved path.
60 HYDRODATA_EXPORT virtual QVariant GetDataVariant();
63 * Returns default wire color for new polyline.
65 HYDRODATA_EXPORT static QColor DefaultWireColor();
70 * Returns the presentation of polyline section in CAS maner.
72 HYDRODATA_EXPORT static TopoDS_Wire BuildWire( const SectionType& theType,
73 const bool& theIsClosed,
74 const NCollection_Sequence<gp_XYZ>& thePoints );
77 * Returns the presentation of polyline section in Qt maner.
79 HYDRODATA_EXPORT static void BuildPainterPath( QPainterPath& thePath,
80 const SectionType& theType,
81 const bool& theIsClosed,
82 const NCollection_Sequence<gp_XYZ>& thePoints );
87 * Imports shape from IOR.
88 * \param theIOR the IOR of Geom object
89 * \return \c true if shape has been successfully imported
91 HYDRODATA_EXPORT virtual bool ImportFromGeomIOR( const TCollection_AsciiString& theIOR );
94 * Stores the study entry of the imported GEOM object.
95 * \param theEntry GEOM object entry
97 HYDRODATA_EXPORT void SetGeomObjectEntry( const TCollection_AsciiString& theEntry );
100 * Returns the imported GEOM object entry.
102 HYDRODATA_EXPORT TCollection_AsciiString GetGeomObjectEntry() const;
107 * Returns the 2D presentation of all points.
109 HYDRODATA_EXPORT virtual TopoDS_Shape GetShape() const;
112 * Returns the 3D presentation of all points.
114 HYDRODATA_EXPORT virtual bool ImportShape( const TopoDS_Shape& theShape );
118 * Returns flag indicating that polyline can be edited or not.
120 HYDRODATA_EXPORT virtual bool IsEditable() const;
124 * Returns true if polyline is closed
125 * \param theIsSimpleCheck flag indicating the type of checking
126 * - if true then all wires checked on closures
127 * - if false then for positive result polyline should consist of
128 * only one wire and which must be closed
130 HYDRODATA_EXPORT bool IsClosed( const bool theIsSimpleCheck = true ) const;
133 * Returns the distance beetwen first and point with index thePointIndex
134 * at the section with index theSectionIndex. -1 is returned if error is occurred.
136 HYDRODATA_EXPORT double GetDistance( const int theSectionIndex,
137 const int thePointIndex ) const;
141 * Returns number of sections.
143 HYDRODATA_EXPORT virtual int NbSections() const;
146 * Adds new one section.
147 * \param theSectName name of the section
148 * \param theSectionType type of section
149 * \param theIsClosed flag indicates closures of section
151 HYDRODATA_EXPORT virtual void AddSection( const TCollection_AsciiString& theSectName,
152 const SectionType theSectionType,
153 const bool theIsClosed );
156 * Returns name of section with given index.
157 * \param theSectionIndex index of section
159 HYDRODATA_EXPORT virtual TCollection_AsciiString GetSectionName( const int theSectionIndex ) const;
162 * Set name for section with given index.
163 * \param theSectionIndex index of section
164 * \param theSectionName new section name
166 HYDRODATA_EXPORT virtual void SetSectionName( const int theSectionIndex,
167 const TCollection_AsciiString& theSectionName );
170 * Returns type of section with given index.
171 * \param theSectionIndex index of section
173 HYDRODATA_EXPORT virtual SectionType GetSectionType( const int theSectionIndex ) const;
176 * Set type for section with given index.
177 * \param theSectionIndex index of section
178 * \param theSectionType new section type
180 HYDRODATA_EXPORT virtual void SetSectionType( const int theSectionIndex,
181 const SectionType theSectionType );
184 * Returns true if section with given index is closed.
185 * \param theSectionIndex index of section
187 HYDRODATA_EXPORT virtual bool IsClosedSection( const int theSectionIndex ) const;
190 * Set closed flag for section with given index.
191 * \param theSectionIndex index of section
192 * \param theIsClosed new closures state
194 HYDRODATA_EXPORT virtual void SetSectionClosed( const int theSectionIndex,
195 const bool theIsClosed );
198 * Adds new one section.
199 * \param theSectName name of the section
200 * \param theSectionType type of section
201 * \param theIsClosed flag indicates closures of section
203 HYDRODATA_EXPORT virtual void GetSections( NCollection_Sequence<TCollection_AsciiString>& theSectNames,
204 NCollection_Sequence<SectionType>& theSectTypes,
205 NCollection_Sequence<bool>& theSectClosures ) const;
208 * Removes section with given index.
209 * \param theSectionIndex index of section
211 HYDRODATA_EXPORT virtual void RemoveSection( const int theSectionIndex );
214 * Removes all sections.
216 HYDRODATA_EXPORT virtual void RemoveSections();
220 * Adds new point for section with index "theSectionIndex".
221 * \param theSectionIndex index of section
222 * \param thePoint point to add
223 * \param theBeforeIndex if not equal -1 then insert point in this pos
225 HYDRODATA_EXPORT virtual void AddPoint( const int theSectionIndex,
226 const Point& thePoint,
227 const int thePointIndex = -1 );
230 * Replaces point for section with index "theSectionIndex".
231 * \param theSectionIndex index of section
232 * \param thePoint new point
233 * \param thePointIndex index of point to replace
235 HYDRODATA_EXPORT virtual void SetPoint( const int theSectionIndex,
236 const Point& thePoint,
237 const int thePointIndex );
240 * Replaces point for section with index "theSectionIndex".
241 * \param theSectionIndex index of section
242 * \param thePoints new points
244 HYDRODATA_EXPORT virtual void SetPoints( const int theSectionIndex,
245 const PointsList& thePoints );
248 * Removes point from section with index "theSectionIndex".
249 * \param theSectionIndex index of section
250 * \param thePointIndex index of point
252 HYDRODATA_EXPORT virtual void RemovePoint( const int theSectionIndex,
253 const int thePointIndex );
257 * Returns list of points.
258 * \param theSectionIndex if not equal -1 then list of points returned
259 * only for section with this index
260 * \return list of points
262 HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1 ) const;
266 * Returns the painter path.
267 * Note: currently only the first section of the polyline data is taken into account.
268 * \return polyline painter path.
270 HYDRODATA_EXPORT virtual QPainterPath GetPainterPath() const;
276 * Sets the flag indicating that polyline can be edited or not.
278 HYDRODATA_EXPORT virtual void setEditable( const bool theIsEditable );
282 friend class HYDROData_Profile;
283 friend class HYDROData_Iterator;
286 * Creates new object in the internal data structure. Use higher level objects
287 * to create objects with real content.
289 HYDRODATA_EXPORT HYDROData_PolylineXY();
292 * Destructs properties of the object and object itself, removes it from the document.
294 HYDRODATA_EXPORT ~HYDROData_PolylineXY();