Salome HOME
de3a65653893afa14c50053f456a9c541948998d
[modules/hydro.git] / src / HYDROData / HYDROData_CalculationCase.h
1
2
3 #ifndef HYDROData_CalculationCase_HeaderFile
4 #define HYDROData_CalculationCase_HeaderFile
5
6 #include <HYDROData_Entity.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 and zones.
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 );
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 zone to which the point is belongs.
219    * \param thePoint the point to examine
220    * \return result zone
221    */
222   HYDRODATA_EXPORT virtual Handle(HYDROData_Zone) GetZoneFromPoint( const gp_XY& thePoint ) const;
223
224   /**
225    * Returns classification of point for given zone.
226    * \param thePoint the point to examine
227    * \param theZone the zone to examine
228    * \return result classification
229    */
230   HYDRODATA_EXPORT virtual PointClassification GetPointClassification(
231     const gp_XY&                  thePoint,
232     const Handle(HYDROData_Zone)& theZone ) const;
233
234 private:
235
236   /**
237    * Add new one region for calculation case.
238    * The new region is added into the list of reference regions.
239    */
240   HYDRODATA_EXPORT virtual Handle(HYDROData_Region) addNewRegion();
241
242   /**
243    * Add new one splitted edges group for calculation case.
244    */
245   HYDRODATA_EXPORT virtual Handle(HYDROData_SplittedShapesGroup) addNewSplittedGroup();
246
247   /**
248    * Exports the given faces as shell and the given groups to GEOM module.
249    * \param theGeomEngine GEOM module engine
250    * \param theStudy SALOMEDS study, is used for publishing of GEOM objects
251    * \param theFaces the list of faces to make shell 
252    * \param theSplittedGroups the list of groups
253    * \return true in case of success
254    */
255   HYDRODATA_EXPORT bool Export( GEOM::GEOM_Gen_var theGeomEngine,
256                                 SALOMEDS::Study_ptr theStudy,
257                                 const TopTools_ListOfShape& theFaces,
258                                 const HYDROData_SequenceOfObjects& theSplittedGroups );
259
260   /**
261    * Publish the given shape in GEOM as a GEOM object.
262    * \param theGeomEngine GEOM module engine
263    * \param theStudy SALOMEDS study, used for publishing of the shape
264    * \param theShape the shape to publish as a GEOM object
265    * \param theName the name of the published object
266    * \return the published GEOM object
267    */
268   GEOM::GEOM_Object_ptr publishShapeInGEOM( GEOM::GEOM_Gen_var theGeomEngine,
269                                             SALOMEDS::Study_ptr theStudy,
270                                             const TopoDS_Shape& theShape, 
271                                             const QString& theName );
272
273 protected:
274
275   friend class HYDROData_Iterator;
276
277   /**
278    * Creates new object in the internal data structure. Use higher level objects 
279    * to create objects with real content.
280    */
281   HYDRODATA_EXPORT HYDROData_CalculationCase();
282
283   /**
284    * Destructs properties of the object and object itself, removes it from the document.
285    */
286   HYDRODATA_EXPORT ~HYDROData_CalculationCase();
287 };
288
289 #endif