]> SALOME platform Git repositories - modules/hydro.git/blob - src/HYDROData/HYDROData_Object.h
Salome HOME
Comments moved.
[modules/hydro.git] / src / HYDROData / HYDROData_Object.h
1
2 #ifndef HYDROData_Object_HeaderFile
3 #define HYDROData_Object_HeaderFile
4
5 #include <HYDROData_Entity.h>
6
7
8 DEFINE_STANDARD_HANDLE(HYDROData_Object, HYDROData_Entity)
9
10 class TopoDS_Shape;
11 class Handle(HYDROData_Bathymetry);
12 class Handle(HYDROData_DummyObject3D);
13
14 /**\class HYDROData_Object
15  * \brief The base class for all geometrical objects in the HYDRO module.
16  *
17  */
18 class HYDROData_Object : public HYDROData_Entity
19 {
20 protected:
21   /**
22    * Enumeration of tags corresponding to the persistent object parameters.
23    */
24   enum DataTag
25   {
26     DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
27     DataTag_TopShape,
28     DataTag_Shape3D,
29     DataTag_Bathymetry,   ///< reference bathymetry
30     DataTag_FillingColor, ///< filling color of geometrical object
31     DataTag_BorderColor,  ///< border color of geometrical object
32     DataTag_Object3D      ///< child 3D object
33   };
34
35 public:
36   DEFINE_STANDARD_RTTI(HYDROData_Object);
37
38   /**
39    * Update the geometry object.
40    * Call this method whenever you made changes for object data.
41    */
42   HYDRODATA_EXPORT virtual void Update();
43
44   /**
45    * Returns the list of all reference objects of this object.
46    */
47   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
48
49   /**
50    * Sets the "MustBeUpdated" flag: if object is depended on updated features.
51    * Reimplemented to update the state of child 3D object.
52    */
53   HYDRODATA_EXPORT virtual void SetToUpdate( bool theFlag );
54
55
56   /**
57    * Sets the top(2d projection) shape of the object.
58    */
59   HYDRODATA_EXPORT virtual void SetTopShape( const TopoDS_Shape& theShape );
60
61   /**
62    * Returns the top shape of the object.
63    */
64   HYDRODATA_EXPORT virtual TopoDS_Shape GetTopShape() const = 0;
65
66   /**
67    * Sets the 3d shape of the object.
68    */
69   HYDRODATA_EXPORT virtual void SetShape3D( const TopoDS_Shape& theShape );
70
71   /**
72    * Returns the 3d shape of the object.
73    */
74   HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const = 0;
75
76   
77   /**
78    * Returns reference object which represent the 3D shape of object.
79    * Base implementation returns NULL pointer.
80    */
81   HYDRODATA_EXPORT virtual Handle(HYDROData_DummyObject3D) GetObject3D() const;
82
83
84   /**
85    * Set reference bathymetry object for geometry object.
86    */
87   HYDRODATA_EXPORT virtual void SetBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry );
88
89   /**
90    * Returns reference bathymetry object of geometry object.
91    */
92   HYDRODATA_EXPORT virtual Handle(HYDROData_Bathymetry) GetBathymetry() const;
93
94   /**
95    * Clear the reference bathymetry object for geometry object.
96    */
97   HYDRODATA_EXPORT virtual void RemoveBathymetry();
98
99    /**
100    * Sets filling color for object.
101    */
102   HYDRODATA_EXPORT virtual void SetFillingColor( const QColor& theColor );
103
104   /**
105    * Returns filling color of object.
106    */
107   HYDRODATA_EXPORT virtual QColor GetFillingColor() const;
108
109    /**
110    * Sets border color for object.
111    */
112   HYDRODATA_EXPORT virtual void SetBorderColor( const QColor& theColor );
113
114   /**
115    * Returns border color of object.
116    */
117   HYDRODATA_EXPORT virtual QColor GetBorderColor() const;
118
119   /**
120    * Returns default filling color for new object.
121    */
122   HYDRODATA_EXPORT static QColor DefaultFillingColor();
123
124   /**
125    * Returns default border color for new object.
126    */
127   HYDRODATA_EXPORT static QColor DefaultBorderColor();
128
129 protected:
130
131   /**
132    * Returns default filling color for new object.
133    */
134   HYDRODATA_EXPORT virtual QColor getDefaultFillingColor() const;
135
136   /**
137    * Returns default border color for new object.
138    */
139   HYDRODATA_EXPORT virtual QColor getDefaultBorderColor() const;
140
141 protected:
142
143   /**
144    * Creates new object in the internal data structure. Use higher level objects 
145    * to create objects with real content.
146    */
147   HYDRODATA_EXPORT HYDROData_Object();
148
149   /**
150    * Destructs properties of the object and object itself, removes it from the document.
151    */
152   virtual HYDRODATA_EXPORT ~HYDROData_Object();
153
154 protected:
155
156   /**
157    * Checks and if necessary create child 3D object.
158    * Reimplement this function in your subclass if you 
159    * do not want to create child 3D object.
160    */
161   HYDRODATA_EXPORT virtual void checkAndSetObject3D();
162
163   /**
164    * Retrieve the top shape of the object from data label.
165    */
166   HYDRODATA_EXPORT TopoDS_Shape getTopShape() const;
167
168   /**
169    * Removes the top shape from data label of the object.
170    */
171   HYDRODATA_EXPORT void removeTopShape();
172
173
174   /**
175    * Retrieve the 3d shape of the object from data label.
176    */
177   HYDRODATA_EXPORT TopoDS_Shape getShape3D() const;
178
179   /**
180    * Removes the 3d shape from data label of the object.
181    */
182   HYDRODATA_EXPORT void removeShape3D();
183 };
184
185 #endif