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 );
222 * Sets reference boundary polyline object for calculation case.
224 void SetBoundaryPolyline( HYDROData_PolylineXY thePolyline ) [void ( opencascade::handle<HYDROData_PolylineXY>& )];
226 Handle(HYDROData_PolylineXY) aRef =
227 Handle(HYDROData_PolylineXY)::DownCast( createHandle( a0 ) );
228 if ( !aRef.IsNull() )
230 Py_BEGIN_ALLOW_THREADS
231 if ( sipSelfWasArg ) {
232 sipCpp->HYDROData_CalculationCase::SetBoundaryPolyline( aRef );
234 sipCpp->SetBoundaryPolyline( aRef );
241 * Returns reference boundary polyline object of calculation case.
243 HYDROData_PolylineXY GetBoundaryPolyline() const [opencascade::handle<HYDROData_PolylineXY> ()];
245 Handle(HYDROData_PolylineXY) aRef;
247 Py_BEGIN_ALLOW_THREADS
248 aRef = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetBoundaryPolyline() :
249 sipCpp->GetBoundaryPolyline();
252 sipRes = (HYDROData_PolylineXY*)createPointer( aRef );
256 * Remove reference boundary polyline object from calculation case.
258 void RemoveBoundaryPolyline();
260 void SetLandCoverMap( HYDROData_LandCoverMap theLandCoverMap ) [void ( const opencascade::handle<HYDROData_LandCoverMap>& )];
262 Handle(HYDROData_LandCoverMap) aRef =
263 Handle(HYDROData_LandCoverMap)::DownCast( createHandle( a0 ) );
264 if ( !aRef.IsNull() )
266 Py_BEGIN_ALLOW_THREADS
267 if ( sipSelfWasArg ) {
268 sipCpp->HYDROData_CalculationCase::SetLandCoverMap( aRef );
270 sipCpp->SetLandCoverMap( aRef );
276 void SetStricklerTable( HYDROData_StricklerTable theStricklerTable ) [void ( const opencascade::handle<HYDROData_StricklerTable>& )];
278 Handle(HYDROData_StricklerTable) aRef =
279 Handle(HYDROData_StricklerTable)::DownCast( createHandle( a0 ) );
280 if ( !aRef.IsNull() )
282 Py_BEGIN_ALLOW_THREADS
283 if ( sipSelfWasArg ) {
284 sipCpp->HYDROData_CalculationCase::SetStricklerTable( aRef );
286 sipCpp->SetStricklerTable( aRef );
293 * Add new one child region for calculation case.
294 * The new region is added into the list of reference regions.
295 * The label of theZone is changed during this operation
296 * because of new region becomes the new parent for this zone.
298 HYDROData_Region AddNewRegion( HYDROData_Zone theZone ) [opencascade::handle<HYDROData_Region> ( opencascade::handle<HYDROData_Zone>& )];
300 Handle(HYDROData_Zone) aRef =
301 Handle(HYDROData_Zone)::DownCast( createHandle( a0 ) );
302 Handle(HYDROData_Region) aRes;
304 if ( !aRef.IsNull() )
306 Py_BEGIN_ALLOW_THREADS
307 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddNewRegion( aRef ) :
308 sipCpp->AddNewRegion( aRef );
312 sipRes = (HYDROData_Region*)createPointer( aRes );
316 * Add new one reference region for calculation case.
317 * The label of theRegion is changed in case if old parent is not this calculation.
319 bool AddRegion( HYDROData_Region theRegion ) [bool ( opencascade::handle<HYDROData_Region>& )];
321 Handle(HYDROData_Region) aRef =
322 Handle(HYDROData_Region)::DownCast( createHandle( a0 ) );
323 if ( !aRef.IsNull() )
325 Py_BEGIN_ALLOW_THREADS
326 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRegion( aRef ):
327 sipCpp->AddRegion( aRef );
333 * Returns all reference regions of calculation case.
335 HYDROData_SequenceOfObjects GetRegions() const;
338 * Updates names of regions to correct order.
340 void UpdateRegionsOrder();
343 * Removes reference region from calculation case.
345 void RemoveRegion( HYDROData_Region theRegion ) [void ( opencascade::handle<HYDROData_Region>& )];
347 Handle(HYDROData_Region) aRef =
348 Handle(HYDROData_Region)::DownCast( createHandle( a0 ) );
349 if ( !aRef.IsNull() )
351 Py_BEGIN_ALLOW_THREADS
352 if ( sipSelfWasArg ) {
353 sipCpp->HYDROData_CalculationCase::RemoveRegion( aRef );
355 sipCpp->RemoveRegion( aRef );
362 * Removes all reference regions from calculation case.
364 void RemoveRegions();
368 * Returns all reference geometry groups of calculation case.
370 HYDROData_SequenceOfObjects GetSplitGroups() const;
373 * Removes all reference geometry groups from calculation case.
375 void RemoveSplitGroups();
378 * \brief Set the Container Name to use when not default (FactoryServer).
379 * \param theContainerName the name of the container used for GEOM
380 * (to be used by scripts for distributed execution)
382 void SetContainerName( const QString& theContainerName );
385 * Exports the calculation case data (shell and groups) to GEOM module.
386 * \param theGeomEngine GEOM module engine
387 * \return true in case of success
389 //TODO: virtual bool Export( GEOM::GEOM_Gen_var theGeomEngine );
391 QString Export( ) const;
394 // Public methods to work with Calculation services
397 * Returns strickler coefficient for given point.
398 * \param thePoint the point to examine
399 * \return result strickler coefficient
401 double GetStricklerCoefficientForPoint( const double theCoordX,
402 const double theCoordY ) const [double ( const gp_XY& ) ];
404 gp_XY aPnt( a0, a1 );
406 Py_BEGIN_ALLOW_THREADS
407 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetStricklerCoefficientForPoint( aPnt ) :
408 sipCpp->GetStricklerCoefficientForPoint( aPnt );
413 * Returns altitude for given point.
414 * \param thePoint the point to examine
415 * \return result altitude value
417 double GetAltitudeForPoint( const double theCoordX,
418 const double theCoordY ) const [double ( const gp_XY& )];
420 gp_XY aPnt( a0, a1 );
422 Py_BEGIN_ALLOW_THREADS
423 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt ) :
424 sipCpp->GetAltitudeForPoint( aPnt );
429 * Returns altitude for given point on given region.
430 * \param thePoint the point to examine
431 * \param theRegion reference region to check
432 * \return result altitude value
434 double GetAltitudeForPoint( const double theCoordX,
435 const double theCoordY,
436 HYDROData_Region theRegion ) const
437 [double ( const gp_XY&, opencascade::handle<HYDROData_Region>& )];
439 gp_XY aPnt( a0, a1 );
440 Handle(HYDROData_Region) aRefRegion =
441 Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
443 Py_BEGIN_ALLOW_THREADS
444 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefRegion ) :
445 sipCpp->GetAltitudeForPoint( aPnt, aRefRegion );
450 * Returns altitude for given point on given zone.
451 * \param thePoint the point to examine
452 * \param theZone reference zone to check
453 * \return result altitude value
455 double GetAltitudeForPoint( const double theCoordX,
456 const double theCoordY,
457 HYDROData_Zone theZone ) const
458 [double ( const gp_XY&, opencascade::handle<HYDROData_Zone>& )];
460 gp_XY aPnt( a0, a1 );
461 Handle(HYDROData_Zone) aRefZone =
462 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
464 Py_BEGIN_ALLOW_THREADS
465 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefZone ) :
466 sipCpp->GetAltitudeForPoint( aPnt, aRefZone );
471 * Returns altitudes for given points on given region.
472 * \param thePoints the points to examine
473 * \param theZone reference region to check
474 * \return result altitude value
476 NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
477 const NCollection_Sequence<double>& theCoordsY,
478 HYDROData_Region theRegion,
479 int theMethod = 0) const
480 [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, opencascade::handle<HYDROData_Region>&, int)];
483 NCollection_Sequence<gp_XY> aPnts;
485 int aLen = qMin( a0->Length(), a1->Length() );
486 for ( int i = 1; i <= aLen; ++i )
488 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
489 aPnts.Append( aPnt );
492 Handle(HYDROData_Region) aRefRegion =
493 Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
496 NCollection_Sequence<double> aRes;
497 Py_BEGIN_ALLOW_THREADS
498 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefRegion, aMethod ) :
499 sipCpp->GetAltitudesForPoints( aPnts, aRefRegion, aMethod );
502 sipRes = new NCollection_Sequence<double>( aRes );
505 std::vector<double> GetStricklerCoefficientForPoints( const NCollection_Sequence<double>& theCoordsX,
506 const NCollection_Sequence<double>& theCoordsY,
509 [std::vector<double> ( const NCollection_Sequence<gp_XY>&, double, bool)];
511 std::vector<gp_XY> aPnts;
512 int aLen = qMin( a0->Length(), a1->Length() );
513 for ( int i = 1; i <= aLen; ++i )
515 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
516 aPnts.push_back( aPnt );
518 std::vector<double> aRes;
519 Py_BEGIN_ALLOW_THREADS
520 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetStricklerCoefficientForPoints( aPnts, a2, a3 ) :
521 sipCpp->GetStricklerCoefficientForPoints( aPnts, a2, a3 );
523 sipRes = new std::vector<double>( aRes );
527 std::vector<int> GetStricklerTypeForPoints( const NCollection_Sequence<double>& theCoordsX,
528 const NCollection_Sequence<double>& theCoordsY ) const
529 [std::vector<int>( const NCollection_Sequence<gp_XY>& )];
531 std::vector<gp_XY> aPnts;
532 int aLen = qMin( a0->Length(), a1->Length() );
533 for ( int i = 1; i <= aLen; ++i )
535 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
536 aPnts.push_back( aPnt );
538 std::vector<int> aRes;
539 Py_BEGIN_ALLOW_THREADS
540 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetStricklerTypeForPoints( aPnts ) :
541 sipCpp->GetStricklerTypeForPoints( aPnts );
543 sipRes = new std::vector<int>( aRes );
548 * Returns altitudes for given points on given zone.
549 * \param thePoints the points to examine
550 * \param theZone reference zone to check
551 * \return result altitude value
553 NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
554 const NCollection_Sequence<double>& theCoordsY,
555 HYDROData_Zone theZone,
556 int theMethod = 0) const
557 [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, opencascade::handle<HYDROData_Zone>&, int )];
560 NCollection_Sequence<gp_XY> aPnts;
562 int aLen = qMin( a0->Length(), a1->Length() );
563 for ( int i = 1; i <= aLen; ++i )
565 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
566 aPnts.Append( aPnt );
569 Handle(HYDROData_Zone) aRefZone =
570 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
573 NCollection_Sequence<double> aRes;
574 Py_BEGIN_ALLOW_THREADS
575 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefZone, aMethod ) :
576 sipCpp->GetAltitudesForPoints( aPnts, aRefZone, aMethod );
579 sipRes = new NCollection_Sequence<double>( aRes );
583 * Returns region to which the point is belongs.
584 * \param thePoint the point to examine
585 * \return result region
587 HYDROData_Region GetRegionFromPoint( const double theCoordX,
588 const double theCoordY ) const
589 [opencascade::handle<HYDROData_Region> ( const gp_XY& )];
591 Handle(HYDROData_Region) aRes;
593 gp_XY aPnt( a0, a1 );
595 Py_BEGIN_ALLOW_THREADS
596 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetRegionFromPoint( aPnt ) :
597 sipCpp->GetRegionFromPoint( aPnt );
600 sipRes = (HYDROData_Region*)createPointer( aRes );
604 * Returns zone to which the point is belongs.
605 * \param thePoint the point to examine
606 * \return result zone
608 HYDROData_Zone GetZoneFromPoint( const double theCoordX,
609 const double theCoordY ) const
610 [opencascade::handle<HYDROData_Zone> ( const gp_XY& )];
612 Handle(HYDROData_Zone) aRes;
614 gp_XY aPnt( a0, a1 );
616 Py_BEGIN_ALLOW_THREADS
617 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetZoneFromPoint( aPnt ) :
618 sipCpp->GetZoneFromPoint( aPnt );
621 sipRes = (HYDROData_Zone*)createPointer( aRes );
625 * Returns classification of point for given zone.
626 * \param thePoint the point to examine
627 * \param theZone the zone to examine
628 * \return result classification
630 PointClassification GetPointClassification( const double theCoordX,
631 const double theCoordY,
632 HYDROData_Zone theZone ) const
633 [PointClassification ( const gp_XY&, opencascade::handle<HYDROData_Zone>& )];
635 gp_XY aPnt( a0, a1 );
637 Handle(HYDROData_Zone) aRef =
638 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
640 Py_BEGIN_ALLOW_THREADS
641 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetPointClassification( aPnt, aRef ) :
642 sipCpp->GetPointClassification( aPnt, aRef );
647 void ClearRules( HYDROData_CalculationCase::DataTag theDataTag );
649 void AddRule( HYDROData_Entity theObject1,
650 HYDROData_PriorityType thePriority,
651 HYDROData_Entity theObject2,
652 HYDROData_Zone::MergeType theMergeType,
653 HYDROData_CalculationCase::DataTag theDataTag )
654 [void ( const opencascade::handle<HYDROData_Entity>&, HYDROData_PriorityType, opencascade::handle<HYDROData_Entity>&, HYDROData_Zone::MergeType, HYDROData_CalculationCase::DataTag )];
656 Handle(HYDROData_Entity) anObject1 = createHandle( a0 );
657 Handle(HYDROData_Entity) anObject2 = createHandle( a2 );
659 Py_BEGIN_ALLOW_THREADS
660 sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRule( anObject1, a1, anObject2, a3, a4 ) :
661 sipCpp->AddRule( anObject1, a1, anObject2, a3, a4 );
667 void SetAssignmentMode( AssignmentMode theMode );
668 AssignmentMode GetAssignmentMode() const;
673 * Creates new object in the internal data structure. Use higher level objects
674 * to create objects with real content.
676 HYDROData_CalculationCase();
679 * Destructs properties of the object and object itself, removes it from the document.
681 ~HYDROData_CalculationCase();