Salome HOME
Import profiles protection (Bug #203).
[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     DataTag_ChildAltitudeObject, ///< child altitude object
36   };
37
38 public:
39   DEFINE_STANDARD_RTTI(HYDROData_Object);
40
41   /**
42    * Updates the name of this object.
43    * Reimplemented to update the names child groups.
44    */
45   HYDRODATA_EXPORT virtual void SetName( const QString& theName );
46
47   /**
48    * Update the geometry object.
49    * Call this method whenever you made changes for object data.
50    */
51   HYDRODATA_EXPORT virtual void Update();
52
53   /**
54    * Returns the list of all reference objects of this object.
55    */
56   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
57
58   /**
59    * Sets the "MustBeUpdated" flag: if object is depended on updated features.
60    * Reimplemented to update the state of child 3D object.
61    */
62   HYDRODATA_EXPORT virtual void SetToUpdate( bool theFlag );
63
64
65   /**
66    * Sets the top(2d projection) shape of the object.
67    */
68   HYDRODATA_EXPORT virtual void SetTopShape( const TopoDS_Shape& theShape );
69
70   /**
71    * Returns the top shape of the object.
72    */
73   HYDRODATA_EXPORT virtual TopoDS_Shape GetTopShape() const = 0;
74
75   /**
76    * Sets the 3d shape of the object.
77    */
78   HYDRODATA_EXPORT virtual void SetShape3D( const TopoDS_Shape& theShape );
79
80   /**
81    * Returns the 3d shape of the object.
82    */
83   HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const = 0;
84
85   
86   /**
87    * Returns reference object which represent the 3D shape of object.
88    */
89   HYDRODATA_EXPORT virtual Handle(HYDROData_DummyObject3D) GetObject3D() const;
90
91   /**
92    * Returns sequence of object groups.
93    */
94   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGroups() const;
95
96
97   /**
98    * Set reference altitude object for geometry object.
99    */
100   HYDRODATA_EXPORT virtual bool SetAltitudeObject( const Handle(HYDROData_IAltitudeObject)& theAltitude );
101
102   /**
103    * Returns reference altitude object of geometry object.
104    */
105   HYDRODATA_EXPORT virtual Handle(HYDROData_IAltitudeObject) GetAltitudeObject() const;
106
107   /**
108    * Clear the reference altitude object for geometry object.
109    */
110   HYDRODATA_EXPORT virtual void RemoveAltitudeObject();
111
112
113    /**
114    * Sets filling color for object.
115    */
116   HYDRODATA_EXPORT virtual void SetFillingColor( const QColor& theColor );
117
118   /**
119    * Returns filling color of object.
120    */
121   HYDRODATA_EXPORT virtual QColor GetFillingColor() const;
122
123    /**
124    * Sets border color for object.
125    */
126   HYDRODATA_EXPORT virtual void SetBorderColor( const QColor& theColor );
127
128   /**
129    * Returns border color of object.
130    */
131   HYDRODATA_EXPORT virtual QColor GetBorderColor() const;
132
133   /**
134    * Returns default filling color for new object.
135    */
136   HYDRODATA_EXPORT static QColor DefaultFillingColor();
137
138   /**
139    * Returns default border color for new object.
140    */
141   HYDRODATA_EXPORT static QColor DefaultBorderColor();
142
143 protected:
144
145   /**
146    * Returns default filling color for new object.
147    */
148   HYDRODATA_EXPORT virtual QColor getDefaultFillingColor() const;
149
150   /**
151    * Returns default border color for new object.
152    */
153   HYDRODATA_EXPORT virtual QColor getDefaultBorderColor() const;
154
155 protected:
156
157   /**
158    * Creates new object in the internal data structure. Use higher level objects 
159    * to create objects with real content.
160    */
161   HYDRODATA_EXPORT HYDROData_Object();
162
163   /**
164    * Destructs properties of the object and object itself, removes it from the document.
165    */
166   virtual HYDRODATA_EXPORT ~HYDROData_Object();
167
168 protected:
169
170   /**
171    * Checks and if necessary create child 3D object.
172    * Reimplement this function in your subclass if you 
173    * do not want to create child 3D object.
174    */
175   HYDRODATA_EXPORT virtual void checkAndSetObject3D();
176
177
178   /**
179    * Returns the type of child altitude object.
180    * Base implementation returns KIND_UNKNOWN, it means that child altitude 
181    * object will not be created inside of checkAndSetAltitudeObject() function.
182    * Reimplement this function in your subclass an return correct altitude
183    * object type if you want to create child altitude object.
184    */
185   HYDRODATA_EXPORT virtual ObjectKind getAltitudeObjectType() const;
186
187   /**
188    * Checks and if necessary create child altitude object.
189    */
190   HYDRODATA_EXPORT virtual void checkAndSetAltitudeObject();
191
192   /**
193    * Return the child altitude object.
194    */
195   HYDRODATA_EXPORT virtual Handle(HYDROData_IAltitudeObject) getChildAltitudeObject() const;
196
197
198   /**
199    * Create new one child group object.
200    */
201   HYDRODATA_EXPORT virtual Handle(HYDROData_ShapesGroup) createGroupObject();
202
203   /**
204    * Create all necessary child group objects.
205    * Base implementation does nothing.
206    */
207   HYDRODATA_EXPORT virtual void createGroupObjects();
208
209   /**
210    * Remove all child group objects.
211    */
212   HYDRODATA_EXPORT virtual void removeGroupObjects();
213
214
215   /**
216    * Retrieve the top shape of the object from data label.
217    */
218   HYDRODATA_EXPORT TopoDS_Shape getTopShape() const;
219
220   /**
221    * Removes the top shape from data label of the object.
222    */
223   HYDRODATA_EXPORT void removeTopShape();
224
225
226   /**
227    * Retrieve the 3d shape of the object from data label.
228    */
229   HYDRODATA_EXPORT TopoDS_Shape getShape3D() const;
230
231   /**
232    * Removes the 3d shape from data label of the object.
233    */
234   HYDRODATA_EXPORT void removeShape3D();
235 };
236
237 #endif