Salome HOME
Create goups for stream.
[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    * 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 bathymetry object for geometry object.
98    */
99   HYDRODATA_EXPORT virtual bool SetBathymetry( const Handle(HYDROData_Bathymetry)& theBathymetry );
100
101   /**
102    * Returns reference bathymetry object of geometry object.
103    */
104   HYDRODATA_EXPORT virtual Handle(HYDROData_Bathymetry) GetBathymetry() const;
105
106   /**
107    * Clear the reference bathymetry object for geometry object.
108    */
109   HYDRODATA_EXPORT virtual void RemoveBathymetry();
110
111    /**
112    * Sets filling color for object.
113    */
114   HYDRODATA_EXPORT virtual void SetFillingColor( const QColor& theColor );
115
116   /**
117    * Returns filling color of object.
118    */
119   HYDRODATA_EXPORT virtual QColor GetFillingColor() const;
120
121    /**
122    * Sets border color for object.
123    */
124   HYDRODATA_EXPORT virtual void SetBorderColor( const QColor& theColor );
125
126   /**
127    * Returns border color of object.
128    */
129   HYDRODATA_EXPORT virtual QColor GetBorderColor() const;
130
131   /**
132    * Returns default filling color for new object.
133    */
134   HYDRODATA_EXPORT static QColor DefaultFillingColor();
135
136   /**
137    * Returns default border color for new object.
138    */
139   HYDRODATA_EXPORT static QColor DefaultBorderColor();
140
141 protected:
142
143   /**
144    * Returns default filling color for new object.
145    */
146   HYDRODATA_EXPORT virtual QColor getDefaultFillingColor() const;
147
148   /**
149    * Returns default border color for new object.
150    */
151   HYDRODATA_EXPORT virtual QColor getDefaultBorderColor() const;
152
153 protected:
154
155   /**
156    * Creates new object in the internal data structure. Use higher level objects 
157    * to create objects with real content.
158    */
159   HYDRODATA_EXPORT HYDROData_Object();
160
161   /**
162    * Destructs properties of the object and object itself, removes it from the document.
163    */
164   virtual HYDRODATA_EXPORT ~HYDROData_Object();
165
166 protected:
167
168   /**
169    * Checks and if necessary create child 3D object.
170    * Reimplement this function in your subclass if you 
171    * do not want to create child 3D object.
172    */
173   HYDRODATA_EXPORT virtual void checkAndSetObject3D();
174
175
176   /**
177    * Create new one child group object.
178    */
179   HYDRODATA_EXPORT virtual Handle(HYDROData_ShapesGroup) createGroupObject();
180
181   /**
182    * Create all necessary child group objects.
183    * Base implementation does nothing.
184    */
185   HYDRODATA_EXPORT virtual void createGroupObjects();
186
187   /**
188    * Remove all child group objects.
189    */
190   HYDRODATA_EXPORT virtual void removeGroupObjects();
191
192
193   /**
194    * Retrieve the top shape of the object from data label.
195    */
196   HYDRODATA_EXPORT TopoDS_Shape getTopShape() const;
197
198   /**
199    * Removes the top shape from data label of the object.
200    */
201   HYDRODATA_EXPORT void removeTopShape();
202
203
204   /**
205    * Retrieve the 3d shape of the object from data label.
206    */
207   HYDRODATA_EXPORT TopoDS_Shape getShape3D() const;
208
209   /**
210    * Removes the 3d shape from data label of the object.
211    */
212   HYDRODATA_EXPORT void removeShape3D();
213 };
214
215 #endif