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.
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.
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
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include <HYDROData_CalculationCase.h>
21 #include <HYDROData_PriorityQueue.h>
24 enum HYDROData_PriorityType
30 class HYDROData_CalculationCase : public HYDROData_Entity
34 #include <HYDROData_CalculationCase.h>
37 %ConvertToSubClassCode
38 switch ( sipCpp->GetKind() )
40 case KIND_CALCULATION:
41 sipClass = sipClass_HYDROData_CalculationCase;
45 // We don't recognise the type.
52 enum PointClassification
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
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
88 * Add new one reference geometry object for calculation case.
90 bool AddGeometryObject( HYDROData_Object theObject ) [bool ( const opencascade::handle<HYDROData_Object>& )];
92 Handle(HYDROData_Object) aRef =
93 Handle(HYDROData_Object)::DownCast( createHandle( a0 ) );
96 Py_BEGIN_ALLOW_THREADS
97 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddGeometryObject( aRef ):
98 sipCpp->AddGeometryObject( aRef );
104 * Returns all reference geometry objects of calculation case.
106 HYDROData_SequenceOfObjects GetGeometryObjects() const;
109 * Removes reference geometry object from calculation case.
111 void RemoveGeometryObject( HYDROData_Object theObject )
112 [void ( const opencascade::handle<HYDROData_Object>& )];
114 Handle(HYDROData_Object) aRef =
115 Handle(HYDROData_Object)::DownCast( createHandle( a0 ) );
116 if ( !aRef.IsNull() )
118 Py_BEGIN_ALLOW_THREADS
119 if ( sipSelfWasArg ) {
120 sipCpp->HYDROData_CalculationCase::RemoveGeometryObject( aRef );
122 sipCpp->RemoveGeometryObject( aRef );
129 * Removes all reference geometry objects from calculation case.
131 void RemoveGeometryObjects();
135 * Add new one reference geometry group for calculation case.
137 bool AddGeometryGroup( HYDROData_ShapesGroup theGroup ) [bool ( const opencascade::handle<HYDROData_ShapesGroup>& )];
139 Handle(HYDROData_ShapesGroup) aRef =
140 Handle(HYDROData_ShapesGroup)::DownCast( createHandle( a0 ) );
141 if ( !aRef.IsNull() )
143 Py_BEGIN_ALLOW_THREADS
144 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddGeometryGroup( aRef ):
145 sipCpp->AddGeometryGroup( aRef );
151 * Returns all reference geometry groups of calculation case.
153 HYDROData_SequenceOfObjects GetGeometryGroups() const;
156 * Removes reference geometry group from calculation case.
158 void RemoveGeometryGroup( HYDROData_ShapesGroup theGroup ) [void ( opencascade::handle<HYDROData_ShapesGroup>& )];
160 Handle(HYDROData_ShapesGroup) aRef =
161 Handle(HYDROData_ShapesGroup)::DownCast( createHandle( a0 ) );
162 if ( !aRef.IsNull() )
164 Py_BEGIN_ALLOW_THREADS
165 if ( sipSelfWasArg ) {
166 sipCpp->HYDROData_CalculationCase::RemoveGeometryGroup( aRef );
168 sipCpp->RemoveGeometryGroup( aRef );
175 * Removes all reference geometry groups from calculation case.
177 void RemoveGeometryGroups();
181 * Add new boundary polygon to calculation case.
183 bool AddBoundaryPolygon( HYDROData_BCPolygon theObject ) [bool ( const opencascade::handle<HYDROData_BCPolygon>& )];
185 Handle(HYDROData_BCPolygon) aRef =
186 Handle(HYDROData_BCPolygon)::DownCast( createHandle( a0 ) );
187 if ( !aRef.IsNull() )
189 Py_BEGIN_ALLOW_THREADS
190 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddBoundaryPolygon( aRef ):
191 sipCpp->AddBoundaryPolygon( aRef );
197 * Returns all boundary polygons of calculation case.
199 HYDROData_SequenceOfObjects GetBoundaryPolygons() const;
202 * Removes boundary polygon from calculation case.
204 void RemoveBoundaryPolygon( HYDROData_BCPolygon theObject )
205 [void ( const opencascade::handle<HYDROData_BCPolygon>& )];
207 Handle(HYDROData_BCPolygon) aRef =
208 Handle(HYDROData_BCPolygon)::DownCast( createHandle( a0 ) );
209 if ( !aRef.IsNull() )
211 Py_BEGIN_ALLOW_THREADS
212 if ( sipSelfWasArg ) {
213 sipCpp->HYDROData_CalculationCase::RemoveBoundaryPolygon( aRef );
215 sipCpp->RemoveBoundaryPolygon( aRef );
223 * Add a polyline (as a constraint for the mesh).
225 bool AddInterPoly( HYDROData_PolylineXY theInterPolyline ) [bool ( opencascade::handle<HYDROData_PolylineXY>& )];
227 Handle(HYDROData_PolylineXY) aRef =
228 Handle(HYDROData_PolylineXY)::DownCast( createHandle( a0 ) );
229 if ( !aRef.IsNull() )
231 Py_BEGIN_ALLOW_THREADS
232 if ( sipSelfWasArg ) {
233 sipRes = sipCpp->HYDROData_CalculationCase::AddInterPoly( aRef );
235 sipRes = sipCpp->AddInterPoly( aRef );
242 * Remove a polyline (as a constraint for the mesh).
244 void RemoveInterPolyObject( HYDROData_PolylineXY theInterPolyline ) [void ( opencascade::handle<HYDROData_PolylineXY>& )];
246 Handle(HYDROData_PolylineXY) aRef =
247 Handle(HYDROData_PolylineXY)::DownCast( createHandle( a0 ) );
248 if ( !aRef.IsNull() )
250 Py_BEGIN_ALLOW_THREADS
251 if ( sipSelfWasArg ) {
252 sipCpp->HYDROData_CalculationCase::RemoveInterPolyObject( aRef );
254 sipCpp->RemoveInterPolyObject( aRef );
261 * Sets reference boundary polyline object for calculation case.
263 void SetBoundaryPolyline( HYDROData_PolylineXY thePolyline ) [void ( opencascade::handle<HYDROData_PolylineXY>& )];
265 Handle(HYDROData_PolylineXY) aRef =
266 Handle(HYDROData_PolylineXY)::DownCast( createHandle( a0 ) );
267 if ( !aRef.IsNull() )
269 Py_BEGIN_ALLOW_THREADS
270 if ( sipSelfWasArg ) {
271 sipCpp->HYDROData_CalculationCase::SetBoundaryPolyline( aRef );
273 sipCpp->SetBoundaryPolyline( aRef );
280 * Returns reference boundary polyline object of calculation case.
282 HYDROData_PolylineXY GetBoundaryPolyline() const [opencascade::handle<HYDROData_PolylineXY> ()];
284 Handle(HYDROData_PolylineXY) aRef;
286 Py_BEGIN_ALLOW_THREADS
287 aRef = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetBoundaryPolyline() :
288 sipCpp->GetBoundaryPolyline();
291 sipRes = (HYDROData_PolylineXY*)createPointer( aRef );
295 * Remove reference boundary polyline object from calculation case.
297 void RemoveBoundaryPolyline();
299 void SetLandCoverMap( HYDROData_LandCoverMap theLandCoverMap ) [void ( const opencascade::handle<HYDROData_LandCoverMap>& )];
301 Handle(HYDROData_LandCoverMap) aRef =
302 Handle(HYDROData_LandCoverMap)::DownCast( createHandle( a0 ) );
303 if ( !aRef.IsNull() )
305 Py_BEGIN_ALLOW_THREADS
306 if ( sipSelfWasArg ) {
307 sipCpp->HYDROData_CalculationCase::SetLandCoverMap( aRef );
309 sipCpp->SetLandCoverMap( aRef );
315 void SetStricklerTable( HYDROData_StricklerTable theStricklerTable ) [void ( const opencascade::handle<HYDROData_StricklerTable>& )];
317 Handle(HYDROData_StricklerTable) aRef =
318 Handle(HYDROData_StricklerTable)::DownCast( createHandle( a0 ) );
319 if ( !aRef.IsNull() )
321 Py_BEGIN_ALLOW_THREADS
322 if ( sipSelfWasArg ) {
323 sipCpp->HYDROData_CalculationCase::SetStricklerTable( aRef );
325 sipCpp->SetStricklerTable( aRef );
332 * Add new one child region for calculation case.
333 * The new region is added into the list of reference regions.
334 * The label of theZone is changed during this operation
335 * because of new region becomes the new parent for this zone.
337 HYDROData_Region AddNewRegion( HYDROData_Zone theZone ) [opencascade::handle<HYDROData_Region> ( opencascade::handle<HYDROData_Zone>& )];
339 Handle(HYDROData_Zone) aRef =
340 Handle(HYDROData_Zone)::DownCast( createHandle( a0 ) );
341 Handle(HYDROData_Region) aRes;
343 if ( !aRef.IsNull() )
345 Py_BEGIN_ALLOW_THREADS
346 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddNewRegion( aRef ) :
347 sipCpp->AddNewRegion( aRef );
351 sipRes = (HYDROData_Region*)createPointer( aRes );
355 * Add new one reference region for calculation case.
356 * The label of theRegion is changed in case if old parent is not this calculation.
358 bool AddRegion( HYDROData_Region theRegion ) [bool ( opencascade::handle<HYDROData_Region>& )];
360 Handle(HYDROData_Region) aRef =
361 Handle(HYDROData_Region)::DownCast( createHandle( a0 ) );
362 if ( !aRef.IsNull() )
364 Py_BEGIN_ALLOW_THREADS
365 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRegion( aRef ):
366 sipCpp->AddRegion( aRef );
372 * Returns all reference regions of calculation case.
374 HYDROData_SequenceOfObjects GetRegions() const;
377 * Updates names of regions to correct order.
379 void UpdateRegionsOrder();
382 * Removes reference region from calculation case.
384 void RemoveRegion( HYDROData_Region theRegion ) [void ( opencascade::handle<HYDROData_Region>& )];
386 Handle(HYDROData_Region) aRef =
387 Handle(HYDROData_Region)::DownCast( createHandle( a0 ) );
388 if ( !aRef.IsNull() )
390 Py_BEGIN_ALLOW_THREADS
391 if ( sipSelfWasArg ) {
392 sipCpp->HYDROData_CalculationCase::RemoveRegion( aRef );
394 sipCpp->RemoveRegion( aRef );
401 * Removes all reference regions from calculation case.
403 void RemoveRegions();
407 * Returns all reference geometry groups of calculation case.
409 HYDROData_SequenceOfObjects GetSplitGroups() const;
412 * Removes all reference geometry groups from calculation case.
414 void RemoveSplitGroups();
417 * \brief Set the Container Name to use when not default (FactoryServer).
418 * \param theContainerName the name of the container used for GEOM
419 * (to be used by scripts for distributed execution)
421 void SetContainerName( const QString& theContainerName );
424 * Exports the calculation case data (shell and groups) to GEOM module.
425 * \param theGeomEngine GEOM module engine
426 * \return true in case of success
428 //TODO: virtual bool Export( GEOM::GEOM_Gen_var theGeomEngine );
430 QString Export( ) const;
433 // Public methods to work with Calculation services
436 * Returns strickler coefficient for given point.
437 * \param thePoint the point to examine
438 * \return result strickler coefficient
440 double GetStricklerCoefficientForPoint( const double theCoordX,
441 const double theCoordY ) const [double ( const gp_XY& ) ];
443 gp_XY aPnt( a0, a1 );
445 Py_BEGIN_ALLOW_THREADS
446 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetStricklerCoefficientForPoint( aPnt ) :
447 sipCpp->GetStricklerCoefficientForPoint( aPnt );
452 * Returns altitude for given point.
453 * \param thePoint the point to examine
454 * \return result altitude value
456 double GetAltitudeForPoint( const double theCoordX,
457 const double theCoordY ) const [double ( const gp_XY& )];
459 gp_XY aPnt( a0, a1 );
461 Py_BEGIN_ALLOW_THREADS
462 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt ) :
463 sipCpp->GetAltitudeForPoint( aPnt );
468 * Returns altitude for given point on given region.
469 * \param thePoint the point to examine
470 * \param theRegion reference region to check
471 * \return result altitude value
473 double GetAltitudeForPoint( const double theCoordX,
474 const double theCoordY,
475 HYDROData_Region theRegion ) const
476 [double ( const gp_XY&, opencascade::handle<HYDROData_Region>& )];
478 gp_XY aPnt( a0, a1 );
479 Handle(HYDROData_Region) aRefRegion =
480 Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
482 Py_BEGIN_ALLOW_THREADS
483 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefRegion ) :
484 sipCpp->GetAltitudeForPoint( aPnt, aRefRegion );
489 * Returns altitude for given point on given zone.
490 * \param thePoint the point to examine
491 * \param theZone reference zone to check
492 * \return result altitude value
494 double GetAltitudeForPoint( const double theCoordX,
495 const double theCoordY,
496 HYDROData_Zone theZone ) const
497 [double ( const gp_XY&, opencascade::handle<HYDROData_Zone>& )];
499 gp_XY aPnt( a0, a1 );
500 Handle(HYDROData_Zone) aRefZone =
501 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
503 Py_BEGIN_ALLOW_THREADS
504 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefZone ) :
505 sipCpp->GetAltitudeForPoint( aPnt, aRefZone );
510 * Returns altitudes for given points on given region.
511 * \param thePoints the points to examine
512 * \param theZone reference region to check
513 * \return result altitude value
515 NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
516 const NCollection_Sequence<double>& theCoordsY,
517 HYDROData_Region theRegion,
518 int theMethod = 0) const
519 [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, opencascade::handle<HYDROData_Region>&, int)];
522 NCollection_Sequence<gp_XY> aPnts;
524 int aLen = qMin( a0->Length(), a1->Length() );
525 for ( int i = 1; i <= aLen; ++i )
527 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
528 aPnts.Append( aPnt );
531 Handle(HYDROData_Region) aRefRegion =
532 Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
535 NCollection_Sequence<double> aRes;
536 Py_BEGIN_ALLOW_THREADS
537 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefRegion, aMethod ) :
538 sipCpp->GetAltitudesForPoints( aPnts, aRefRegion, aMethod );
541 sipRes = new NCollection_Sequence<double>( aRes );
544 std::vector<double> GetStricklerCoefficientForPoints( const NCollection_Sequence<double>& theCoordsX,
545 const NCollection_Sequence<double>& theCoordsY,
548 [std::vector<double> ( const NCollection_Sequence<gp_XY>&, double, bool)];
550 std::vector<gp_XY> aPnts;
551 int aLen = qMin( a0->Length(), a1->Length() );
552 for ( int i = 1; i <= aLen; ++i )
554 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
555 aPnts.push_back( aPnt );
557 std::vector<double> aRes;
558 Py_BEGIN_ALLOW_THREADS
559 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetStricklerCoefficientForPoints( aPnts, a2, a3 ) :
560 sipCpp->GetStricklerCoefficientForPoints( aPnts, a2, a3 );
562 sipRes = new std::vector<double>( aRes );
566 std::vector<int> GetStricklerTypeForPoints( const NCollection_Sequence<double>& theCoordsX,
567 const NCollection_Sequence<double>& theCoordsY ) const
568 [std::vector<int>( const NCollection_Sequence<gp_XY>& )];
570 std::vector<gp_XY> aPnts;
571 int aLen = qMin( a0->Length(), a1->Length() );
572 for ( int i = 1; i <= aLen; ++i )
574 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
575 aPnts.push_back( aPnt );
577 std::vector<int> aRes;
578 Py_BEGIN_ALLOW_THREADS
579 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetStricklerTypeForPoints( aPnts ) :
580 sipCpp->GetStricklerTypeForPoints( aPnts );
582 sipRes = new std::vector<int>( aRes );
587 * Returns altitudes for given points on given zone.
588 * \param thePoints the points to examine
589 * \param theZone reference zone to check
590 * \return result altitude value
592 NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
593 const NCollection_Sequence<double>& theCoordsY,
594 HYDROData_Zone theZone,
595 int theMethod = 0) const
596 [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, opencascade::handle<HYDROData_Zone>&, int )];
599 NCollection_Sequence<gp_XY> aPnts;
601 int aLen = qMin( a0->Length(), a1->Length() );
602 for ( int i = 1; i <= aLen; ++i )
604 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
605 aPnts.Append( aPnt );
608 Handle(HYDROData_Zone) aRefZone =
609 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
612 NCollection_Sequence<double> aRes;
613 Py_BEGIN_ALLOW_THREADS
614 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefZone, aMethod ) :
615 sipCpp->GetAltitudesForPoints( aPnts, aRefZone, aMethod );
618 sipRes = new NCollection_Sequence<double>( aRes );
622 * Returns region to which the point is belongs.
623 * \param thePoint the point to examine
624 * \return result region
626 HYDROData_Region GetRegionFromPoint( const double theCoordX,
627 const double theCoordY ) const
628 [opencascade::handle<HYDROData_Region> ( const gp_XY& )];
630 Handle(HYDROData_Region) aRes;
632 gp_XY aPnt( a0, a1 );
634 Py_BEGIN_ALLOW_THREADS
635 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetRegionFromPoint( aPnt ) :
636 sipCpp->GetRegionFromPoint( aPnt );
639 sipRes = (HYDROData_Region*)createPointer( aRes );
643 * Returns zone to which the point is belongs.
644 * \param thePoint the point to examine
645 * \return result zone
647 HYDROData_Zone GetZoneFromPoint( const double theCoordX,
648 const double theCoordY ) const
649 [opencascade::handle<HYDROData_Zone> ( const gp_XY& )];
651 Handle(HYDROData_Zone) aRes;
653 gp_XY aPnt( a0, a1 );
655 Py_BEGIN_ALLOW_THREADS
656 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetZoneFromPoint( aPnt ) :
657 sipCpp->GetZoneFromPoint( aPnt );
660 sipRes = (HYDROData_Zone*)createPointer( aRes );
664 * Returns classification of point for given zone.
665 * \param thePoint the point to examine
666 * \param theZone the zone to examine
667 * \return result classification
669 PointClassification GetPointClassification( const double theCoordX,
670 const double theCoordY,
671 HYDROData_Zone theZone ) const
672 [PointClassification ( const gp_XY&, opencascade::handle<HYDROData_Zone>& )];
674 gp_XY aPnt( a0, a1 );
676 Handle(HYDROData_Zone) aRef =
677 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
679 Py_BEGIN_ALLOW_THREADS
680 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetPointClassification( aPnt, aRef ) :
681 sipCpp->GetPointClassification( aPnt, aRef );
686 void ClearRules( HYDROData_CalculationCase::DataTag theDataTag );
688 void AddRule( HYDROData_Entity theObject1,
689 HYDROData_PriorityType thePriority,
690 HYDROData_Entity theObject2,
691 HYDROData_Zone::MergeType theMergeType,
692 HYDROData_CalculationCase::DataTag theDataTag )
693 [void ( const opencascade::handle<HYDROData_Entity>&, HYDROData_PriorityType, opencascade::handle<HYDROData_Entity>&, HYDROData_Zone::MergeType, HYDROData_CalculationCase::DataTag )];
695 Handle(HYDROData_Entity) anObject1 = createHandle( a0 );
696 Handle(HYDROData_Entity) anObject2 = createHandle( a2 );
698 Py_BEGIN_ALLOW_THREADS
699 sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRule( anObject1, a1, anObject2, a3, a4 ) :
700 sipCpp->AddRule( anObject1, a1, anObject2, a3, a4 );
706 void SetAssignmentMode( AssignmentMode theMode );
707 AssignmentMode GetAssignmentMode() const;
712 * Creates new object in the internal data structure. Use higher level objects
713 * to create objects with real content.
715 HYDROData_CalculationCase();
718 * Destructs properties of the object and object itself, removes it from the document.
720 ~HYDROData_CalculationCase();