Salome HOME
435a98c19f50d1370778a95e81b2d564eed2503d
[modules/hydro.git] / src / HYDROData / HYDROData_CalculationCase.h
1
2
3 #ifndef HYDROData_CalculationCase_HeaderFile
4 #define HYDROData_CalculationCase_HeaderFile
5
6 #include <HYDROData_ShapesGroup.h>
7
8 // IDL includes
9 #include <SALOMEconfig.h>
10 #include CORBA_SERVER_HEADER(GEOM_Gen)
11
12 class gp_XY;
13
14 class TopoDS_Shape;
15 class TopoDS_Shell;
16 class TopTools_ListOfShape;
17
18 class Handle(HYDROData_Object);
19 class Handle(HYDROData_Region);
20 class Handle(HYDROData_Zone);
21 class Handle(HYDROData_PolylineXY);
22 class Handle(HYDROData_ShapesGroup);
23 class Handle(HYDROData_SplittedShapesGroup);
24
25 DEFINE_STANDARD_HANDLE(HYDROData_CalculationCase, HYDROData_Entity)
26
27
28 /**\class HYDROData_CalculationCase
29  * \brief Calculation case is defined by selection of Geometry objects with or without \93Zone of water\94.
30  *
31  */
32 class HYDROData_CalculationCase : public HYDROData_Entity
33 {
34 public:
35
36   enum PointClassification
37   {
38     POINT_OUT,  ///< point is out of zone face
39     POINT_IN,   ///< point is inside of zone face
40     POINT_ON    ///< point is on the edge of zone face
41   };
42
43 protected:
44
45   /**
46    * Enumeration of tags corresponding to the persistent object parameters.
47    */
48   enum DataTag
49   {
50     DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
51     DataTag_GeometryObject,   ///< reference geometry objects
52     DataTag_ChildRegion,      ///< child regions
53     DataTag_Region,           ///< reference regions
54     DataTag_Polyline,         ///< reference boundary polyline
55     DataTag_GeometryGroup,    ///< reference geometry groups
56     DataTag_SplittedGroups,   ///< reference splitted groups
57   };
58
59 public:
60
61   DEFINE_STANDARD_RTTI(HYDROData_CalculationCase);
62
63   /**
64    * Returns the kind of this object. Must be redefined in all objects of known type.
65    */
66   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_CALCULATION; }
67
68   /**
69    * Updates the name of this object.
70    * Reimplemented to update the names of regions, zones and splitted groups.
71    */
72   HYDRODATA_EXPORT virtual void SetName( const QString& theName );
73
74   /**
75    * Dump Calculation object to Python script representation.
76    */
77   HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
78
79   /**
80    * Update the calcualtion case object.
81    * Call this method whenever you made changes for object data.
82    */
83   HYDRODATA_EXPORT virtual void Update();
84
85   /**
86    * Returns the list of all reference objects of this object.
87    */
88   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
89
90 public:      
91   // Public methods to work with Calculation
92
93   /**
94    * Add new one reference geometry object for calculation case.
95    */
96   HYDRODATA_EXPORT virtual bool AddGeometryObject( const Handle(HYDROData_Object)& theObject );
97
98   /**
99    * Returns all reference geometry objects of calculation case.
100    */
101   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGeometryObjects() const;
102
103   /**
104    * Removes reference geometry object from calculation case.
105    */
106   HYDRODATA_EXPORT virtual void RemoveGeometryObject( const Handle(HYDROData_Object)& theObject );
107
108   /**
109    * Removes all reference geometry objects from calculation case.
110    */
111   HYDRODATA_EXPORT virtual void RemoveGeometryObjects();
112
113
114   /**
115    * Add new one reference geometry group for calculation case.
116    */
117   HYDRODATA_EXPORT virtual bool AddGeometryGroup( const Handle(HYDROData_ShapesGroup)& theGroup );
118
119   /**
120    * Returns all reference geometry groups of calculation case.
121    */
122   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGeometryGroups() const;
123
124   /**
125    * Removes reference geometry group from calculation case.
126    */
127   HYDRODATA_EXPORT virtual void RemoveGeometryGroup( const Handle(HYDROData_ShapesGroup)& theGroup );
128
129   /**
130    * Removes all reference geometry groups from calculation case.
131    */
132   HYDRODATA_EXPORT virtual void RemoveGeometryGroups();
133
134
135   /**
136    * Sets reference boundary polyline object for calculation case.
137    */
138   HYDRODATA_EXPORT virtual void SetBoundaryPolyline( const Handle(HYDROData_PolylineXY)& thePolyline );
139
140   /**
141    * Returns reference boundary polyline object of calculation case.
142    */
143   HYDRODATA_EXPORT virtual Handle(HYDROData_PolylineXY) GetBoundaryPolyline() const;
144
145   /**
146    * Remove reference boundary polyline object from calculation case.
147    */
148   HYDRODATA_EXPORT virtual void RemoveBoundaryPolyline();
149
150
151   /**
152    * Add new one child region for calculation case.
153    * The new region is added into the list of reference regions.
154    * The label of theZone is changed during this operation
155    * because of new region becomes the new parent for this zone.
156    */
157   HYDRODATA_EXPORT virtual Handle(HYDROData_Region) AddNewRegion( const Handle(HYDROData_Zone)& theZone );
158
159
160   /**
161    * Add new one reference region for calculation case.
162    * The label of theRegion is changed in case if old parent is not this calculation.
163    */
164   HYDRODATA_EXPORT virtual bool AddRegion( const Handle(HYDROData_Region)& theRegion );
165
166   /**
167    * Returns all reference regions of calculation case.
168    */
169   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetRegions() const;
170
171   /**
172    * Updates names of regions to correct order.
173    */
174   HYDRODATA_EXPORT virtual void UpdateRegionsOrder();
175
176   /**
177    * Removes reference region from calculation case.
178    */
179   HYDRODATA_EXPORT virtual void RemoveRegion( const Handle(HYDROData_Region)& theRegion );
180
181   /**
182    * Removes all reference regions from calculation case.
183    */
184   HYDRODATA_EXPORT virtual void RemoveRegions();
185
186   
187   /**
188    * Returns all reference geometry groups of calculation case.
189    */
190   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetSplittedGroups() const;
191
192   /**
193    * Removes all reference geometry groups from calculation case.
194    */
195   HYDRODATA_EXPORT virtual void RemoveSplittedGroups();
196
197
198   /**
199    * Exports the calculation case data (shell and groups) to GEOM module.
200    * \param theGeomEngine GEOM module engine
201    * \param theStudy SALOMEDS study, is used for publishing of GEOM objects
202    * \return true in case of success
203    */
204   HYDRODATA_EXPORT virtual bool Export( GEOM::GEOM_Gen_var  theGeomEngine,
205                                         SALOMEDS::Study_ptr theStudy ) const;
206
207 public:      
208   // Public methods to work with Calculation services
209
210   /**
211    * Returns altitude for given point.
212    * \param thePoint the point to examine
213    * \return result altitude value
214    */
215   HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint ) const;
216
217   /**
218    * Returns altitude for given point on given zone.
219    * \param thePoint the point to examine
220    * \param theZone reference zone to check
221    * \return result altitude value
222    */
223   HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY&                  thePoint,
224                                                        const Handle(HYDROData_Zone)& theZone ) const;
225
226   /**
227    * Returns altitudes for given points on given zone.
228    * \param thePoints the points to examine
229    * \param theZone reference zone to check
230    * \return result altitude value
231    */
232   HYDRODATA_EXPORT virtual NCollection_Sequence<double> GetAltitudesForPoints( 
233     const NCollection_Sequence<gp_XY>& thePoints,
234     const Handle(HYDROData_Zone)&      theZone ) const;
235
236   /**
237    * Returns zone to which the point is belongs.
238    * \param thePoint the point to examine
239    * \return result zone
240    */
241   HYDRODATA_EXPORT virtual Handle(HYDROData_Zone) GetZoneFromPoint( const gp_XY& thePoint ) const;
242
243   /**
244    * Returns classification of point for given zone.
245    * \param thePoint the point to examine
246    * \param theZone the zone to examine
247    * \return result classification
248    */
249   HYDRODATA_EXPORT virtual PointClassification GetPointClassification(
250     const gp_XY&                  thePoint,
251     const Handle(HYDROData_Zone)& theZone ) const;
252
253 private:
254
255   /**
256    * Add new one region for calculation case.
257    * The new region is added into the list of reference regions.
258    */
259   HYDRODATA_EXPORT virtual Handle(HYDROData_Region) addNewRegion();
260
261   /**
262    * Add new one splitted edges group for calculation case.
263    */
264   HYDRODATA_EXPORT virtual Handle(HYDROData_SplittedShapesGroup) addNewSplittedGroup();
265
266   /**
267    * Exports the given faces as shell and the given groups to GEOM module.
268    * \param theGeomEngine GEOM module engine
269    * \param theStudy SALOMEDS study, is used for publishing of GEOM objects
270    * \param theFaces the list of faces to make shell 
271    * \param theSplittedGroups the list of groups
272    * \return true in case of success
273    */
274   HYDRODATA_EXPORT bool Export( GEOM::GEOM_Gen_var                            theGeomEngine,
275                                 SALOMEDS::Study_ptr                           theStudy,
276                                 const TopTools_ListOfShape&                   theFaces,
277                                 const HYDROData_ShapesGroup::SeqOfGroupsDefs& theGroupsDefs ) const;
278
279   /**
280    * Publish the given shape in GEOM as a GEOM object.
281    * \param theGeomEngine GEOM module engine
282    * \param theStudy SALOMEDS study, used for publishing of the shape
283    * \param theShape the shape to publish as a GEOM object
284    * \param theName the name of the published object
285    * \return the published GEOM object
286    */
287   GEOM::GEOM_Object_ptr publishShapeInGEOM( GEOM::GEOM_Gen_var  theGeomEngine,
288                                             SALOMEDS::Study_ptr theStudy,
289                                             const TopoDS_Shape& theShape, 
290                                             const QString&      theName ) const;
291
292 protected:
293
294   friend class HYDROData_Iterator;
295
296   /**
297    * Creates new object in the internal data structure. Use higher level objects 
298    * to create objects with real content.
299    */
300   HYDRODATA_EXPORT HYDROData_CalculationCase();
301
302   /**
303    * Destructs properties of the object and object itself, removes it from the document.
304    */
305   HYDRODATA_EXPORT ~HYDROData_CalculationCase();
306 };
307
308 #endif