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 * Returns data of object wrapped to QVariant.
45 * Reimplemented to wrap and return saved path.
47 HYDRODATA_EXPORT virtual QVariant GetDataVariant();
50 * Returns default wire color for new polyline.
52 HYDRODATA_EXPORT static QColor DefaultWireColor();
57 * Returns the presentation of polyline section in CAS maner.
59 HYDRODATA_EXPORT static TopoDS_Wire BuildWire( const SectionType& theType,
60 const bool& theIsClosed,
61 const NCollection_Sequence<gp_XYZ>& thePoints );
64 * Returns the presentation of polyline section in Qt maner.
66 HYDRODATA_EXPORT static void BuildPainterPath( QPainterPath& thePath,
67 const SectionType& theType,
68 const bool& theIsClosed,
69 const NCollection_Sequence<gp_XYZ>& thePoints );
74 * Imports shape from IOR.
75 * \param theIOR the IOR of Geom object
76 * \return \c true if shape has been successfully imported
78 HYDRODATA_EXPORT virtual bool ImportFromGeomIOR( const TCollection_AsciiString& theIOR );
81 * Stores the study entry of the imported GEOM object.
82 * \param theEntry GEOM object entry
84 HYDRODATA_EXPORT void SetGeomObjectEntry( const TCollection_AsciiString& theEntry );
87 * Returns the imported GEOM object entry.
89 HYDRODATA_EXPORT TCollection_AsciiString GetGeomObjectEntry() const;
94 * Returns the 2D presentation of all points.
96 HYDRODATA_EXPORT virtual TopoDS_Shape GetShape() const;
99 * Returns the 3D presentation of all points.
101 HYDRODATA_EXPORT virtual bool ImportShape( const TopoDS_Shape& theShape );
104 * Update the wire contour on the basis of the polyline data.
105 * Call this method whenever you made changes for polyline data.
107 HYDRODATA_EXPORT virtual void Update();
111 * Returns flag indicating that polyline can be edited or not.
113 HYDRODATA_EXPORT virtual bool IsEditable() const;
117 * Returns true if polyline is closed
118 * \param theIsSimpleCheck flag indicating the type of checking
119 * - if true then all wires checked on closures
120 * - if false then for positive result polyline should consist of
121 * only one wire and which must be closed
123 HYDRODATA_EXPORT bool IsClosed( const bool theIsSimpleCheck = true ) const;
126 * Returns the distance beetwen first and point with index thePointIndex
127 * at the section with index theSectionIndex. -1 is returned if error is occurred.
129 HYDRODATA_EXPORT double GetDistance( const int theSectionIndex,
130 const int thePointIndex ) const;
134 * Returns number of sections.
136 HYDRODATA_EXPORT virtual int NbSections() const;
139 * Adds new one section.
140 * \param theSectName name of the section
141 * \param theSectionType type of section
142 * \param theIsClosed flag indicates closures of section
144 HYDRODATA_EXPORT virtual void AddSection( const TCollection_AsciiString& theSectName,
145 const SectionType theSectionType,
146 const bool theIsClosed );
149 * Returns name of section with given index.
150 * \param theSectionIndex index of section
152 HYDRODATA_EXPORT virtual TCollection_AsciiString GetSectionName( const int theSectionIndex ) const;
155 * Set name for section with given index.
156 * \param theSectionIndex index of section
157 * \param theSectionName new section name
159 HYDRODATA_EXPORT virtual void SetSectionName( const int theSectionIndex,
160 const TCollection_AsciiString& theSectionName );
163 * Returns type of section with given index.
164 * \param theSectionIndex index of section
166 HYDRODATA_EXPORT virtual SectionType GetSectionType( const int theSectionIndex ) const;
169 * Set type for section with given index.
170 * \param theSectionIndex index of section
171 * \param theSectionType new section type
173 HYDRODATA_EXPORT virtual void SetSectionType( const int theSectionIndex,
174 const SectionType theSectionType );
177 * Returns true if section with given index is closed.
178 * \param theSectionIndex index of section
180 HYDRODATA_EXPORT virtual bool IsClosedSection( const int theSectionIndex ) const;
183 * Set closed flag for section with given index.
184 * \param theSectionIndex index of section
185 * \param theIsClosed new closures state
187 HYDRODATA_EXPORT virtual void SetSectionClosed( const int theSectionIndex,
188 const bool theIsClosed );
191 * Adds new one section.
192 * \param theSectName name of the section
193 * \param theSectionType type of section
194 * \param theIsClosed flag indicates closures of section
196 HYDRODATA_EXPORT virtual void GetSections( NCollection_Sequence<TCollection_AsciiString>& theSectNames,
197 NCollection_Sequence<SectionType>& theSectTypes,
198 NCollection_Sequence<bool>& theSectClosures ) const;
201 * Removes section with given index.
202 * \param theSectionIndex index of section
204 HYDRODATA_EXPORT virtual void RemoveSection( const int theSectionIndex );
207 * Removes all sections.
209 HYDRODATA_EXPORT virtual void RemoveSections();
213 * Adds new point for section with index "theSectionIndex".
214 * \param theSectionIndex index of section
215 * \param thePoint point to add
216 * \param theBeforeIndex if not equal -1 then insert point in this pos
218 HYDRODATA_EXPORT virtual void AddPoint( const int theSectionIndex,
219 const Point& thePoint,
220 const int thePointIndex = -1 );
223 * Replaces point for section with index "theSectionIndex".
224 * \param theSectionIndex index of section
225 * \param thePoint new point
226 * \param thePointIndex index of point to replace
228 HYDRODATA_EXPORT virtual void SetPoint( const int theSectionIndex,
229 const Point& thePoint,
230 const int thePointIndex );
233 * Replaces point for section with index "theSectionIndex".
234 * \param theSectionIndex index of section
235 * \param thePoints new points
237 HYDRODATA_EXPORT virtual void SetPoints( const int theSectionIndex,
238 const PointsList& thePoints );
241 * Removes point from section with index "theSectionIndex".
242 * \param theSectionIndex index of section
243 * \param thePointIndex index of point
245 HYDRODATA_EXPORT virtual void RemovePoint( const int theSectionIndex,
246 const int thePointIndex );
250 * Returns list of points.
251 * \param theSectionIndex if not equal -1 then list of points returned
252 * only for section with this index
253 * \return list of points
255 HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1 ) const;
259 * Returns the painter path.
260 * Note: currently only the first section of the polyline data is taken into account.
261 * \return polyline painter path.
263 HYDRODATA_EXPORT virtual QPainterPath GetPainterPath() const;
269 * Sets the flag indicating that polyline can be edited or not.
271 HYDRODATA_EXPORT virtual void setEditable( const bool theIsEditable );
275 friend class HYDROData_Profile;
276 friend class HYDROData_Iterator;
279 * Creates new object in the internal data structure. Use higher level objects
280 * to create objects with real content.
282 HYDRODATA_EXPORT HYDROData_PolylineXY();
285 * Destructs properties of the object and object itself, removes it from the document.
287 HYDRODATA_EXPORT ~HYDROData_PolylineXY();