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();
50 * Checks that object has 2D presentation. Reimlemented to retun true.
52 HYDRODATA_EXPORT virtual bool IsHas2dPrs() const;
55 * Returns data of object wrapped to QVariant.
56 * Reimplemented to wrap and return saved path.
58 HYDRODATA_EXPORT virtual QVariant GetDataVariant();
61 * Returns default wire color for new polyline.
63 HYDRODATA_EXPORT static QColor DefaultWireColor();
68 * Returns the presentation of polyline section in CAS maner.
70 HYDRODATA_EXPORT static TopoDS_Wire BuildWire( const SectionType& theType,
71 const bool& theIsClosed,
72 const NCollection_Sequence<gp_XYZ>& thePoints );
75 * Returns the presentation of polyline section in Qt maner.
77 HYDRODATA_EXPORT static void BuildPainterPath( QPainterPath& thePath,
78 const SectionType& theType,
79 const bool& theIsClosed,
80 const NCollection_Sequence<gp_XYZ>& thePoints );
85 * Imports shape from IOR.
86 * \param theIOR the IOR of Geom object
87 * \return \c true if shape has been successfully imported
89 HYDRODATA_EXPORT virtual bool ImportFromGeomIOR( const TCollection_AsciiString& theIOR );
92 * Stores the study entry of the imported GEOM object.
93 * \param theEntry GEOM object entry
95 HYDRODATA_EXPORT void SetGeomObjectEntry( const TCollection_AsciiString& theEntry );
98 * Returns the imported GEOM object entry.
100 HYDRODATA_EXPORT TCollection_AsciiString GetGeomObjectEntry() const;
105 * Returns the 2D presentation of all points.
107 HYDRODATA_EXPORT virtual TopoDS_Shape GetShape() const;
110 * Returns the 3D presentation of all points.
112 HYDRODATA_EXPORT virtual bool ImportShape( const TopoDS_Shape& theShape );
116 * Returns flag indicating that polyline can be edited or not.
118 HYDRODATA_EXPORT virtual bool IsEditable() const;
122 * Returns true if polyline is closed
123 * \param theIsSimpleCheck flag indicating the type of checking
124 * - if true then all wires checked on closures
125 * - if false then for positive result polyline should consist of
126 * only one wire and which must be closed
128 HYDRODATA_EXPORT bool IsClosed( const bool theIsSimpleCheck = true ) const;
131 * Returns the distance beetwen first and point with index thePointIndex
132 * at the section with index theSectionIndex. -1 is returned if error is occurred.
134 HYDRODATA_EXPORT double GetDistance( const int theSectionIndex,
135 const int thePointIndex ) const;
139 * Returns number of sections.
141 HYDRODATA_EXPORT virtual int NbSections() const;
144 * Adds new one section.
145 * \param theSectName name of the section
146 * \param theSectionType type of section
147 * \param theIsClosed flag indicates closures of section
149 HYDRODATA_EXPORT virtual void AddSection( const TCollection_AsciiString& theSectName,
150 const SectionType theSectionType,
151 const bool theIsClosed );
154 * Returns name of section with given index.
155 * \param theSectionIndex index of section
157 HYDRODATA_EXPORT virtual TCollection_AsciiString GetSectionName( const int theSectionIndex ) const;
160 * Set name for section with given index.
161 * \param theSectionIndex index of section
162 * \param theSectionName new section name
164 HYDRODATA_EXPORT virtual void SetSectionName( const int theSectionIndex,
165 const TCollection_AsciiString& theSectionName );
168 * Returns type of section with given index.
169 * \param theSectionIndex index of section
171 HYDRODATA_EXPORT virtual SectionType GetSectionType( const int theSectionIndex ) const;
174 * Set type for section with given index.
175 * \param theSectionIndex index of section
176 * \param theSectionType new section type
178 HYDRODATA_EXPORT virtual void SetSectionType( const int theSectionIndex,
179 const SectionType theSectionType );
182 * Returns true if section with given index is closed.
183 * \param theSectionIndex index of section
185 HYDRODATA_EXPORT virtual bool IsClosedSection( const int theSectionIndex ) const;
188 * Set closed flag for section with given index.
189 * \param theSectionIndex index of section
190 * \param theIsClosed new closures state
192 HYDRODATA_EXPORT virtual void SetSectionClosed( const int theSectionIndex,
193 const bool theIsClosed );
196 * Adds new one section.
197 * \param theSectName name of the section
198 * \param theSectionType type of section
199 * \param theIsClosed flag indicates closures of section
201 HYDRODATA_EXPORT virtual void GetSections( NCollection_Sequence<TCollection_AsciiString>& theSectNames,
202 NCollection_Sequence<SectionType>& theSectTypes,
203 NCollection_Sequence<bool>& theSectClosures ) const;
206 * Removes section with given index.
207 * \param theSectionIndex index of section
209 HYDRODATA_EXPORT virtual void RemoveSection( const int theSectionIndex );
212 * Removes all sections.
214 HYDRODATA_EXPORT virtual void RemoveSections();
218 * Adds new point for section with index "theSectionIndex".
219 * \param theSectionIndex index of section
220 * \param thePoint point to add
221 * \param theBeforeIndex if not equal -1 then insert point in this pos
223 HYDRODATA_EXPORT virtual void AddPoint( const int theSectionIndex,
224 const Point& thePoint,
225 const int thePointIndex = -1 );
228 * Replaces point for section with index "theSectionIndex".
229 * \param theSectionIndex index of section
230 * \param thePoint new point
231 * \param thePointIndex index of point to replace
233 HYDRODATA_EXPORT virtual void SetPoint( const int theSectionIndex,
234 const Point& thePoint,
235 const int thePointIndex );
238 * Replaces point for section with index "theSectionIndex".
239 * \param theSectionIndex index of section
240 * \param thePoints new points
242 HYDRODATA_EXPORT virtual void SetPoints( const int theSectionIndex,
243 const PointsList& thePoints );
246 * Removes point from section with index "theSectionIndex".
247 * \param theSectionIndex index of section
248 * \param thePointIndex index of point
250 HYDRODATA_EXPORT virtual void RemovePoint( const int theSectionIndex,
251 const int thePointIndex );
255 * Returns list of points.
256 * \param theSectionIndex if not equal -1 then list of points returned
257 * only for section with this index
258 * \return list of points
260 HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1 ) const;
264 * Returns the painter path.
265 * Note: currently only the first section of the polyline data is taken into account.
266 * \return polyline painter path.
268 HYDRODATA_EXPORT virtual QPainterPath GetPainterPath() const;
274 * Sets the flag indicating that polyline can be edited or not.
276 HYDRODATA_EXPORT virtual void setEditable( const bool theIsEditable );
280 friend class HYDROData_Profile;
281 friend class HYDROData_Iterator;
284 * Creates new object in the internal data structure. Use higher level objects
285 * to create objects with real content.
287 HYDRODATA_EXPORT HYDROData_PolylineXY();
290 * Destructs properties of the object and object itself, removes it from the document.
292 HYDRODATA_EXPORT ~HYDROData_PolylineXY();