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 * Sets reference boundary polyline object for calculation case.
183 void SetBoundaryPolyline( HYDROData_PolylineXY thePolyline ) [void ( opencascade::handle<HYDROData_PolylineXY>& )];
185 Handle(HYDROData_PolylineXY) aRef =
186 Handle(HYDROData_PolylineXY)::DownCast( createHandle( a0 ) );
187 if ( !aRef.IsNull() )
189 Py_BEGIN_ALLOW_THREADS
190 if ( sipSelfWasArg ) {
191 sipCpp->HYDROData_CalculationCase::SetBoundaryPolyline( aRef );
193 sipCpp->SetBoundaryPolyline( aRef );
200 * Returns reference boundary polyline object of calculation case.
202 HYDROData_PolylineXY GetBoundaryPolyline() const [opencascade::handle<HYDROData_PolylineXY> ()];
204 Handle(HYDROData_PolylineXY) aRef;
206 Py_BEGIN_ALLOW_THREADS
207 aRef = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetBoundaryPolyline() :
208 sipCpp->GetBoundaryPolyline();
211 sipRes = (HYDROData_PolylineXY*)createPointer( aRef );
215 * Remove reference boundary polyline object from calculation case.
217 void RemoveBoundaryPolyline();
219 void SetLandCoverMap( HYDROData_LandCoverMap theLandCoverMap ) [void ( const opencascade::handle<HYDROData_LandCoverMap>& )];
221 Handle(HYDROData_LandCoverMap) aRef =
222 Handle(HYDROData_LandCoverMap)::DownCast( createHandle( a0 ) );
223 if ( !aRef.IsNull() )
225 Py_BEGIN_ALLOW_THREADS
226 if ( sipSelfWasArg ) {
227 sipCpp->HYDROData_CalculationCase::SetLandCoverMap( aRef );
229 sipCpp->SetLandCoverMap( aRef );
235 void SetStricklerTable( HYDROData_StricklerTable theStricklerTable ) [void ( const opencascade::handle<HYDROData_StricklerTable>& )];
237 Handle(HYDROData_StricklerTable) aRef =
238 Handle(HYDROData_StricklerTable)::DownCast( createHandle( a0 ) );
239 if ( !aRef.IsNull() )
241 Py_BEGIN_ALLOW_THREADS
242 if ( sipSelfWasArg ) {
243 sipCpp->HYDROData_CalculationCase::SetStricklerTable( aRef );
245 sipCpp->SetStricklerTable( aRef );
252 * Add new one child region for calculation case.
253 * The new region is added into the list of reference regions.
254 * The label of theZone is changed during this operation
255 * because of new region becomes the new parent for this zone.
257 HYDROData_Region AddNewRegion( HYDROData_Zone theZone ) [opencascade::handle<HYDROData_Region> ( opencascade::handle<HYDROData_Zone>& )];
259 Handle(HYDROData_Zone) aRef =
260 Handle(HYDROData_Zone)::DownCast( createHandle( a0 ) );
261 Handle(HYDROData_Region) aRes;
263 if ( !aRef.IsNull() )
265 Py_BEGIN_ALLOW_THREADS
266 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddNewRegion( aRef ) :
267 sipCpp->AddNewRegion( aRef );
271 sipRes = (HYDROData_Region*)createPointer( aRes );
275 * Add new one reference region for calculation case.
276 * The label of theRegion is changed in case if old parent is not this calculation.
278 bool AddRegion( HYDROData_Region theRegion ) [bool ( opencascade::handle<HYDROData_Region>& )];
280 Handle(HYDROData_Region) aRef =
281 Handle(HYDROData_Region)::DownCast( createHandle( a0 ) );
282 if ( !aRef.IsNull() )
284 Py_BEGIN_ALLOW_THREADS
285 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRegion( aRef ):
286 sipCpp->AddRegion( aRef );
292 * Returns all reference regions of calculation case.
294 HYDROData_SequenceOfObjects GetRegions() const;
297 * Updates names of regions to correct order.
299 void UpdateRegionsOrder();
302 * Removes reference region from calculation case.
304 void RemoveRegion( HYDROData_Region theRegion ) [void ( opencascade::handle<HYDROData_Region>& )];
306 Handle(HYDROData_Region) aRef =
307 Handle(HYDROData_Region)::DownCast( createHandle( a0 ) );
308 if ( !aRef.IsNull() )
310 Py_BEGIN_ALLOW_THREADS
311 if ( sipSelfWasArg ) {
312 sipCpp->HYDROData_CalculationCase::RemoveRegion( aRef );
314 sipCpp->RemoveRegion( aRef );
321 * Removes all reference regions from calculation case.
323 void RemoveRegions();
327 * Returns all reference geometry groups of calculation case.
329 HYDROData_SequenceOfObjects GetSplitGroups() const;
332 * Removes all reference geometry groups from calculation case.
334 void RemoveSplitGroups();
338 * Exports the calculation case data (shell and groups) to GEOM module.
339 * \param theGeomEngine GEOM module engine
340 * \param theStudy SALOMEDS study, is used for publishing of GEOM objects
341 * \return true in case of success
343 //TODO: virtual bool Export( GEOM::GEOM_Gen_var theGeomEngine,
344 // SALOMEDS::Study_ptr theStudy );
346 QString Export( int theStudyId ) const;
349 // Public methods to work with Calculation services
352 * Returns strickler coefficient for given point.
353 * \param thePoint the point to examine
354 * \return result strickler coefficient
356 double GetStricklerCoefficientForPoint( const double theCoordX,
357 const double theCoordY ) const [double ( const gp_XY& ) ];
359 gp_XY aPnt( a0, a1 );
361 Py_BEGIN_ALLOW_THREADS
362 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetStricklerCoefficientForPoint( aPnt ) :
363 sipCpp->GetStricklerCoefficientForPoint( aPnt );
368 * Returns altitude for given point.
369 * \param thePoint the point to examine
370 * \return result altitude value
372 double GetAltitudeForPoint( const double theCoordX,
373 const double theCoordY ) const [double ( const gp_XY& )];
375 gp_XY aPnt( a0, a1 );
377 Py_BEGIN_ALLOW_THREADS
378 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt ) :
379 sipCpp->GetAltitudeForPoint( aPnt );
384 * Returns altitude for given point on given region.
385 * \param thePoint the point to examine
386 * \param theRegion reference region to check
387 * \return result altitude value
389 double GetAltitudeForPoint( const double theCoordX,
390 const double theCoordY,
391 HYDROData_Region theRegion ) const
392 [double ( const gp_XY&, opencascade::handle<HYDROData_Region>& )];
394 gp_XY aPnt( a0, a1 );
395 Handle(HYDROData_Region) aRefRegion =
396 Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
398 Py_BEGIN_ALLOW_THREADS
399 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefRegion ) :
400 sipCpp->GetAltitudeForPoint( aPnt, aRefRegion );
405 * Returns altitude for given point on given zone.
406 * \param thePoint the point to examine
407 * \param theZone reference zone to check
408 * \return result altitude value
410 double GetAltitudeForPoint( const double theCoordX,
411 const double theCoordY,
412 HYDROData_Zone theZone ) const
413 [double ( const gp_XY&, opencascade::handle<HYDROData_Zone>& )];
415 gp_XY aPnt( a0, a1 );
416 Handle(HYDROData_Zone) aRefZone =
417 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
419 Py_BEGIN_ALLOW_THREADS
420 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefZone ) :
421 sipCpp->GetAltitudeForPoint( aPnt, aRefZone );
426 * Returns altitudes for given points on given region.
427 * \param thePoints the points to examine
428 * \param theZone reference region to check
429 * \return result altitude value
431 NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
432 const NCollection_Sequence<double>& theCoordsY,
433 HYDROData_Region theRegion,
434 int theMethod = 0) const
435 [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, opencascade::handle<HYDROData_Region>&, int)];
438 NCollection_Sequence<gp_XY> aPnts;
440 int aLen = qMin( a0->Length(), a1->Length() );
441 for ( int i = 1; i <= aLen; ++i )
443 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
444 aPnts.Append( aPnt );
447 Handle(HYDROData_Region) aRefRegion =
448 Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
451 NCollection_Sequence<double> aRes;
452 Py_BEGIN_ALLOW_THREADS
453 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefRegion, aMethod ) :
454 sipCpp->GetAltitudesForPoints( aPnts, aRefRegion, aMethod );
457 sipRes = new NCollection_Sequence<double>( aRes );
460 std::vector<double> GetStricklerCoefficientForPoints( const NCollection_Sequence<double>& theCoordsX,
461 const NCollection_Sequence<double>& theCoordsY,
464 [std::vector<double> ( const NCollection_Sequence<gp_XY>&, double, bool)];
466 std::vector<gp_XY> aPnts;
467 int aLen = qMin( a0->Length(), a1->Length() );
468 for ( int i = 1; i <= aLen; ++i )
470 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
471 aPnts.push_back( aPnt );
473 std::vector<double> aRes;
474 Py_BEGIN_ALLOW_THREADS
475 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetStricklerCoefficientForPoints( aPnts, a2, a3 ) :
476 sipCpp->GetStricklerCoefficientForPoints( aPnts, a2, a3 );
478 sipRes = new std::vector<double>( aRes );
482 std::vector<int> GetStricklerTypeForPoints( const NCollection_Sequence<double>& theCoordsX,
483 const NCollection_Sequence<double>& theCoordsY ) const
484 [std::vector<int>( const NCollection_Sequence<gp_XY>& )];
486 std::vector<gp_XY> aPnts;
487 int aLen = qMin( a0->Length(), a1->Length() );
488 for ( int i = 1; i <= aLen; ++i )
490 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
491 aPnts.push_back( aPnt );
493 std::vector<int> aRes;
494 Py_BEGIN_ALLOW_THREADS
495 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetStricklerTypeForPoints( aPnts ) :
496 sipCpp->GetStricklerTypeForPoints( aPnts );
498 sipRes = new std::vector<int>( aRes );
503 * Returns altitudes for given points on given zone.
504 * \param thePoints the points to examine
505 * \param theZone reference zone to check
506 * \return result altitude value
508 NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
509 const NCollection_Sequence<double>& theCoordsY,
510 HYDROData_Zone theZone,
511 int theMethod = 0) const
512 [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, opencascade::handle<HYDROData_Zone>&, int )];
515 NCollection_Sequence<gp_XY> aPnts;
517 int aLen = qMin( a0->Length(), a1->Length() );
518 for ( int i = 1; i <= aLen; ++i )
520 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
521 aPnts.Append( aPnt );
524 Handle(HYDROData_Zone) aRefZone =
525 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
528 NCollection_Sequence<double> aRes;
529 Py_BEGIN_ALLOW_THREADS
530 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefZone, aMethod ) :
531 sipCpp->GetAltitudesForPoints( aPnts, aRefZone, aMethod );
534 sipRes = new NCollection_Sequence<double>( aRes );
538 * Returns region to which the point is belongs.
539 * \param thePoint the point to examine
540 * \return result region
542 HYDROData_Region GetRegionFromPoint( const double theCoordX,
543 const double theCoordY ) const
544 [opencascade::handle<HYDROData_Region> ( const gp_XY& )];
546 Handle(HYDROData_Region) aRes;
548 gp_XY aPnt( a0, a1 );
550 Py_BEGIN_ALLOW_THREADS
551 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetRegionFromPoint( aPnt ) :
552 sipCpp->GetRegionFromPoint( aPnt );
555 sipRes = (HYDROData_Region*)createPointer( aRes );
559 * Returns zone to which the point is belongs.
560 * \param thePoint the point to examine
561 * \return result zone
563 HYDROData_Zone GetZoneFromPoint( const double theCoordX,
564 const double theCoordY ) const
565 [opencascade::handle<HYDROData_Zone> ( const gp_XY& )];
567 Handle(HYDROData_Zone) aRes;
569 gp_XY aPnt( a0, a1 );
571 Py_BEGIN_ALLOW_THREADS
572 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetZoneFromPoint( aPnt ) :
573 sipCpp->GetZoneFromPoint( aPnt );
576 sipRes = (HYDROData_Zone*)createPointer( aRes );
580 * Returns classification of point for given zone.
581 * \param thePoint the point to examine
582 * \param theZone the zone to examine
583 * \return result classification
585 PointClassification GetPointClassification( const double theCoordX,
586 const double theCoordY,
587 HYDROData_Zone theZone ) const
588 [PointClassification ( const gp_XY&, opencascade::handle<HYDROData_Zone>& )];
590 gp_XY aPnt( a0, a1 );
592 Handle(HYDROData_Zone) aRef =
593 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
595 Py_BEGIN_ALLOW_THREADS
596 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetPointClassification( aPnt, aRef ) :
597 sipCpp->GetPointClassification( aPnt, aRef );
602 void ClearRules( HYDROData_CalculationCase::DataTag theDataTag );
604 void AddRule( HYDROData_Entity theObject1,
605 HYDROData_PriorityType thePriority,
606 HYDROData_Entity theObject2,
607 HYDROData_Zone::MergeType theMergeType,
608 HYDROData_CalculationCase::DataTag theDataTag )
609 [void ( const opencascade::handle<HYDROData_Entity>&, HYDROData_PriorityType, opencascade::handle<HYDROData_Entity>&, HYDROData_Zone::MergeType, HYDROData_CalculationCase::DataTag )];
611 Handle(HYDROData_Entity) anObject1 = createHandle( a0 );
612 Handle(HYDROData_Entity) anObject2 = createHandle( a2 );
614 Py_BEGIN_ALLOW_THREADS
615 sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRule( anObject1, a1, anObject2, a3, a4 ) :
616 sipCpp->AddRule( anObject1, a1, anObject2, a3, a4 );
622 void SetAssignmentMode( AssignmentMode theMode );
623 AssignmentMode GetAssignmentMode() const;
628 * Creates new object in the internal data structure. Use higher level objects
629 * to create objects with real content.
631 HYDROData_CalculationCase();
634 * Destructs properties of the object and object itself, removes it from the document.
636 ~HYDROData_CalculationCase();