Salome HOME
17.12.2013. Added Partition algorithm (draft version).
[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 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_Bathymetry,   ///< reference bathymetry
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    * Update the geometry object.
42    * Call this method whenever you made changes for object data.
43    */
44   HYDRODATA_EXPORT virtual void Update();
45
46   /**
47    * Returns the list of all reference objects of this object.
48    */
49   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
50
51   /**
52    * Sets the "MustBeUpdated" flag: if object is depended on updated features.
53    * Reimplemented to update the state of child 3D object.
54    */
55   HYDRODATA_EXPORT virtual void SetToUpdate( bool theFlag );
56
57
58   /**
59    * Sets the top(2d projection) shape of the object.
60    */
61   HYDRODATA_EXPORT virtual void SetTopShape( const TopoDS_Shape& theShape );
62
63   /**
64    * Returns the top shape of the object.
65    */
66   HYDRODATA_EXPORT virtual TopoDS_Shape GetTopShape() const = 0;
67
68   /**
69    * Sets the 3d shape of the object.
70    */
71   HYDRODATA_EXPORT virtual void SetShape3D( const TopoDS_Shape& theShape );
72
73   /**
74    * Returns the 3d shape of the object.
75    */
76   HYDRODATA_EXPORT virtual TopoDS_Shape GetShape3D() const = 0;
77
78   
79   /**
80    * Returns reference object which represent the 3D shape of object.
81    */
82   HYDRODATA_EXPORT virtual Handle(HYDROData_DummyObject3D) GetObject3D() const;
83
84   /**
85    * Returns sequence of object groups.
86    */
87   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGroups() const;
88
89
90   /**
91    * Set reference bathymetry object for geometry object.
92    */
93   HYDRODATA_EXPORT virtual bool SetBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry );
94
95   /**
96    * Returns reference bathymetry object of geometry object.
97    */
98   HYDRODATA_EXPORT virtual Handle(HYDROData_Bathymetry) GetBathymetry() const;
99
100   /**
101    * Clear the reference bathymetry object for geometry object.
102    */
103   HYDRODATA_EXPORT virtual void RemoveBathymetry();
104
105    /**
106    * Sets filling color for object.
107    */
108   HYDRODATA_EXPORT virtual void SetFillingColor( const QColor& theColor );
109
110   /**
111    * Returns filling color of object.
112    */
113   HYDRODATA_EXPORT virtual QColor GetFillingColor() const;
114
115    /**
116    * Sets border color for object.
117    */
118   HYDRODATA_EXPORT virtual void SetBorderColor( const QColor& theColor );
119
120   /**
121    * Returns border color of object.
122    */
123   HYDRODATA_EXPORT virtual QColor GetBorderColor() const;
124
125   /**
126    * Returns default filling color for new object.
127    */
128   HYDRODATA_EXPORT static QColor DefaultFillingColor();
129
130   /**
131    * Returns default border color for new object.
132    */
133   HYDRODATA_EXPORT static QColor DefaultBorderColor();
134
135 protected:
136
137   /**
138    * Returns default filling color for new object.
139    */
140   HYDRODATA_EXPORT virtual QColor getDefaultFillingColor() const;
141
142   /**
143    * Returns default border color for new object.
144    */
145   HYDRODATA_EXPORT virtual QColor getDefaultBorderColor() const;
146
147 protected:
148
149   /**
150    * Creates new object in the internal data structure. Use higher level objects 
151    * to create objects with real content.
152    */
153   HYDRODATA_EXPORT HYDROData_Object();
154
155   /**
156    * Destructs properties of the object and object itself, removes it from the document.
157    */
158   virtual HYDRODATA_EXPORT ~HYDROData_Object();
159
160 protected:
161
162   /**
163    * Checks and if necessary create child 3D object.
164    * Reimplement this function in your subclass if you 
165    * do not want to create child 3D object.
166    */
167   HYDRODATA_EXPORT virtual void checkAndSetObject3D();
168
169
170   /**
171    * Create new one child group object.
172    */
173   HYDRODATA_EXPORT virtual Handle(HYDROData_ShapesGroup) createGroupObject();
174
175   /**
176    * Create all necessary child group objects.
177    * Base implementation does nothing.
178    */
179   HYDRODATA_EXPORT virtual void createGroupObjects();
180
181   /**
182    * Remove all child group objects.
183    */
184   HYDRODATA_EXPORT virtual void removeGroupObjects();
185
186
187   /**
188    * Retrieve the top shape of the object from data label.
189    */
190   HYDRODATA_EXPORT TopoDS_Shape getTopShape() const;
191
192   /**
193    * Removes the top shape from data label of the object.
194    */
195   HYDRODATA_EXPORT void removeTopShape();
196
197
198   /**
199    * Retrieve the 3d shape of the object from data label.
200    */
201   HYDRODATA_EXPORT TopoDS_Shape getShape3D() const;
202
203   /**
204    * Removes the 3d shape from data label of the object.
205    */
206   HYDRODATA_EXPORT void removeShape3D();
207 };
208
209 #endif