Salome HOME
SIP: HYDROData_SplittedShapesGroup is included.
[modules/hydro.git] / src / HYDROPy / HYDROData_CalculationCase.sip
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 %ExportedHeaderCode
24 #include <HYDROData_CalculationCase.h>
25 %End
26
27 class HYDROData_CalculationCase : HYDROData_Entity
28 {
29
30 %TypeHeaderCode
31 #include <HYDROData_CalculationCase.h>
32 %End
33
34 %ConvertToSubClassCode
35     switch ( sipCpp->GetKind() )
36     {
37       case KIND_CALCULATION:
38         sipClass = sipClass_HYDROData_CalculationCase;
39         break;
40
41       default:
42         // We don't recognise the type.
43         sipClass = NULL;
44     }
45 %End
46
47 public:
48
49   enum PointClassification
50   {
51     POINT_OUT,  ///< point is out of zone face
52     POINT_IN,   ///< point is inside of zone face
53     POINT_ON    ///< point is on the edge of zone face
54   };
55
56 public:      
57   /**
58    * Add new one reference geometry object for calculation case.
59    */
60   bool AddGeometryObject( HYDROData_Object theObject ) [bool ( const Handle_HYDROData_Object& )];
61   %MethodCode
62     Handle(HYDROData_Object) aRef =
63       Handle(HYDROData_Object)::DownCast( createHandle( a0 ) );
64     if ( !aRef.IsNull() )
65     {
66       Py_BEGIN_ALLOW_THREADS
67       sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddGeometryObject( aRef ):
68                                sipCpp->AddGeometryObject( aRef );
69       Py_END_ALLOW_THREADS
70     }
71   %End
72
73   /**
74    * Returns all reference geometry objects of calculation case.
75    */
76   HYDROData_SequenceOfObjects GetGeometryObjects() const;
77
78   /**
79    * Removes reference geometry object from calculation case.
80    */
81   void RemoveGeometryObject( HYDROData_Object theObject ) [void ( const Handle_HYDROData_Object& )];
82   %MethodCode
83     Handle(HYDROData_Object) aRef =
84       Handle(HYDROData_Object)::DownCast( createHandle( a0 ) );
85     if ( !aRef.IsNull() )
86     {
87       Py_BEGIN_ALLOW_THREADS
88       if ( sipSelfWasArg ) {
89         sipCpp->HYDROData_CalculationCase::RemoveGeometryObject( aRef );
90       } else {
91         sipCpp->RemoveGeometryObject( aRef );
92       }
93       Py_END_ALLOW_THREADS
94     }
95   %End
96
97   /**
98    * Removes all reference geometry objects from calculation case.
99    */
100   void RemoveGeometryObjects();
101
102
103   /**
104    * Add new one reference geometry group for calculation case.
105    */
106   bool AddGeometryGroup( HYDROData_ShapesGroup theGroup ) [bool ( const Handle_HYDROData_ShapesGroup& )];
107   %MethodCode
108     Handle(HYDROData_ShapesGroup) aRef =
109       Handle(HYDROData_ShapesGroup)::DownCast( createHandle( a0 ) );
110     if ( !aRef.IsNull() )
111     {
112       Py_BEGIN_ALLOW_THREADS
113       sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddGeometryGroup( aRef ):
114                                sipCpp->AddGeometryGroup( aRef );
115       Py_END_ALLOW_THREADS
116     }
117   %End
118
119   /**
120    * Returns all reference geometry groups of calculation case.
121    */
122   HYDROData_SequenceOfObjects GetGeometryGroups() const;
123
124   /**
125    * Removes reference geometry group from calculation case.
126    */
127   void RemoveGeometryGroup( HYDROData_ShapesGroup theGroup ) [void ( const Handle_HYDROData_ShapesGroup& )];
128   %MethodCode
129     Handle(HYDROData_ShapesGroup) aRef =
130       Handle(HYDROData_ShapesGroup)::DownCast( createHandle( a0 ) );
131     if ( !aRef.IsNull() )
132     {
133       Py_BEGIN_ALLOW_THREADS
134       if ( sipSelfWasArg ) {
135         sipCpp->HYDROData_CalculationCase::RemoveGeometryGroup( aRef );
136       } else {
137         sipCpp->RemoveGeometryGroup( aRef );
138       }
139       Py_END_ALLOW_THREADS
140     }
141   %End
142
143   /**
144    * Removes all reference geometry groups from calculation case.
145    */
146   void RemoveGeometryGroups();
147
148
149   /**
150    * Sets reference boundary polyline object for calculation case.
151    */
152   void SetBoundaryPolyline( HYDROData_PolylineXY thePolyline ) [void ( const Handle_HYDROData_PolylineXY& )];
153   %MethodCode
154     Handle(HYDROData_PolylineXY) aRef =
155       Handle(HYDROData_PolylineXY)::DownCast( createHandle( a0 ) );
156     if ( !aRef.IsNull() )
157     {
158       Py_BEGIN_ALLOW_THREADS
159       if ( sipSelfWasArg ) {
160         sipCpp->HYDROData_CalculationCase::SetBoundaryPolyline( aRef );
161       } else {
162         sipCpp->SetBoundaryPolyline( aRef );
163       }
164       Py_END_ALLOW_THREADS
165     }
166   %End
167
168   /**
169    * Returns reference boundary polyline object of calculation case.
170    */
171   HYDROData_PolylineXY GetBoundaryPolyline() const [Handle_HYDROData_PolylineXY ()];
172   %MethodCode
173     Handle(HYDROData_PolylineXY) aRef;
174     
175     Py_BEGIN_ALLOW_THREADS
176     aRef = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetBoundaryPolyline() : 
177                            sipCpp->GetBoundaryPolyline();
178     Py_END_ALLOW_THREADS
179     
180     sipRes = (HYDROData_PolylineXY*)createPointer( aRef );
181   %End
182
183   /**
184    * Remove reference boundary polyline object from calculation case.
185    */
186   void RemoveBoundaryPolyline();
187
188
189   /**
190    * Add new one child region for calculation case.
191    * The new region is added into the list of reference regions.
192    * The label of theZone is changed during this operation
193    * because of new region becomes the new parent for this zone.
194    */
195   HYDROData_Region AddNewRegion( HYDROData_Zone theZone ) [Handle_HYDROData_Region ( const Handle_HYDROData_Zone& )];
196   %MethodCode
197     Handle(HYDROData_Zone) aRef =
198       Handle(HYDROData_Zone)::DownCast( createHandle( a0 ) );
199     Handle(HYDROData_Region) aRes;
200     
201     if ( !aRef.IsNull() )
202     {
203       Py_BEGIN_ALLOW_THREADS
204       aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddNewRegion( aRef ) : 
205                              sipCpp->AddNewRegion( aRef );
206       Py_END_ALLOW_THREADS
207     }
208     
209     sipRes = (HYDROData_Region*)createPointer( aRes );
210   %End
211
212   /**
213    * Add new one reference region for calculation case.
214    * The label of theRegion is changed in case if old parent is not this calculation.
215    */
216   bool AddRegion( HYDROData_Region theRegion ) [bool ( const Handle_HYDROData_Region& )];
217   %MethodCode
218     Handle(HYDROData_Region) aRef =
219       Handle(HYDROData_Region)::DownCast( createHandle( a0 ) );
220     if ( !aRef.IsNull() )
221     {
222       Py_BEGIN_ALLOW_THREADS
223       sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRegion( aRef ):
224                                sipCpp->AddRegion( aRef );
225       Py_END_ALLOW_THREADS
226     }
227   %End
228
229   /**
230    * Returns all reference regions of calculation case.
231    */
232   HYDROData_SequenceOfObjects GetRegions() const;
233
234   /**
235    * Updates names of regions to correct order.
236    */
237   void UpdateRegionsOrder();
238
239   /**
240    * Removes reference region from calculation case.
241    */
242   void RemoveRegion( HYDROData_Region theRegion ) [void ( const Handle_HYDROData_Region& )];
243   %MethodCode
244     Handle(HYDROData_Region) aRef =
245       Handle(HYDROData_Region)::DownCast( createHandle( a0 ) );
246     if ( !aRef.IsNull() )
247     {
248       Py_BEGIN_ALLOW_THREADS
249       if ( sipSelfWasArg ) {
250         sipCpp->HYDROData_CalculationCase::RemoveRegion( aRef );
251       } else {
252         sipCpp->RemoveRegion( aRef );
253       }
254       Py_END_ALLOW_THREADS
255     }
256   %End
257
258   /**
259    * Removes all reference regions from calculation case.
260    */
261   void RemoveRegions();
262
263   
264   /**
265    * Returns all reference geometry groups of calculation case.
266    */
267   HYDROData_SequenceOfObjects GetSplittedGroups() const;
268
269   /**
270    * Removes all reference geometry groups from calculation case.
271    */
272   void RemoveSplittedGroups();
273
274
275   /**
276    * Exports the calculation case data (shell and groups) to GEOM module.
277    * \param theGeomEngine GEOM module engine
278    * \param theStudy SALOMEDS study, is used for publishing of GEOM objects
279    * \return true in case of success
280    */
281 //TODO:  virtual bool Export( GEOM::GEOM_Gen_var theGeomEngine,
282 //                       SALOMEDS::Study_ptr theStudy );
283
284 public:      
285   // Public methods to work with Calculation services
286
287   /**
288    * Returns altitude for given point.
289    * \param thePoint the point to examine
290    * \return result altitude value
291    */
292   double GetAltitudeForPoint( const gp_XY& thePoint ) const;
293
294   /**
295    * Returns zone to which the point is belongs.
296    * \param thePoint the point to examine
297    * \return result zone
298    */
299   HYDROData_Zone GetZoneFromPoint( const gp_XY& thePoint ) const [Handle_HYDROData_Zone ( const gp_XY& )];
300   %MethodCode
301     Handle(HYDROData_Zone) aRes;
302     
303     Py_BEGIN_ALLOW_THREADS
304     aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetZoneFromPoint( *a0 ) : 
305                            sipCpp->GetZoneFromPoint( *a0 );
306     Py_END_ALLOW_THREADS
307     
308     sipRes = (HYDROData_Zone*)createPointer( aRes );
309   %End
310
311   /**
312    * Returns classification of point for given zone.
313    * \param thePoint the point to examine
314    * \param theZone the zone to examine
315    * \return result classification
316    */
317   PointClassification GetPointClassification(
318     const gp_XY&   thePoint,
319     HYDROData_Zone theZone ) const 
320     [PointClassification ( const gp_XY&, const Handle_HYDROData_Zone& )];
321     
322   %MethodCode
323     Handle(HYDROData_Zone) aRef =
324       Handle(HYDROData_Zone)::DownCast( createHandle( a1 ) );
325    
326     if ( !aRef.IsNull() )
327     {
328       Py_BEGIN_ALLOW_THREADS
329       sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetPointClassification( *a0, aRef ) : 
330                                sipCpp->GetPointClassification( *a0, aRef );
331       Py_END_ALLOW_THREADS
332     }
333   %End
334
335 protected:
336
337   /**
338    * Creates new object in the internal data structure. Use higher level objects 
339    * to create objects with real content.
340    */
341   HYDROData_CalculationCase();
342
343   /**
344    * Destructs properties of the object and object itself, removes it from the document.
345    */
346   ~HYDROData_CalculationCase();
347 };
348
349