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 3D presentation of all points.
75 HYDRODATA_EXPORT virtual TopoDS_Shape GetShape();
78 * Update the wire contour on the basis of the polyline data.
79 * Call this method whenever you made changes for polyline data.
81 HYDRODATA_EXPORT virtual void Update();
85 * Returns true if polyline is closed
87 HYDRODATA_EXPORT bool IsClosed() const;
90 * Returns the distance beetwen first and point with index thePointIndex
91 * at the section with index theSectionIndex. -1 is returned if error is occurred.
93 HYDRODATA_EXPORT double GetDistance( const int theSectionIndex,
94 const int thePointIndex ) const;
98 * Returns number of sections.
100 HYDRODATA_EXPORT virtual int NbSections() const;
103 * Adds new one section.
104 * \param theSectName name of the section
105 * \param theSectionType type of section
106 * \param theIsClosed flag indicates closures of section
108 HYDRODATA_EXPORT virtual void AddSection( const TCollection_AsciiString& theSectName,
109 const SectionType theSectionType,
110 const bool theIsClosed );
113 * Returns name of section with given index.
114 * \param theSectionIndex index of section
116 HYDRODATA_EXPORT virtual TCollection_AsciiString GetSectionName( const int theSectionIndex ) const;
119 * Set name for section with given index.
120 * \param theSectionIndex index of section
121 * \param theSectionName new section name
123 HYDRODATA_EXPORT virtual void SetSectionName( const int theSectionIndex,
124 const TCollection_AsciiString& theSectionName );
127 * Returns type of section with given index.
128 * \param theSectionIndex index of section
130 HYDRODATA_EXPORT virtual SectionType GetSectionType( const int theSectionIndex ) const;
133 * Set type for section with given index.
134 * \param theSectionIndex index of section
135 * \param theSectionType new section type
137 HYDRODATA_EXPORT virtual void SetSectionType( const int theSectionIndex,
138 const SectionType theSectionType );
141 * Returns true if section with given index is closed.
142 * \param theSectionIndex index of section
144 HYDRODATA_EXPORT virtual bool IsClosedSection( const int theSectionIndex ) const;
147 * Set closed flag for section with given index.
148 * \param theSectionIndex index of section
149 * \param theIsClosed new closures state
151 HYDRODATA_EXPORT virtual void SetSectionClosed( const int theSectionIndex,
152 const bool theIsClosed );
155 * Adds new one section.
156 * \param theSectName name of the section
157 * \param theSectionType type of section
158 * \param theIsClosed flag indicates closures of section
160 HYDRODATA_EXPORT virtual void GetSections( NCollection_Sequence<TCollection_AsciiString>& theSectNames,
161 NCollection_Sequence<SectionType>& theSectTypes,
162 NCollection_Sequence<bool>& theSectClosures ) const;
165 * Removes section with given index.
166 * \param theSectionIndex index of section
168 HYDRODATA_EXPORT virtual void RemoveSection( const int theSectionIndex );
171 * Removes all sections.
173 HYDRODATA_EXPORT virtual void RemoveSections();
177 * Adds new point for section with index "theSectionIndex".
178 * \param theSectionIndex index of section
179 * \param thePoint point to add
180 * \param theBeforeIndex if not equal -1 then insert point in this pos
182 HYDRODATA_EXPORT virtual void AddPoint( const int theSectionIndex,
183 const Point& thePoint,
184 const int thePointIndex = -1 );
187 * Replaces point for section with index "theSectionIndex".
188 * \param theSectionIndex index of section
189 * \param thePoint new point
190 * \param thePointIndex index of point to replace
192 HYDRODATA_EXPORT virtual void SetPoint( const int theSectionIndex,
193 const Point& thePoint,
194 const int thePointIndex );
197 * Removes point from section with index "theSectionIndex".
198 * \param theSectionIndex index of section
199 * \param thePointIndex index of point
201 HYDRODATA_EXPORT virtual void RemovePoint( const int theSectionIndex,
202 const int thePointIndex );
206 * Returns list of points.
207 * \param theSectionIndex if not equal -1 then list of points returned
208 * only for section with this index
209 * \return list of points
211 HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1 ) const;
215 * Returns the painter path.
216 * Note: currently only the first section of the polyline data is taken into account.
217 * \return polyline painter path.
219 HYDRODATA_EXPORT virtual QPainterPath GetPainterPath() const;
224 friend class HYDROData_Profile;
225 friend class HYDROData_Iterator;
228 * Creates new object in the internal data structure. Use higher level objects
229 * to create objects with real content.
231 HYDRODATA_EXPORT HYDROData_PolylineXY();
234 * Destructs properties of the object and object itself, removes it from the document.
236 HYDRODATA_EXPORT ~HYDROData_PolylineXY();