]> SALOME platform Git repositories - modules/hydro.git/blob - src/HYDROData/HYDROData_Polyline.h
Salome HOME
Polyline object was updated
[modules/hydro.git] / src / HYDROData / HYDROData_Polyline.h
1 #ifndef HYDROData_Polyline_HeaderFile
2 #define HYDROData_Polyline_HeaderFile
3
4 #include <HYDROData_Object.h>
5
6 #include <TCollection_ExtendedString.hxx>
7
8 #include <QPointF>
9 #include <QPainterPath>
10 #include <QList>
11
12 DEFINE_STANDARD_HANDLE(HYDROData_Polyline, HYDROData_Object)
13
14 struct PolylineSection{
15 public:
16   enum SectionType{ SECTION_POLYLINE=0, SECTION_SPLINE=1 };
17
18   PolylineSection(){ myIsClosed=true; myType=SECTION_POLYLINE; mySectionName="Section";}
19   TCollection_ExtendedString  mySectionName;
20   SectionType                 myType;
21   bool                        myIsClosed;
22   QList<double>               myCoords;
23 };
24
25 /**\class HYDROData_Polyline
26  * \brief Class that stores/retreives information about the painter path.
27  *
28  * Keeps path as binary array of element type and coordinates
29  * of image with correspondent API for forkind wit hthese properties.
30  */
31 class HYDROData_Polyline : public HYDROData_Object
32 {
33 public:
34   DEFINE_STANDARD_RTTI(HYDROData_Polyline);
35
36   /**
37    * Returns the kind of this object. Must be redefined in all objects of known type.
38    */
39   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const {return KIND_POLYLINE;}
40
41   /**
42    * Replace current polyline data by new sections list
43    * \param theSections the sections list
44    */
45   HYDRODATA_EXPORT void setPolylineData( const QList<PolylineSection>& theSections );
46
47   /**
48    * Return polyline data
49    * \return polyline section list
50    */
51   HYDRODATA_EXPORT QList<PolylineSection> getPolylineData();
52    
53   /**
54    * Return polyline dimension
55    * \return polyline dimension (2 or 3)
56    */
57   HYDRODATA_EXPORT int getDimension() const;
58
59   /**
60    * Set polyline dimension (2 or 3)
61    * \param theDimension the polyline dimension
62    */
63   HYDRODATA_EXPORT void setDimension( int theDimension );
64
65   /**
66    * Remove all sections from polyline
67    */
68   HYDRODATA_EXPORT void removeAll();
69
70
71   /**
72    * Returns the painter path. The painter path is construct by lines
73    */
74   HYDRODATA_EXPORT QPainterPath painterPath();
75
76
77 protected:
78
79   friend class HYDROData_Iterator;
80
81   /**
82    * Creates new object in the internal data structure. Use higher level objects 
83    * to create objects with real content.
84    */
85   HYDROData_Polyline();
86
87   /**
88    * Destructs properties of the object and object itself, removes it from the document.
89    */
90   ~HYDROData_Polyline();
91 };
92
93 #endif