Salome HOME
The bathymetry is changed to their base altitude class for geometry objects (Bug...
[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_IAltitudeObject);
12 class Handle(HYDROData_DummyObject3D);
13 class Handle(HYDROData_ShapesGroup);
14
15 /**\class HYDROData_Object
16  * \brief The base class for all geometrical objects in the HYDRO module.
17  *
18  */
19 class HYDROData_Object : public HYDROData_Entity
20 {
21 protected:
22   /**
23    * Enumeration of tags corresponding to the persistent object parameters.
24    */
25   enum DataTag
26   {
27     DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
28     DataTag_TopShape,
29     DataTag_Shape3D,
30     DataTag_AltitudeObject,     ///< reference altitude object
31     DataTag_FillingColor,       ///< filling color of geometrical object
32     DataTag_BorderColor,        ///< border color of geometrical object
33     DataTag_Object3D,           ///< child 3D object
34     DataTag_EdgesGroup,         ///< child group objects
35   };
36
37 public:
38   DEFINE_STANDARD_RTTI(HYDROData_Object);
39
40   /**
41    * Updates the name of this object.
42    * Reimplemented to update the names child groups.
43    */
44   HYDRODATA_EXPORT virtual void SetName( const QString& theName );
45
46   /**
47    * Update the geometry object.
48    * Call this method whenever you made changes for object data.
49    */
50   HYDRODATA_EXPORT virtual void Update();
51
52   /**
53    * Returns the list of all reference objects of this object.
54    */
55   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
56
57   /**
58    * Sets the "MustBeUpdated" flag: if object is depended on updated features.
59    * Reimplemented to update the state of child 3D object.
60    */
61   HYDRODATA_EXPORT virtual void SetToUpdate( bool theFlag );
62
63
64   /**
65    * Sets the top(2d projection) shape of the object.
66    */
67   HYDRODATA_EXPORT virtual void SetTopShape( const TopoDS_Shape& theShape );
68
69   /**
70    * Returns the top shape of the object.
71    */
72   HYDRODATA_EXPORT virtual TopoDS_Shape GetTopShape() const = 0;
73
74   /**
75    * Sets the 3d shape of the object.
76    */
77   HYDRODATA_EXPORT virtual void SetShape3D( const TopoDS_Shape& theShape );
78
79   /**
80    * Returns the 3d shape of the object.
81    */
82   HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const = 0;
83
84   
85   /**
86    * Returns reference object which represent the 3D shape of object.
87    */
88   HYDRODATA_EXPORT virtual Handle(HYDROData_DummyObject3D) GetObject3D() const;
89
90   /**
91    * Returns sequence of object groups.
92    */
93   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGroups() const;
94
95
96   /**
97    * Set reference altitude object for geometry object.
98    */
99   HYDRODATA_EXPORT virtual bool SetAltitudeObject( const Handle(HYDROData_IAltitudeObject)& theAltitude );
100
101   /**
102    * Returns reference altitude object of geometry object.
103    */
104   HYDRODATA_EXPORT virtual Handle(HYDROData_IAltitudeObject) GetAltitudeObject() const;
105
106   /**
107    * Clear the reference altitude object for geometry object.
108    */
109   HYDRODATA_EXPORT virtual void RemoveAltitudeObject();
110
111
112    /**
113    * Sets filling color for object.
114    */
115   HYDRODATA_EXPORT virtual void SetFillingColor( const QColor& theColor );
116
117   /**
118    * Returns filling color of object.
119    */
120   HYDRODATA_EXPORT virtual QColor GetFillingColor() const;
121
122    /**
123    * Sets border color for object.
124    */
125   HYDRODATA_EXPORT virtual void SetBorderColor( const QColor& theColor );
126
127   /**
128    * Returns border color of object.
129    */
130   HYDRODATA_EXPORT virtual QColor GetBorderColor() const;
131
132   /**
133    * Returns default filling color for new object.
134    */
135   HYDRODATA_EXPORT static QColor DefaultFillingColor();
136
137   /**
138    * Returns default border color for new object.
139    */
140   HYDRODATA_EXPORT static QColor DefaultBorderColor();
141
142 protected:
143
144   /**
145    * Returns default filling color for new object.
146    */
147   HYDRODATA_EXPORT virtual QColor getDefaultFillingColor() const;
148
149   /**
150    * Returns default border color for new object.
151    */
152   HYDRODATA_EXPORT virtual QColor getDefaultBorderColor() const;
153
154 protected:
155
156   /**
157    * Creates new object in the internal data structure. Use higher level objects 
158    * to create objects with real content.
159    */
160   HYDRODATA_EXPORT HYDROData_Object();
161
162   /**
163    * Destructs properties of the object and object itself, removes it from the document.
164    */
165   virtual HYDRODATA_EXPORT ~HYDROData_Object();
166
167 protected:
168
169   /**
170    * Checks and if necessary create child 3D object.
171    * Reimplement this function in your subclass if you 
172    * do not want to create child 3D object.
173    */
174   HYDRODATA_EXPORT virtual void checkAndSetObject3D();
175
176
177   /**
178    * Create new one child group object.
179    */
180   HYDRODATA_EXPORT virtual Handle(HYDROData_ShapesGroup) createGroupObject();
181
182   /**
183    * Create all necessary child group objects.
184    * Base implementation does nothing.
185    */
186   HYDRODATA_EXPORT virtual void createGroupObjects();
187
188   /**
189    * Remove all child group objects.
190    */
191   HYDRODATA_EXPORT virtual void removeGroupObjects();
192
193
194   /**
195    * Retrieve the top shape of the object from data label.
196    */
197   HYDRODATA_EXPORT TopoDS_Shape getTopShape() const;
198
199   /**
200    * Removes the top shape from data label of the object.
201    */
202   HYDRODATA_EXPORT void removeTopShape();
203
204
205   /**
206    * Retrieve the 3d shape of the object from data label.
207    */
208   HYDRODATA_EXPORT TopoDS_Shape getShape3D() const;
209
210   /**
211    * Removes the 3d shape from data label of the object.
212    */
213   HYDRODATA_EXPORT void removeShape3D();
214 };
215
216 #endif