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