]> SALOME platform Git repositories - modules/hydro.git/blob - src/HYDROData/HYDROData_Object.h
Salome HOME
Colors methods changes.
[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 protected:
134
135   /**
136    * Returns default filling color for new object.
137    */
138   HYDRODATA_EXPORT virtual QColor getDefaultFillingColor() const;
139
140   /**
141    * Returns default border color for new object.
142    */
143   HYDRODATA_EXPORT virtual QColor getDefaultBorderColor() const;
144
145 protected:
146
147   /**
148    * Creates new object in the internal data structure. Use higher level objects 
149    * to create objects with real content.
150    */
151   HYDRODATA_EXPORT HYDROData_Object();
152
153   /**
154    * Destructs properties of the object and object itself, removes it from the document.
155    */
156   virtual HYDRODATA_EXPORT ~HYDROData_Object();
157
158 protected:
159
160   /**
161    * Checks and if necessary create child 3D object.
162    * Reimplement this function in your subclass if you 
163    * do not want to create child 3D object.
164    */
165   HYDRODATA_EXPORT virtual void checkAndSetObject3D();
166
167
168   /**
169    * Returns the type of child altitude object.
170    * Base implementation returns KIND_UNKNOWN, it means that child altitude 
171    * object will not be created inside of checkAndSetAltitudeObject() function.
172    * Reimplement this function in your subclass an return correct altitude
173    * object type if you want to create child altitude object.
174    */
175   HYDRODATA_EXPORT virtual ObjectKind getAltitudeObjectType() const;
176
177   /**
178    * Checks and if necessary create child altitude object.
179    */
180   HYDRODATA_EXPORT virtual void checkAndSetAltitudeObject();
181
182   /**
183    * Return the child altitude object.
184    */
185   HYDRODATA_EXPORT virtual Handle(HYDROData_IAltitudeObject) getChildAltitudeObject() const;
186
187
188   /**
189    * Create new one child group object.
190    */
191   HYDRODATA_EXPORT virtual Handle(HYDROData_ShapesGroup) createGroupObject();
192
193   /**
194    * Remove all child group objects.
195    */
196   HYDRODATA_EXPORT virtual void removeGroupObjects();
197
198
199   /**
200    * Retrieve the top shape of the object from data label.
201    */
202   HYDRODATA_EXPORT TopoDS_Shape getTopShape() const;
203
204   /**
205    * Removes the top shape from data label of the object.
206    */
207   HYDRODATA_EXPORT void removeTopShape();
208
209
210   /**
211    * Retrieve the 3d shape of the object from data label.
212    */
213   HYDRODATA_EXPORT TopoDS_Shape getShape3D() const;
214
215   /**
216    * Removes the 3d shape from data label of the object.
217    */
218   HYDRODATA_EXPORT void removeShape3D();
219 };
220
221 #endif