1 #ifndef HYDROData_Polyline_HeaderFile
2 #define HYDROData_Polyline_HeaderFile
4 #include <HYDROData_Object.h>
6 #include <TCollection_ExtendedString.hxx>
9 #include <QPainterPath>
12 DEFINE_STANDARD_HANDLE(HYDROData_Polyline, HYDROData_Object)
14 struct PolylineSection
17 enum SectionType{ SECTION_POLYLINE=0, SECTION_SPLINE=1 };
19 PolylineSection(){ myIsClosed=true; myType=SECTION_POLYLINE; mySectionName="Section";}
20 TCollection_ExtendedString mySectionName;
23 QList<double> myCoords;
26 /**\class HYDROData_Polyline
27 * \brief Class that stores/retreives information about the painter path.
29 * Keeps path as binary array of element type and coordinates
30 * of image with correspondent API for forkind wit hthese properties.
32 class HYDROData_Polyline : public HYDROData_Object
36 typedef QList<PolylineSection> PolylineData;
40 * Enumeration of tags corresponding to the persistent object parameters.
44 DataTag_First = HYDROData_Object::DataTag_First + 100, ///< first tag, to reserve
46 DataTag_SectionsClosed,
52 DEFINE_STANDARD_RTTI(HYDROData_Polyline);
55 * Returns the kind of this object. Must be redefined in all objects of known type.
57 HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_POLYLINE;}
60 * Dump object to Python script representation.
62 HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
65 * Returns data of object wrapped to QVariant.
66 * Reimplemented to wrap and return saved path.
68 HYDRODATA_EXPORT virtual QVariant GetDataVariant();
71 * Replace current polyline data by new sections list
72 * \param theSections the sections list
74 HYDRODATA_EXPORT void setPolylineData( const PolylineData& theSections );
77 * Return polyline data
78 * \return polyline section list
80 HYDRODATA_EXPORT PolylineData getPolylineData() const;
83 * Return polyline dimension
84 * \return polyline dimension (2 or 3)
86 HYDRODATA_EXPORT int getDimension() const;
89 * Set polyline dimension (2 or 3)
90 * \param theDimension the polyline dimension
92 HYDRODATA_EXPORT void setDimension( int theDimension );
95 * Remove all sections from polyline
97 HYDRODATA_EXPORT void removeAll();
101 * Returns the painter path. The painter path is construct by lines
103 HYDRODATA_EXPORT QPainterPath painterPath();
108 friend class HYDROData_Iterator;
111 * Creates new object in the internal data structure. Use higher level objects
112 * to create objects with real content.
114 HYDROData_Polyline();
117 * Destructs properties of the object and object itself, removes it from the document.
119 ~HYDROData_Polyline();