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();
379 * Exports the calculation case data (shell and groups) to GEOM module.
380 * \param theGeomEngine GEOM module engine
381 * \param theStudy SALOMEDS study, is used for publishing of GEOM objects
382 * \return true in case of success
384 //TODO: virtual bool Export( GEOM::GEOM_Gen_var theGeomEngine,
385 // SALOMEDS::Study_ptr theStudy );
387 QString Export( int theStudyId ) const;
390 // Public methods to work with Calculation services
393 * Returns strickler coefficient for given point.
394 * \param thePoint the point to examine
395 * \return result strickler coefficient
397 double GetStricklerCoefficientForPoint( const double theCoordX,
398 const double theCoordY ) const [double ( const gp_XY& ) ];
400 gp_XY aPnt( a0, a1 );
402 Py_BEGIN_ALLOW_THREADS
403 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetStricklerCoefficientForPoint( aPnt ) :
404 sipCpp->GetStricklerCoefficientForPoint( aPnt );
409 * Returns altitude for given point.
410 * \param thePoint the point to examine
411 * \return result altitude value
413 double GetAltitudeForPoint( const double theCoordX,
414 const double theCoordY ) const [double ( const gp_XY& )];
416 gp_XY aPnt( a0, a1 );
418 Py_BEGIN_ALLOW_THREADS
419 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt ) :
420 sipCpp->GetAltitudeForPoint( aPnt );
425 * Returns altitude for given point on given region.
426 * \param thePoint the point to examine
427 * \param theRegion reference region to check
428 * \return result altitude value
430 double GetAltitudeForPoint( const double theCoordX,
431 const double theCoordY,
432 HYDROData_Region theRegion ) const
433 [double ( const gp_XY&, opencascade::handle<HYDROData_Region>& )];
435 gp_XY aPnt( a0, a1 );
436 Handle(HYDROData_Region) aRefRegion =
437 Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
439 Py_BEGIN_ALLOW_THREADS
440 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefRegion ) :
441 sipCpp->GetAltitudeForPoint( aPnt, aRefRegion );
446 * Returns altitude for given point on given zone.
447 * \param thePoint the point to examine
448 * \param theZone reference zone to check
449 * \return result altitude value
451 double GetAltitudeForPoint( const double theCoordX,
452 const double theCoordY,
453 HYDROData_Zone theZone ) const
454 [double ( const gp_XY&, opencascade::handle<HYDROData_Zone>& )];
456 gp_XY aPnt( a0, a1 );
457 Handle(HYDROData_Zone) aRefZone =
458 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
460 Py_BEGIN_ALLOW_THREADS
461 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefZone ) :
462 sipCpp->GetAltitudeForPoint( aPnt, aRefZone );
467 * Returns altitudes for given points on given region.
468 * \param thePoints the points to examine
469 * \param theZone reference region to check
470 * \return result altitude value
472 NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
473 const NCollection_Sequence<double>& theCoordsY,
474 HYDROData_Region theRegion,
475 int theMethod = 0) const
476 [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, opencascade::handle<HYDROData_Region>&, int)];
479 NCollection_Sequence<gp_XY> aPnts;
481 int aLen = qMin( a0->Length(), a1->Length() );
482 for ( int i = 1; i <= aLen; ++i )
484 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
485 aPnts.Append( aPnt );
488 Handle(HYDROData_Region) aRefRegion =
489 Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
492 NCollection_Sequence<double> aRes;
493 Py_BEGIN_ALLOW_THREADS
494 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefRegion, aMethod ) :
495 sipCpp->GetAltitudesForPoints( aPnts, aRefRegion, aMethod );
498 sipRes = new NCollection_Sequence<double>( aRes );
501 std::vector<double> GetStricklerCoefficientForPoints( const NCollection_Sequence<double>& theCoordsX,
502 const NCollection_Sequence<double>& theCoordsY,
505 [std::vector<double> ( const NCollection_Sequence<gp_XY>&, double, bool)];
507 std::vector<gp_XY> aPnts;
508 int aLen = qMin( a0->Length(), a1->Length() );
509 for ( int i = 1; i <= aLen; ++i )
511 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
512 aPnts.push_back( aPnt );
514 std::vector<double> aRes;
515 Py_BEGIN_ALLOW_THREADS
516 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetStricklerCoefficientForPoints( aPnts, a2, a3 ) :
517 sipCpp->GetStricklerCoefficientForPoints( aPnts, a2, a3 );
519 sipRes = new std::vector<double>( aRes );
523 std::vector<int> GetStricklerTypeForPoints( const NCollection_Sequence<double>& theCoordsX,
524 const NCollection_Sequence<double>& theCoordsY ) const
525 [std::vector<int>( const NCollection_Sequence<gp_XY>& )];
527 std::vector<gp_XY> aPnts;
528 int aLen = qMin( a0->Length(), a1->Length() );
529 for ( int i = 1; i <= aLen; ++i )
531 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
532 aPnts.push_back( aPnt );
534 std::vector<int> aRes;
535 Py_BEGIN_ALLOW_THREADS
536 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetStricklerTypeForPoints( aPnts ) :
537 sipCpp->GetStricklerTypeForPoints( aPnts );
539 sipRes = new std::vector<int>( aRes );
544 * Returns altitudes for given points on given zone.
545 * \param thePoints the points to examine
546 * \param theZone reference zone to check
547 * \return result altitude value
549 NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
550 const NCollection_Sequence<double>& theCoordsY,
551 HYDROData_Zone theZone,
552 int theMethod = 0) const
553 [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, opencascade::handle<HYDROData_Zone>&, int )];
556 NCollection_Sequence<gp_XY> aPnts;
558 int aLen = qMin( a0->Length(), a1->Length() );
559 for ( int i = 1; i <= aLen; ++i )
561 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
562 aPnts.Append( aPnt );
565 Handle(HYDROData_Zone) aRefZone =
566 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
569 NCollection_Sequence<double> aRes;
570 Py_BEGIN_ALLOW_THREADS
571 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefZone, aMethod ) :
572 sipCpp->GetAltitudesForPoints( aPnts, aRefZone, aMethod );
575 sipRes = new NCollection_Sequence<double>( aRes );
579 * Returns region to which the point is belongs.
580 * \param thePoint the point to examine
581 * \return result region
583 HYDROData_Region GetRegionFromPoint( const double theCoordX,
584 const double theCoordY ) const
585 [opencascade::handle<HYDROData_Region> ( const gp_XY& )];
587 Handle(HYDROData_Region) aRes;
589 gp_XY aPnt( a0, a1 );
591 Py_BEGIN_ALLOW_THREADS
592 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetRegionFromPoint( aPnt ) :
593 sipCpp->GetRegionFromPoint( aPnt );
596 sipRes = (HYDROData_Region*)createPointer( aRes );
600 * Returns zone to which the point is belongs.
601 * \param thePoint the point to examine
602 * \return result zone
604 HYDROData_Zone GetZoneFromPoint( const double theCoordX,
605 const double theCoordY ) const
606 [opencascade::handle<HYDROData_Zone> ( const gp_XY& )];
608 Handle(HYDROData_Zone) aRes;
610 gp_XY aPnt( a0, a1 );
612 Py_BEGIN_ALLOW_THREADS
613 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetZoneFromPoint( aPnt ) :
614 sipCpp->GetZoneFromPoint( aPnt );
617 sipRes = (HYDROData_Zone*)createPointer( aRes );
621 * Returns classification of point for given zone.
622 * \param thePoint the point to examine
623 * \param theZone the zone to examine
624 * \return result classification
626 PointClassification GetPointClassification( const double theCoordX,
627 const double theCoordY,
628 HYDROData_Zone theZone ) const
629 [PointClassification ( const gp_XY&, opencascade::handle<HYDROData_Zone>& )];
631 gp_XY aPnt( a0, a1 );
633 Handle(HYDROData_Zone) aRef =
634 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
636 Py_BEGIN_ALLOW_THREADS
637 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetPointClassification( aPnt, aRef ) :
638 sipCpp->GetPointClassification( aPnt, aRef );
643 void ClearRules( HYDROData_CalculationCase::DataTag theDataTag );
645 void AddRule( HYDROData_Entity theObject1,
646 HYDROData_PriorityType thePriority,
647 HYDROData_Entity theObject2,
648 HYDROData_Zone::MergeType theMergeType,
649 HYDROData_CalculationCase::DataTag theDataTag )
650 [void ( const opencascade::handle<HYDROData_Entity>&, HYDROData_PriorityType, opencascade::handle<HYDROData_Entity>&, HYDROData_Zone::MergeType, HYDROData_CalculationCase::DataTag )];
652 Handle(HYDROData_Entity) anObject1 = createHandle( a0 );
653 Handle(HYDROData_Entity) anObject2 = createHandle( a2 );
655 Py_BEGIN_ALLOW_THREADS
656 sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRule( anObject1, a1, anObject2, a3, a4 ) :
657 sipCpp->AddRule( anObject1, a1, anObject2, a3, a4 );
663 void SetAssignmentMode( AssignmentMode theMode );
664 AssignmentMode GetAssignmentMode() const;
669 * Creates new object in the internal data structure. Use higher level objects
670 * to create objects with real content.
672 HYDROData_CalculationCase();
675 * Destructs properties of the object and object itself, removes it from the document.
677 ~HYDROData_CalculationCase();