Salome HOME
Fix for bug #393: It's impossible to work in Change layer order dialog with keyboard...
[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 : public 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 double theCoordX,
293                               const double theCoordY ) const [double ( const gp_XY& )];
294   %MethodCode
295     gp_XY aPnt( a0, a1 );
296   
297     Py_BEGIN_ALLOW_THREADS
298     sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt ) : 
299                              sipCpp->GetAltitudeForPoint( aPnt );
300     Py_END_ALLOW_THREADS
301   %End
302
303   /**
304    * Returns altitude for given point on given region.
305    * \param thePoint the point to examine
306    * \param theRegion reference region to check
307    * \return result altitude value
308    */
309   double GetAltitudeForPoint( const double     theCoordX,
310                               const double     theCoordY,
311                               HYDROData_Region theRegion ) const
312   [double ( const gp_XY&, const Handle_HYDROData_Region& )];
313   %MethodCode
314     gp_XY aPnt( a0, a1 );
315     Handle(HYDROData_Region) aRefRegion =
316       Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
317
318     Py_BEGIN_ALLOW_THREADS
319     sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefRegion ) : 
320                              sipCpp->GetAltitudeForPoint( aPnt, aRefRegion );
321     Py_END_ALLOW_THREADS
322   %End
323
324   /**
325    * Returns altitude for given point on given zone.
326    * \param thePoint the point to examine
327    * \param theZone reference zone to check
328    * \return result altitude value
329    */
330   double GetAltitudeForPoint( const double theCoordX,
331                               const double theCoordY,
332                               HYDROData_Zone theZone ) const
333   [double ( const gp_XY&, const Handle_HYDROData_Zone& )];
334   %MethodCode
335     gp_XY aPnt( a0, a1 );
336     Handle(HYDROData_Zone) aRefZone =
337       Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
338
339     Py_BEGIN_ALLOW_THREADS
340     sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefZone ) : 
341                              sipCpp->GetAltitudeForPoint( aPnt, aRefZone );
342     Py_END_ALLOW_THREADS
343   %End
344
345   /**
346    * Returns altitudes for given points on given region.
347    * \param thePoints the points to examine
348    * \param theZone reference region to check
349    * \return result altitude value
350    */
351   NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
352                                                       const NCollection_Sequence<double>& theCoordsY,
353                                                       HYDROData_Region                    theRegion ) const
354   [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, const Handle_HYDROData_Region& )];
355   %MethodCode
356
357     NCollection_Sequence<gp_XY> aPnts;
358
359     int aLen = qMin( a0->Length(), a1->Length() );
360     for ( int i = 1; i <= aLen; ++i )
361     {
362       gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
363       aPnts.Append( aPnt );
364     }
365
366     Handle(HYDROData_Region) aRefRegion =
367       Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
368
369     NCollection_Sequence<double> aRes;
370     Py_BEGIN_ALLOW_THREADS
371     aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefRegion ) : 
372                            sipCpp->GetAltitudesForPoints( aPnts, aRefRegion );
373     Py_END_ALLOW_THREADS
374     
375     sipRes = new NCollection_Sequence<double>( aRes );
376   %End
377
378   /**
379    * Returns altitudes for given points on given zone.
380    * \param thePoints the points to examine
381    * \param theZone reference zone to check
382    * \return result altitude value
383    */
384   NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
385                                                       const NCollection_Sequence<double>& theCoordsY,
386                                                       HYDROData_Zone                      theZone ) const
387   [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, const Handle_HYDROData_Zone& )];
388   %MethodCode
389
390     NCollection_Sequence<gp_XY> aPnts;
391
392     int aLen = qMin( a0->Length(), a1->Length() );
393     for ( int i = 1; i <= aLen; ++i )
394     {
395       gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
396       aPnts.Append( aPnt );
397     }
398
399     Handle(HYDROData_Zone) aRefZone =
400       Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
401
402     NCollection_Sequence<double> aRes;
403     Py_BEGIN_ALLOW_THREADS
404     aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefZone ) : 
405                            sipCpp->GetAltitudesForPoints( aPnts, aRefZone );
406     Py_END_ALLOW_THREADS
407     
408     sipRes = new NCollection_Sequence<double>( aRes );
409   %End
410   
411   /**
412    * Returns region to which the point is belongs.
413    * \param thePoint the point to examine
414    * \return result region
415    */
416   HYDROData_Region GetRegionFromPoint( const double theCoordX,
417                                        const double theCoordY ) const
418   [Handle_HYDROData_Region ( const gp_XY& )];
419   %MethodCode
420     Handle(HYDROData_Region) aRes;
421     
422     gp_XY aPnt( a0, a1 );
423   
424     Py_BEGIN_ALLOW_THREADS
425     aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetRegionFromPoint( aPnt ) : 
426                            sipCpp->GetRegionFromPoint( aPnt );
427     Py_END_ALLOW_THREADS
428     
429     sipRes = (HYDROData_Region*)createPointer( aRes );
430   %End
431
432   /**
433    * Returns zone to which the point is belongs.
434    * \param thePoint the point to examine
435    * \return result zone
436    */
437   HYDROData_Zone GetZoneFromPoint( const double theCoordX,
438                                    const double theCoordY ) const
439   [Handle_HYDROData_Zone ( const gp_XY& )];
440   %MethodCode
441     Handle(HYDROData_Zone) aRes;
442     
443     gp_XY aPnt( a0, a1 );
444   
445     Py_BEGIN_ALLOW_THREADS
446     aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetZoneFromPoint( aPnt ) : 
447                            sipCpp->GetZoneFromPoint( aPnt );
448     Py_END_ALLOW_THREADS
449     
450     sipRes = (HYDROData_Zone*)createPointer( aRes );
451   %End
452
453   /**
454    * Returns classification of point for given zone.
455    * \param thePoint the point to examine
456    * \param theZone the zone to examine
457    * \return result classification
458    */
459   PointClassification GetPointClassification( const double theCoordX,
460                                               const double theCoordY,
461                                               HYDROData_Zone theZone ) const 
462   [PointClassification ( const gp_XY&, const Handle_HYDROData_Zone& )];    
463   %MethodCode
464     gp_XY aPnt( a0, a1 );
465
466     Handle(HYDROData_Zone) aRef =
467       Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
468
469     Py_BEGIN_ALLOW_THREADS
470     sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetPointClassification( aPnt, aRef ) : 
471                              sipCpp->GetPointClassification( aPnt, aRef );
472     Py_END_ALLOW_THREADS
473   %End
474
475 protected:
476
477   /**
478    * Creates new object in the internal data structure. Use higher level objects 
479    * to create objects with real content.
480    */
481   HYDROData_CalculationCase();
482
483   /**
484    * Destructs properties of the object and object itself, removes it from the document.
485    */
486   ~HYDROData_CalculationCase();
487 };
488
489