Salome HOME
Bug #478: unresolved conflicts appear again when Edit calculation case in Manual...
[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 #include <HYDROData_PriorityQueue.h>
26 %End
27
28 enum HYDROData_PriorityType
29 {
30   LESS,
31   GREATER,
32 };
33
34 class HYDROData_CalculationCase : public HYDROData_Entity
35 {
36
37 %TypeHeaderCode
38 #include <HYDROData_CalculationCase.h>
39 %End
40
41 %ConvertToSubClassCode
42     switch ( sipCpp->GetKind() )
43     {
44       case KIND_CALCULATION:
45         sipClass = sipClass_HYDROData_CalculationCase;
46         break;
47
48       default:
49         // We don't recognise the type.
50         sipClass = NULL;
51     }
52 %End
53
54 public:
55
56   enum PointClassification
57   {
58     POINT_OUT,  ///< point is out of zone face
59     POINT_IN,   ///< point is inside of zone face
60     POINT_ON    ///< point is on the edge of zone face
61   };
62
63   enum AssignmentMode
64   {
65     MANUAL = 0,
66     AUTOMATIC,
67   };
68
69 public:      
70   /**
71    * Add new one reference geometry object for calculation case.
72    */
73   bool AddGeometryObject( HYDROData_Object theObject ) [bool ( const Handle_HYDROData_Object& )];
74   %MethodCode
75     Handle(HYDROData_Object) aRef =
76       Handle(HYDROData_Object)::DownCast( createHandle( a0 ) );
77     if ( !aRef.IsNull() )
78     {
79       Py_BEGIN_ALLOW_THREADS
80       sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddGeometryObject( aRef ):
81                                sipCpp->AddGeometryObject( aRef );
82       Py_END_ALLOW_THREADS
83     }
84   %End
85
86   /**
87    * Returns all reference geometry objects of calculation case.
88    */
89   HYDROData_SequenceOfObjects GetGeometryObjects() const;
90
91   /**
92    * Removes reference geometry object from calculation case.
93    */
94   void RemoveGeometryObject( HYDROData_Object theObject ) [void ( const Handle_HYDROData_Object& )];
95   %MethodCode
96     Handle(HYDROData_Object) aRef =
97       Handle(HYDROData_Object)::DownCast( createHandle( a0 ) );
98     if ( !aRef.IsNull() )
99     {
100       Py_BEGIN_ALLOW_THREADS
101       if ( sipSelfWasArg ) {
102         sipCpp->HYDROData_CalculationCase::RemoveGeometryObject( aRef );
103       } else {
104         sipCpp->RemoveGeometryObject( aRef );
105       }
106       Py_END_ALLOW_THREADS
107     }
108   %End
109
110   /**
111    * Removes all reference geometry objects from calculation case.
112    */
113   void RemoveGeometryObjects();
114
115
116   /**
117    * Add new one reference geometry group for calculation case.
118    */
119   bool AddGeometryGroup( HYDROData_ShapesGroup theGroup ) [bool ( const Handle_HYDROData_ShapesGroup& )];
120   %MethodCode
121     Handle(HYDROData_ShapesGroup) aRef =
122       Handle(HYDROData_ShapesGroup)::DownCast( createHandle( a0 ) );
123     if ( !aRef.IsNull() )
124     {
125       Py_BEGIN_ALLOW_THREADS
126       sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddGeometryGroup( aRef ):
127                                sipCpp->AddGeometryGroup( aRef );
128       Py_END_ALLOW_THREADS
129     }
130   %End
131
132   /**
133    * Returns all reference geometry groups of calculation case.
134    */
135   HYDROData_SequenceOfObjects GetGeometryGroups() const;
136
137   /**
138    * Removes reference geometry group from calculation case.
139    */
140   void RemoveGeometryGroup( HYDROData_ShapesGroup theGroup ) [void ( const Handle_HYDROData_ShapesGroup& )];
141   %MethodCode
142     Handle(HYDROData_ShapesGroup) aRef =
143       Handle(HYDROData_ShapesGroup)::DownCast( createHandle( a0 ) );
144     if ( !aRef.IsNull() )
145     {
146       Py_BEGIN_ALLOW_THREADS
147       if ( sipSelfWasArg ) {
148         sipCpp->HYDROData_CalculationCase::RemoveGeometryGroup( aRef );
149       } else {
150         sipCpp->RemoveGeometryGroup( aRef );
151       }
152       Py_END_ALLOW_THREADS
153     }
154   %End
155
156   /**
157    * Removes all reference geometry groups from calculation case.
158    */
159   void RemoveGeometryGroups();
160
161
162   /**
163    * Sets reference boundary polyline object for calculation case.
164    */
165   void SetBoundaryPolyline( HYDROData_PolylineXY thePolyline ) [void ( const Handle_HYDROData_PolylineXY& )];
166   %MethodCode
167     Handle(HYDROData_PolylineXY) aRef =
168       Handle(HYDROData_PolylineXY)::DownCast( createHandle( a0 ) );
169     if ( !aRef.IsNull() )
170     {
171       Py_BEGIN_ALLOW_THREADS
172       if ( sipSelfWasArg ) {
173         sipCpp->HYDROData_CalculationCase::SetBoundaryPolyline( aRef );
174       } else {
175         sipCpp->SetBoundaryPolyline( aRef );
176       }
177       Py_END_ALLOW_THREADS
178     }
179   %End
180
181   /**
182    * Returns reference boundary polyline object of calculation case.
183    */
184   HYDROData_PolylineXY GetBoundaryPolyline() const [Handle_HYDROData_PolylineXY ()];
185   %MethodCode
186     Handle(HYDROData_PolylineXY) aRef;
187     
188     Py_BEGIN_ALLOW_THREADS
189     aRef = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetBoundaryPolyline() : 
190                            sipCpp->GetBoundaryPolyline();
191     Py_END_ALLOW_THREADS
192     
193     sipRes = (HYDROData_PolylineXY*)createPointer( aRef );
194   %End
195
196   /**
197    * Remove reference boundary polyline object from calculation case.
198    */
199   void RemoveBoundaryPolyline();
200
201
202   /**
203    * Add new one child region for calculation case.
204    * The new region is added into the list of reference regions.
205    * The label of theZone is changed during this operation
206    * because of new region becomes the new parent for this zone.
207    */
208   HYDROData_Region AddNewRegion( HYDROData_Zone theZone ) [Handle_HYDROData_Region ( const Handle_HYDROData_Zone& )];
209   %MethodCode
210     Handle(HYDROData_Zone) aRef =
211       Handle(HYDROData_Zone)::DownCast( createHandle( a0 ) );
212     Handle(HYDROData_Region) aRes;
213     
214     if ( !aRef.IsNull() )
215     {
216       Py_BEGIN_ALLOW_THREADS
217       aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddNewRegion( aRef ) : 
218                              sipCpp->AddNewRegion( aRef );
219       Py_END_ALLOW_THREADS
220     }
221     
222     sipRes = (HYDROData_Region*)createPointer( aRes );
223   %End
224
225   /**
226    * Add new one reference region for calculation case.
227    * The label of theRegion is changed in case if old parent is not this calculation.
228    */
229   bool AddRegion( HYDROData_Region theRegion ) [bool ( const Handle_HYDROData_Region& )];
230   %MethodCode
231     Handle(HYDROData_Region) aRef =
232       Handle(HYDROData_Region)::DownCast( createHandle( a0 ) );
233     if ( !aRef.IsNull() )
234     {
235       Py_BEGIN_ALLOW_THREADS
236       sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRegion( aRef ):
237                                sipCpp->AddRegion( aRef );
238       Py_END_ALLOW_THREADS
239     }
240   %End
241
242   /**
243    * Returns all reference regions of calculation case.
244    */
245   HYDROData_SequenceOfObjects GetRegions() const;
246
247   /**
248    * Updates names of regions to correct order.
249    */
250   void UpdateRegionsOrder();
251
252   /**
253    * Removes reference region from calculation case.
254    */
255   void RemoveRegion( HYDROData_Region theRegion ) [void ( const Handle_HYDROData_Region& )];
256   %MethodCode
257     Handle(HYDROData_Region) aRef =
258       Handle(HYDROData_Region)::DownCast( createHandle( a0 ) );
259     if ( !aRef.IsNull() )
260     {
261       Py_BEGIN_ALLOW_THREADS
262       if ( sipSelfWasArg ) {
263         sipCpp->HYDROData_CalculationCase::RemoveRegion( aRef );
264       } else {
265         sipCpp->RemoveRegion( aRef );
266       }
267       Py_END_ALLOW_THREADS
268     }
269   %End
270
271   /**
272    * Removes all reference regions from calculation case.
273    */
274   void RemoveRegions();
275
276   
277   /**
278    * Returns all reference geometry groups of calculation case.
279    */
280   HYDROData_SequenceOfObjects GetSplittedGroups() const;
281
282   /**
283    * Removes all reference geometry groups from calculation case.
284    */
285   void RemoveSplittedGroups();
286
287
288   /**
289    * Exports the calculation case data (shell and groups) to GEOM module.
290    * \param theGeomEngine GEOM module engine
291    * \param theStudy SALOMEDS study, is used for publishing of GEOM objects
292    * \return true in case of success
293    */
294 //TODO:  virtual bool Export( GEOM::GEOM_Gen_var theGeomEngine,
295 //                       SALOMEDS::Study_ptr theStudy );
296
297 public:      
298   // Public methods to work with Calculation services
299
300   /**
301    * Returns altitude for given point.
302    * \param thePoint the point to examine
303    * \return result altitude value
304    */
305   double GetAltitudeForPoint( const double theCoordX,
306                               const double theCoordY ) const [double ( const gp_XY& )];
307   %MethodCode
308     gp_XY aPnt( a0, a1 );
309   
310     Py_BEGIN_ALLOW_THREADS
311     sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt ) : 
312                              sipCpp->GetAltitudeForPoint( aPnt );
313     Py_END_ALLOW_THREADS
314   %End
315
316   /**
317    * Returns altitude for given point on given region.
318    * \param thePoint the point to examine
319    * \param theRegion reference region to check
320    * \return result altitude value
321    */
322   double GetAltitudeForPoint( const double     theCoordX,
323                               const double     theCoordY,
324                               HYDROData_Region theRegion ) const
325   [double ( const gp_XY&, const Handle_HYDROData_Region& )];
326   %MethodCode
327     gp_XY aPnt( a0, a1 );
328     Handle(HYDROData_Region) aRefRegion =
329       Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
330
331     Py_BEGIN_ALLOW_THREADS
332     sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefRegion ) : 
333                              sipCpp->GetAltitudeForPoint( aPnt, aRefRegion );
334     Py_END_ALLOW_THREADS
335   %End
336
337   /**
338    * Returns altitude for given point on given zone.
339    * \param thePoint the point to examine
340    * \param theZone reference zone to check
341    * \return result altitude value
342    */
343   double GetAltitudeForPoint( const double theCoordX,
344                               const double theCoordY,
345                               HYDROData_Zone theZone ) const
346   [double ( const gp_XY&, const Handle_HYDROData_Zone& )];
347   %MethodCode
348     gp_XY aPnt( a0, a1 );
349     Handle(HYDROData_Zone) aRefZone =
350       Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
351
352     Py_BEGIN_ALLOW_THREADS
353     sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefZone ) : 
354                              sipCpp->GetAltitudeForPoint( aPnt, aRefZone );
355     Py_END_ALLOW_THREADS
356   %End
357
358   /**
359    * Returns altitudes for given points on given region.
360    * \param thePoints the points to examine
361    * \param theZone reference region to check
362    * \return result altitude value
363    */
364   NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
365                                                       const NCollection_Sequence<double>& theCoordsY,
366                                                       HYDROData_Region                    theRegion ) const
367   [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, const Handle_HYDROData_Region& )];
368   %MethodCode
369
370     NCollection_Sequence<gp_XY> aPnts;
371
372     int aLen = qMin( a0->Length(), a1->Length() );
373     for ( int i = 1; i <= aLen; ++i )
374     {
375       gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
376       aPnts.Append( aPnt );
377     }
378
379     Handle(HYDROData_Region) aRefRegion =
380       Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
381
382     NCollection_Sequence<double> aRes;
383     Py_BEGIN_ALLOW_THREADS
384     aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefRegion ) : 
385                            sipCpp->GetAltitudesForPoints( aPnts, aRefRegion );
386     Py_END_ALLOW_THREADS
387     
388     sipRes = new NCollection_Sequence<double>( aRes );
389   %End
390
391   /**
392    * Returns altitudes for given points on given zone.
393    * \param thePoints the points to examine
394    * \param theZone reference zone to check
395    * \return result altitude value
396    */
397   NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
398                                                       const NCollection_Sequence<double>& theCoordsY,
399                                                       HYDROData_Zone                      theZone ) const
400   [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, const Handle_HYDROData_Zone& )];
401   %MethodCode
402
403     NCollection_Sequence<gp_XY> aPnts;
404
405     int aLen = qMin( a0->Length(), a1->Length() );
406     for ( int i = 1; i <= aLen; ++i )
407     {
408       gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
409       aPnts.Append( aPnt );
410     }
411
412     Handle(HYDROData_Zone) aRefZone =
413       Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
414
415     NCollection_Sequence<double> aRes;
416     Py_BEGIN_ALLOW_THREADS
417     aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefZone ) : 
418                            sipCpp->GetAltitudesForPoints( aPnts, aRefZone );
419     Py_END_ALLOW_THREADS
420     
421     sipRes = new NCollection_Sequence<double>( aRes );
422   %End
423   
424   /**
425    * Returns region to which the point is belongs.
426    * \param thePoint the point to examine
427    * \return result region
428    */
429   HYDROData_Region GetRegionFromPoint( const double theCoordX,
430                                        const double theCoordY ) const
431   [Handle_HYDROData_Region ( const gp_XY& )];
432   %MethodCode
433     Handle(HYDROData_Region) aRes;
434     
435     gp_XY aPnt( a0, a1 );
436   
437     Py_BEGIN_ALLOW_THREADS
438     aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetRegionFromPoint( aPnt ) : 
439                            sipCpp->GetRegionFromPoint( aPnt );
440     Py_END_ALLOW_THREADS
441     
442     sipRes = (HYDROData_Region*)createPointer( aRes );
443   %End
444
445   /**
446    * Returns zone to which the point is belongs.
447    * \param thePoint the point to examine
448    * \return result zone
449    */
450   HYDROData_Zone GetZoneFromPoint( const double theCoordX,
451                                    const double theCoordY ) const
452   [Handle_HYDROData_Zone ( const gp_XY& )];
453   %MethodCode
454     Handle(HYDROData_Zone) aRes;
455     
456     gp_XY aPnt( a0, a1 );
457   
458     Py_BEGIN_ALLOW_THREADS
459     aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetZoneFromPoint( aPnt ) : 
460                            sipCpp->GetZoneFromPoint( aPnt );
461     Py_END_ALLOW_THREADS
462     
463     sipRes = (HYDROData_Zone*)createPointer( aRes );
464   %End
465
466   /**
467    * Returns classification of point for given zone.
468    * \param thePoint the point to examine
469    * \param theZone the zone to examine
470    * \return result classification
471    */
472   PointClassification GetPointClassification( const double theCoordX,
473                                               const double theCoordY,
474                                               HYDROData_Zone theZone ) const 
475   [PointClassification ( const gp_XY&, const Handle_HYDROData_Zone& )];    
476   %MethodCode
477     gp_XY aPnt( a0, a1 );
478
479     Handle(HYDROData_Zone) aRef =
480       Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
481
482     Py_BEGIN_ALLOW_THREADS
483     sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetPointClassification( aPnt, aRef ) : 
484                              sipCpp->GetPointClassification( aPnt, aRef );
485     Py_END_ALLOW_THREADS
486   %End
487
488
489   void ClearRules();
490
491   void AddRule( HYDROData_Object                   theObject1,
492                 HYDROData_PriorityType             thePriority,
493                 HYDROData_Object                   theObject2,
494                 HYDROData_Zone::MergeAltitudesType theMergeType )
495   [void ( const Handle_HYDROData_Object&, HYDROData_PriorityType, const Handle_HYDROData_Object&, HYDROData_Zone::MergeAltitudesType )];
496   %MethodCode
497     Handle(HYDROData_Object) anObject1 =
498       Handle(HYDROData_Object)::DownCast( createHandle( a0 ) );
499     Handle(HYDROData_Object) anObject2 =
500       Handle(HYDROData_Object)::DownCast( createHandle( a2 ) );
501
502     Py_BEGIN_ALLOW_THREADS
503     sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRule( anObject1, a1, anObject2, a3 ) : 
504                     sipCpp->AddRule( anObject1, a1, anObject2, a3 );
505     Py_END_ALLOW_THREADS
506   %End
507
508   QString DumpRules();
509
510   void SetAssignmentMode( AssignmentMode theMode );
511   AssignmentMode GetAssignmentMode() const;
512
513 protected:
514
515   /**
516    * Creates new object in the internal data structure. Use higher level objects 
517    * to create objects with real content.
518    */
519   HYDROData_CalculationCase();
520
521   /**
522    * Destructs properties of the object and object itself, removes it from the document.
523    */
524   ~HYDROData_CalculationCase();
525 };
526
527