1 #ifndef HYDROData_Polyline_HeaderFile
2 #define HYDROData_Polyline_HeaderFile
4 #include <HYDROData_Object.h>
6 #include <TCollection_ExtendedString.hxx>
9 #include <QPainterPath>
14 DEFINE_STANDARD_HANDLE(HYDROData_Polyline, HYDROData_Object)
16 struct PolylineSection
19 enum SectionType{ SECTION_POLYLINE=0, SECTION_SPLINE=1 };
21 PolylineSection(){ myIsClosed=true; myType=SECTION_POLYLINE; mySectionName="Section";}
22 TCollection_ExtendedString mySectionName;
25 QList<double> myCoords;
28 /**\class HYDROData_Polyline
29 * \brief Class that stores/retreives information about the painter path.
31 * Keeps path as binary array of element type and coordinates
32 * of image with correspondent API for forkind wit hthese properties.
34 class HYDROData_Polyline : public HYDROData_Object
38 typedef QList<PolylineSection> PolylineData;
42 * Enumeration of tags corresponding to the persistent object parameters.
46 DataTag_First = HYDROData_Object::DataTag_First + 100, ///< first tag, to reserve
48 DataTag_SectionsClosed,
56 DEFINE_STANDARD_RTTI(HYDROData_Polyline);
59 * Returns the kind of this object. Must be redefined in all objects of known type.
61 HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_POLYLINE;}
64 * Dump object to Python script representation.
66 HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
69 * Returns data of object wrapped to QVariant.
70 * Reimplemented to wrap and return saved path.
72 HYDRODATA_EXPORT virtual QVariant GetDataVariant();
75 * Replace current polyline data by new sections list
76 * \param theSections the sections list
78 HYDRODATA_EXPORT void setPolylineData( const PolylineData& theSections );
81 * Return polyline data
82 * \return polyline section list
84 HYDRODATA_EXPORT PolylineData getPolylineData() const;
87 * Returns true if polyline is closed
89 HYDRODATA_EXPORT bool isClosed() const;
92 * Return polyline dimension
93 * \return polyline dimension (2 or 3)
95 HYDRODATA_EXPORT int getDimension() const;
98 * Set polyline dimension (2 or 3)
99 * \param theDimension the polyline dimension
101 HYDRODATA_EXPORT void setDimension( int theDimension );
104 * Remove all sections from polyline
106 HYDRODATA_EXPORT void removeAll();
109 * Returns the painter path.
110 * Note: currently only the first section of the polyline data is taken into account.
112 HYDRODATA_EXPORT QPainterPath painterPath() const;
114 HYDRODATA_EXPORT void SetZValue( const double theZValue );
115 HYDRODATA_EXPORT double ZValue() const;
118 * Sets the wire contour of the object.
120 HYDRODATA_EXPORT void SetWire( const TopoDS_Wire& theWire );
123 * Returns the wire contour of the object.
125 HYDRODATA_EXPORT TopoDS_Wire Wire() const;
129 * Update the wire contour on the basis of the polyline data.
131 void UpdateWire( const PolylineData& theSections );
135 friend class HYDROData_Iterator;
138 * Creates new object in the internal data structure. Use higher level objects
139 * to create objects with real content.
141 HYDROData_Polyline();
144 * Destructs properties of the object and object itself, removes it from the document.
146 ~HYDROData_Polyline();