Salome HOME
Porting on OCCT 7.0 and Qt 5. Make compilable version.
[modules/hydro.git] / src / HYDROPy / HYDROData_CalculationCase.sip
1 // Copyright (C) 2014-2015  EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
6 //
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10 // Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 %ExportedHeaderCode
20 #include <HYDROData_CalculationCase.h>
21 #include <HYDROData_PriorityQueue.h>
22 %End
23
24 enum HYDROData_PriorityType
25 {
26   LESS,
27   GREATER,
28 };
29
30 class HYDROData_CalculationCase : public HYDROData_Entity
31 {
32
33 %TypeHeaderCode
34 #include <HYDROData_CalculationCase.h>
35 %End
36
37 %ConvertToSubClassCode
38     switch ( sipCpp->GetKind() )
39     {
40       case KIND_CALCULATION:
41         sipClass = sipClass_HYDROData_CalculationCase;
42         break;
43
44       default:
45         // We don't recognise the type.
46         sipClass = NULL;
47     }
48 %End
49
50 public:
51
52   enum PointClassification
53   {
54     POINT_OUT,  ///< point is out of zone face
55     POINT_IN,   ///< point is inside of zone face
56     POINT_ON    ///< point is on the edge of zone face
57   };
58
59   enum AssignmentMode
60   {
61     MANUAL = 0,
62     AUTOMATIC,
63   };
64
65 public:
66
67   enum DataTag
68   {
69     DataTag_First = 100,               ///< first tag, to reserve
70     DataTag_GeometryObject,            ///< reference geometry objects
71     DataTag_ChildRegion,               ///< child regions
72     DataTag_Region,                    ///< reference regions
73     DataTag_Polyline,                  ///< reference boundary polyline
74     DataTag_GeometryGroup,             ///< reference geometry groups
75     DataTag_SplitGroups,               ///< reference split groups
76     DataTag_CustomRules,               ///< custom rules
77     DataTag_AssignmentMode,            ///< assignment mode
78     DataTag_StricklerTable,            ///< reference Strickler table
79     DataTag_LandCover_Obsolete,                 ///< reference land covers
80     DataTag_CustomLandCoverRules_Obsolete,      ///< custom rules for land covers priority
81     DataTag_AssignmentLandCoverMode_Obsolete,   ///< assignment mode of land covers priority
82     DataTag_ChildLandCoverRegion_Obsolete,      ///< child land cover regions
83     DataTag_LandCoverRegion_Obsolete            ///< reference land cover regions
84   };
85
86 public:      
87   /**
88    * Add new one reference geometry object for calculation case.
89    */
90   bool AddGeometryObject( HYDROData_Object theObject ) [bool ( const opencascade::handle<HYDROData_Object>& )];
91   %MethodCode
92     Handle(HYDROData_Object) aRef =
93       Handle(HYDROData_Object)::DownCast( createHandle( a0 ) );
94     if ( !aRef.IsNull() )
95     {
96       Py_BEGIN_ALLOW_THREADS
97       sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddGeometryObject( aRef ):
98                                sipCpp->AddGeometryObject( aRef );
99       Py_END_ALLOW_THREADS
100     }
101   %End
102
103   /**
104    * Returns all reference geometry objects of calculation case.
105    */
106   HYDROData_SequenceOfObjects GetGeometryObjects() const;
107
108   /**
109    * Removes reference geometry object from calculation case.
110    */
111   void RemoveGeometryObject( HYDROData_Object theObject )
112   [void ( const opencascade::handle<HYDROData_Object>& )];
113   %MethodCode
114     Handle(HYDROData_Object) aRef =
115       Handle(HYDROData_Object)::DownCast( createHandle( a0 ) );
116     if ( !aRef.IsNull() )
117     {
118       Py_BEGIN_ALLOW_THREADS
119       if ( sipSelfWasArg ) {
120         sipCpp->HYDROData_CalculationCase::RemoveGeometryObject( aRef );
121       } else {
122         sipCpp->RemoveGeometryObject( aRef );
123       }
124       Py_END_ALLOW_THREADS
125     }
126   %End
127
128   /**
129    * Removes all reference geometry objects from calculation case.
130    */
131   void RemoveGeometryObjects();
132
133
134   /**
135    * Add new one reference geometry group for calculation case.
136    */
137   bool AddGeometryGroup( HYDROData_ShapesGroup theGroup ) [bool ( const opencascade::handle<HYDROData_ShapesGroup>& )];
138   %MethodCode
139     Handle(HYDROData_ShapesGroup) aRef =
140       Handle(HYDROData_ShapesGroup)::DownCast( createHandle( a0 ) );
141     if ( !aRef.IsNull() )
142     {
143       Py_BEGIN_ALLOW_THREADS
144       sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddGeometryGroup( aRef ):
145                                sipCpp->AddGeometryGroup( aRef );
146       Py_END_ALLOW_THREADS
147     }
148   %End
149
150   /**
151    * Returns all reference geometry groups of calculation case.
152    */
153   HYDROData_SequenceOfObjects GetGeometryGroups() const;
154
155   /**
156    * Removes reference geometry group from calculation case.
157    */
158   void RemoveGeometryGroup( HYDROData_ShapesGroup theGroup ) [void ( opencascade::handle<HYDROData_ShapesGroup>& )];
159   %MethodCode
160     Handle(HYDROData_ShapesGroup) aRef =
161       Handle(HYDROData_ShapesGroup)::DownCast( createHandle( a0 ) );
162     if ( !aRef.IsNull() )
163     {
164       Py_BEGIN_ALLOW_THREADS
165       if ( sipSelfWasArg ) {
166         sipCpp->HYDROData_CalculationCase::RemoveGeometryGroup( aRef );
167       } else {
168         sipCpp->RemoveGeometryGroup( aRef );
169       }
170       Py_END_ALLOW_THREADS
171     }
172   %End
173
174   /**
175    * Removes all reference geometry groups from calculation case.
176    */
177   void RemoveGeometryGroups();
178
179
180   /**
181    * Sets reference boundary polyline object for calculation case.
182    */
183   void SetBoundaryPolyline( HYDROData_PolylineXY thePolyline ) [void ( opencascade::handle<HYDROData_PolylineXY>& )];
184   %MethodCode
185     Handle(HYDROData_PolylineXY) aRef =
186       Handle(HYDROData_PolylineXY)::DownCast( createHandle( a0 ) );
187     if ( !aRef.IsNull() )
188     {
189       Py_BEGIN_ALLOW_THREADS
190       if ( sipSelfWasArg ) {
191         sipCpp->HYDROData_CalculationCase::SetBoundaryPolyline( aRef );
192       } else {
193         sipCpp->SetBoundaryPolyline( aRef );
194       }
195       Py_END_ALLOW_THREADS
196     }
197   %End
198
199   /**
200    * Returns reference boundary polyline object of calculation case.
201    */
202   HYDROData_PolylineXY GetBoundaryPolyline() const [opencascade::handle<HYDROData_PolylineXY> ()];
203   %MethodCode
204     Handle(HYDROData_PolylineXY) aRef;
205     
206     Py_BEGIN_ALLOW_THREADS
207     aRef = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetBoundaryPolyline() : 
208                            sipCpp->GetBoundaryPolyline();
209     Py_END_ALLOW_THREADS
210     
211     sipRes = (HYDROData_PolylineXY*)createPointer( aRef );
212   %End
213
214   /**
215    * Remove reference boundary polyline object from calculation case.
216    */
217   void RemoveBoundaryPolyline();
218
219
220   /**
221    * Add new one child region for calculation case.
222    * The new region is added into the list of reference regions.
223    * The label of theZone is changed during this operation
224    * because of new region becomes the new parent for this zone.
225    */
226   HYDROData_Region AddNewRegion( HYDROData_Zone theZone ) [opencascade::handle<HYDROData_Region> ( opencascade::handle<HYDROData_Zone>& )];
227   %MethodCode
228     Handle(HYDROData_Zone) aRef =
229       Handle(HYDROData_Zone)::DownCast( createHandle( a0 ) );
230     Handle(HYDROData_Region) aRes;
231     
232     if ( !aRef.IsNull() )
233     {
234       Py_BEGIN_ALLOW_THREADS
235       aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddNewRegion( aRef ) : 
236                              sipCpp->AddNewRegion( aRef );
237       Py_END_ALLOW_THREADS
238     }
239     
240     sipRes = (HYDROData_Region*)createPointer( aRes );
241   %End
242
243   /**
244    * Add new one reference region for calculation case.
245    * The label of theRegion is changed in case if old parent is not this calculation.
246    */
247   bool AddRegion( HYDROData_Region theRegion ) [bool ( opencascade::handle<HYDROData_Region>& )];
248   %MethodCode
249     Handle(HYDROData_Region) aRef =
250       Handle(HYDROData_Region)::DownCast( createHandle( a0 ) );
251     if ( !aRef.IsNull() )
252     {
253       Py_BEGIN_ALLOW_THREADS
254       sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRegion( aRef ):
255                                sipCpp->AddRegion( aRef );
256       Py_END_ALLOW_THREADS
257     }
258   %End
259
260   /**
261    * Returns all reference regions of calculation case.
262    */
263   HYDROData_SequenceOfObjects GetRegions() const;
264
265   /**
266    * Updates names of regions to correct order.
267    */
268   void UpdateRegionsOrder();
269
270   /**
271    * Removes reference region from calculation case.
272    */
273   void RemoveRegion( HYDROData_Region theRegion ) [void ( opencascade::handle<HYDROData_Region>& )];
274   %MethodCode
275     Handle(HYDROData_Region) aRef =
276       Handle(HYDROData_Region)::DownCast( createHandle( a0 ) );
277     if ( !aRef.IsNull() )
278     {
279       Py_BEGIN_ALLOW_THREADS
280       if ( sipSelfWasArg ) {
281         sipCpp->HYDROData_CalculationCase::RemoveRegion( aRef );
282       } else {
283         sipCpp->RemoveRegion( aRef );
284       }
285       Py_END_ALLOW_THREADS
286     }
287   %End
288
289   /**
290    * Removes all reference regions from calculation case.
291    */
292   void RemoveRegions();
293
294   
295   /**
296    * Returns all reference geometry groups of calculation case.
297    */
298   HYDROData_SequenceOfObjects GetSplitGroups() const;
299
300   /**
301    * Removes all reference geometry groups from calculation case.
302    */
303   void RemoveSplitGroups();
304
305
306   /**
307    * Exports the calculation case data (shell and groups) to GEOM module.
308    * \param theGeomEngine GEOM module engine
309    * \param theStudy SALOMEDS study, is used for publishing of GEOM objects
310    * \return true in case of success
311    */
312 //TODO:  virtual bool Export( GEOM::GEOM_Gen_var theGeomEngine,
313 //                       SALOMEDS::Study_ptr theStudy );
314         
315         QString Export( int theStudyId ) const;
316
317 public:      
318   // Public methods to work with Calculation services
319
320   /**
321    * Returns strickler coefficient for given point.
322    * \param thePoint the point to examine
323    * \return result strickler coefficient
324    */
325   double GetStricklerCoefficientForPoint( const double theCoordX,
326                                           const double theCoordY ) const [double ( const gp_XY& ) ];
327   %MethodCode
328     gp_XY aPnt( a0, a1 );
329   
330     Py_BEGIN_ALLOW_THREADS
331     sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetStricklerCoefficientForPoint( aPnt ) : 
332                              sipCpp->GetStricklerCoefficientForPoint( aPnt );
333     Py_END_ALLOW_THREADS
334   %End
335
336   /**
337    * Returns altitude for given point.
338    * \param thePoint the point to examine
339    * \return result altitude value
340    */
341   double GetAltitudeForPoint( const double theCoordX,
342                               const double theCoordY ) const [double ( const gp_XY& )];
343   %MethodCode
344     gp_XY aPnt( a0, a1 );
345   
346     Py_BEGIN_ALLOW_THREADS
347     sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt ) : 
348                              sipCpp->GetAltitudeForPoint( aPnt );
349     Py_END_ALLOW_THREADS
350   %End
351
352   /**
353    * Returns altitude for given point on given region.
354    * \param thePoint the point to examine
355    * \param theRegion reference region to check
356    * \return result altitude value
357    */
358   double GetAltitudeForPoint( const double     theCoordX,
359                               const double     theCoordY,
360                               HYDROData_Region theRegion ) const
361   [double ( const gp_XY&, opencascade::handle<HYDROData_Region>& )];
362   %MethodCode
363     gp_XY aPnt( a0, a1 );
364     Handle(HYDROData_Region) aRefRegion =
365       Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
366
367     Py_BEGIN_ALLOW_THREADS
368     sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefRegion ) : 
369                              sipCpp->GetAltitudeForPoint( aPnt, aRefRegion );
370     Py_END_ALLOW_THREADS
371   %End
372
373   /**
374    * Returns altitude for given point on given zone.
375    * \param thePoint the point to examine
376    * \param theZone reference zone to check
377    * \return result altitude value
378    */
379   double GetAltitudeForPoint( const double theCoordX,
380                               const double theCoordY,
381                               HYDROData_Zone theZone ) const
382   [double ( const gp_XY&, opencascade::handle<HYDROData_Zone>& )];
383   %MethodCode
384     gp_XY aPnt( a0, a1 );
385     Handle(HYDROData_Zone) aRefZone =
386       Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
387
388     Py_BEGIN_ALLOW_THREADS
389     sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefZone ) : 
390                              sipCpp->GetAltitudeForPoint( aPnt, aRefZone );
391     Py_END_ALLOW_THREADS
392   %End
393
394   /**
395    * Returns altitudes for given points on given region.
396    * \param thePoints the points to examine
397    * \param theZone reference region to check
398    * \return result altitude value
399    */
400   NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
401                                                       const NCollection_Sequence<double>& theCoordsY,
402                                                       HYDROData_Region                    theRegion,
403                                                       int                                 theMethod = 0) const
404   [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, opencascade::handle<HYDROData_Region>&, int)];
405   %MethodCode
406
407     NCollection_Sequence<gp_XY> aPnts;
408
409     int aLen = qMin( a0->Length(), a1->Length() );
410     for ( int i = 1; i <= aLen; ++i )
411     {
412       gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
413       aPnts.Append( aPnt );
414     }
415
416     Handle(HYDROData_Region) aRefRegion =
417       Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
418     int aMethod = a3;
419     
420     NCollection_Sequence<double> aRes;
421     Py_BEGIN_ALLOW_THREADS
422     aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefRegion, aMethod ) : 
423                            sipCpp->GetAltitudesForPoints( aPnts, aRefRegion, aMethod );
424     Py_END_ALLOW_THREADS
425     
426     sipRes = new NCollection_Sequence<double>( aRes );
427   %End
428
429   /**
430    * Returns altitudes for given points on given zone.
431    * \param thePoints the points to examine
432    * \param theZone reference zone to check
433    * \return result altitude value
434    */
435   NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
436                                                       const NCollection_Sequence<double>& theCoordsY,
437                                                       HYDROData_Zone                      theZone,
438                                                       int                                 theMethod = 0) const
439   [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, opencascade::handle<HYDROData_Zone>&, int )];
440   %MethodCode
441
442     NCollection_Sequence<gp_XY> aPnts;
443
444     int aLen = qMin( a0->Length(), a1->Length() );
445     for ( int i = 1; i <= aLen; ++i )
446     {
447       gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
448       aPnts.Append( aPnt );
449     }
450
451     Handle(HYDROData_Zone) aRefZone =
452       Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
453     int aMethod = a3;
454
455     NCollection_Sequence<double> aRes;
456     Py_BEGIN_ALLOW_THREADS
457     aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefZone, aMethod ) : 
458                            sipCpp->GetAltitudesForPoints( aPnts, aRefZone, aMethod );
459     Py_END_ALLOW_THREADS
460     
461     sipRes = new NCollection_Sequence<double>( aRes );
462   %End
463   
464   /**
465    * Returns region to which the point is belongs.
466    * \param thePoint the point to examine
467    * \return result region
468    */
469   HYDROData_Region GetRegionFromPoint( const double theCoordX,
470                                        const double theCoordY ) const
471   [opencascade::handle<HYDROData_Region> ( const gp_XY& )];
472   %MethodCode
473     Handle(HYDROData_Region) aRes;
474     
475     gp_XY aPnt( a0, a1 );
476   
477     Py_BEGIN_ALLOW_THREADS
478     aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetRegionFromPoint( aPnt ) : 
479                            sipCpp->GetRegionFromPoint( aPnt );
480     Py_END_ALLOW_THREADS
481     
482     sipRes = (HYDROData_Region*)createPointer( aRes );
483   %End
484
485   /**
486    * Returns zone to which the point is belongs.
487    * \param thePoint the point to examine
488    * \return result zone
489    */
490   HYDROData_Zone GetZoneFromPoint( const double theCoordX,
491                                    const double theCoordY ) const
492   [opencascade::handle<HYDROData_Zone> ( const gp_XY& )];
493   %MethodCode
494     Handle(HYDROData_Zone) aRes;
495     
496     gp_XY aPnt( a0, a1 );
497   
498     Py_BEGIN_ALLOW_THREADS
499     aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetZoneFromPoint( aPnt ) : 
500                            sipCpp->GetZoneFromPoint( aPnt );
501     Py_END_ALLOW_THREADS
502     
503     sipRes = (HYDROData_Zone*)createPointer( aRes );
504   %End
505
506   /**
507    * Returns classification of point for given zone.
508    * \param thePoint the point to examine
509    * \param theZone the zone to examine
510    * \return result classification
511    */
512   PointClassification GetPointClassification( const double theCoordX,
513                                               const double theCoordY,
514                                               HYDROData_Zone theZone ) const 
515   [PointClassification ( const gp_XY&, opencascade::handle<HYDROData_Zone>& )];    
516   %MethodCode
517     gp_XY aPnt( a0, a1 );
518
519     Handle(HYDROData_Zone) aRef =
520       Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
521
522     Py_BEGIN_ALLOW_THREADS
523     sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetPointClassification( aPnt, aRef ) : 
524                              sipCpp->GetPointClassification( aPnt, aRef );
525     Py_END_ALLOW_THREADS
526   %End
527
528
529   void ClearRules( HYDROData_CalculationCase::DataTag theDataTag );
530
531   void AddRule( HYDROData_Entity                   theObject1,
532                 HYDROData_PriorityType             thePriority,
533                 HYDROData_Entity                   theObject2,
534                 HYDROData_Zone::MergeType          theMergeType,
535                                 HYDROData_CalculationCase::DataTag theDataTag )
536   [void ( const opencascade::handle<HYDROData_Entity>&, HYDROData_PriorityType, opencascade::handle<HYDROData_Entity>&, HYDROData_Zone::MergeType, HYDROData_CalculationCase::DataTag )];
537   %MethodCode
538     Handle(HYDROData_Entity) anObject1 = createHandle( a0 );
539     Handle(HYDROData_Entity) anObject2 = createHandle( a2 );
540
541     Py_BEGIN_ALLOW_THREADS
542     sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRule( anObject1, a1, anObject2, a3, a4 ) : 
543                     sipCpp->AddRule( anObject1, a1, anObject2, a3, a4 );
544     Py_END_ALLOW_THREADS
545   %End
546
547   QString DumpRules();
548
549   void SetAssignmentMode( AssignmentMode theMode );
550   AssignmentMode GetAssignmentMode() const;
551
552 protected:
553
554   /**
555    * Creates new object in the internal data structure. Use higher level objects 
556    * to create objects with real content.
557    */
558   HYDROData_CalculationCase();
559
560   /**
561    * Destructs properties of the object and object itself, removes it from the document.
562    */
563   ~HYDROData_CalculationCase();
564 };
565
566