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 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 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 );
483 * Returns altitudes for given points on given zone.
484 * \param thePoints the points to examine
485 * \param theZone reference zone to check
486 * \return result altitude value
488 NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
489 const NCollection_Sequence<double>& theCoordsY,
490 HYDROData_Zone theZone,
491 int theMethod = 0) const
492 [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, opencascade::handle<HYDROData_Zone>&, int )];
495 NCollection_Sequence<gp_XY> aPnts;
497 int aLen = qMin( a0->Length(), a1->Length() );
498 for ( int i = 1; i <= aLen; ++i )
500 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
501 aPnts.Append( aPnt );
504 Handle(HYDROData_Zone) aRefZone =
505 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
508 NCollection_Sequence<double> aRes;
509 Py_BEGIN_ALLOW_THREADS
510 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefZone, aMethod ) :
511 sipCpp->GetAltitudesForPoints( aPnts, aRefZone, aMethod );
514 sipRes = new NCollection_Sequence<double>( aRes );
518 * Returns region to which the point is belongs.
519 * \param thePoint the point to examine
520 * \return result region
522 HYDROData_Region GetRegionFromPoint( const double theCoordX,
523 const double theCoordY ) const
524 [opencascade::handle<HYDROData_Region> ( const gp_XY& )];
526 Handle(HYDROData_Region) aRes;
528 gp_XY aPnt( a0, a1 );
530 Py_BEGIN_ALLOW_THREADS
531 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetRegionFromPoint( aPnt ) :
532 sipCpp->GetRegionFromPoint( aPnt );
535 sipRes = (HYDROData_Region*)createPointer( aRes );
539 * Returns zone to which the point is belongs.
540 * \param thePoint the point to examine
541 * \return result zone
543 HYDROData_Zone GetZoneFromPoint( const double theCoordX,
544 const double theCoordY ) const
545 [opencascade::handle<HYDROData_Zone> ( const gp_XY& )];
547 Handle(HYDROData_Zone) aRes;
549 gp_XY aPnt( a0, a1 );
551 Py_BEGIN_ALLOW_THREADS
552 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetZoneFromPoint( aPnt ) :
553 sipCpp->GetZoneFromPoint( aPnt );
556 sipRes = (HYDROData_Zone*)createPointer( aRes );
560 * Returns classification of point for given zone.
561 * \param thePoint the point to examine
562 * \param theZone the zone to examine
563 * \return result classification
565 PointClassification GetPointClassification( const double theCoordX,
566 const double theCoordY,
567 HYDROData_Zone theZone ) const
568 [PointClassification ( const gp_XY&, opencascade::handle<HYDROData_Zone>& )];
570 gp_XY aPnt( a0, a1 );
572 Handle(HYDROData_Zone) aRef =
573 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
575 Py_BEGIN_ALLOW_THREADS
576 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetPointClassification( aPnt, aRef ) :
577 sipCpp->GetPointClassification( aPnt, aRef );
582 void ClearRules( HYDROData_CalculationCase::DataTag theDataTag );
584 void AddRule( HYDROData_Entity theObject1,
585 HYDROData_PriorityType thePriority,
586 HYDROData_Entity theObject2,
587 HYDROData_Zone::MergeType theMergeType,
588 HYDROData_CalculationCase::DataTag theDataTag )
589 [void ( const opencascade::handle<HYDROData_Entity>&, HYDROData_PriorityType, opencascade::handle<HYDROData_Entity>&, HYDROData_Zone::MergeType, HYDROData_CalculationCase::DataTag )];
591 Handle(HYDROData_Entity) anObject1 = createHandle( a0 );
592 Handle(HYDROData_Entity) anObject2 = createHandle( a2 );
594 Py_BEGIN_ALLOW_THREADS
595 sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRule( anObject1, a1, anObject2, a3, a4 ) :
596 sipCpp->AddRule( anObject1, a1, anObject2, a3, a4 );
602 void SetAssignmentMode( AssignmentMode theMode );
603 AssignmentMode GetAssignmentMode() const;
608 * Creates new object in the internal data structure. Use higher level objects
609 * to create objects with real content.
611 HYDROData_CalculationCase();
614 * Destructs properties of the object and object itself, removes it from the document.
616 ~HYDROData_CalculationCase();