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_SplittedGroups, ///< reference splitted groups
76 DataTag_CustomRules, ///< custom rules
77 DataTag_AssignmentMode, ///< assignment mode
78 DataTag_StricklerTable, ///< reference Strickler table
79 DataTag_LandCover, ///< reference land covers
80 DataTag_CustomLandCoverRules, ///< custom rules for land covers priority
81 DataTag_AssignmentLandCoverMode, ///< assignment mode of land covers priority
82 DataTag_ChildLandCoverRegion, ///< child land cover regions
83 DataTag_LandCoverRegion ///< reference land cover regions
88 * Add new one reference geometry object for calculation case.
90 bool AddGeometryObject( HYDROData_Object theObject ) [bool ( const 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 ) [void ( const Handle_HYDROData_Object& )];
113 Handle(HYDROData_Object) aRef =
114 Handle(HYDROData_Object)::DownCast( createHandle( a0 ) );
115 if ( !aRef.IsNull() )
117 Py_BEGIN_ALLOW_THREADS
118 if ( sipSelfWasArg ) {
119 sipCpp->HYDROData_CalculationCase::RemoveGeometryObject( aRef );
121 sipCpp->RemoveGeometryObject( aRef );
128 * Removes all reference geometry objects from calculation case.
130 void RemoveGeometryObjects();
134 * Add new one reference geometry group for calculation case.
136 bool AddGeometryGroup( HYDROData_ShapesGroup theGroup ) [bool ( const Handle_HYDROData_ShapesGroup& )];
138 Handle(HYDROData_ShapesGroup) aRef =
139 Handle(HYDROData_ShapesGroup)::DownCast( createHandle( a0 ) );
140 if ( !aRef.IsNull() )
142 Py_BEGIN_ALLOW_THREADS
143 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddGeometryGroup( aRef ):
144 sipCpp->AddGeometryGroup( aRef );
150 * Returns all reference geometry groups of calculation case.
152 HYDROData_SequenceOfObjects GetGeometryGroups() const;
155 * Removes reference geometry group from calculation case.
157 void RemoveGeometryGroup( HYDROData_ShapesGroup theGroup ) [void ( const Handle_HYDROData_ShapesGroup& )];
159 Handle(HYDROData_ShapesGroup) aRef =
160 Handle(HYDROData_ShapesGroup)::DownCast( createHandle( a0 ) );
161 if ( !aRef.IsNull() )
163 Py_BEGIN_ALLOW_THREADS
164 if ( sipSelfWasArg ) {
165 sipCpp->HYDROData_CalculationCase::RemoveGeometryGroup( aRef );
167 sipCpp->RemoveGeometryGroup( aRef );
174 * Removes all reference geometry groups from calculation case.
176 void RemoveGeometryGroups();
180 * Sets reference boundary polyline object for calculation case.
182 void SetBoundaryPolyline( HYDROData_PolylineXY thePolyline ) [void ( const Handle_HYDROData_PolylineXY& )];
184 Handle(HYDROData_PolylineXY) aRef =
185 Handle(HYDROData_PolylineXY)::DownCast( createHandle( a0 ) );
186 if ( !aRef.IsNull() )
188 Py_BEGIN_ALLOW_THREADS
189 if ( sipSelfWasArg ) {
190 sipCpp->HYDROData_CalculationCase::SetBoundaryPolyline( aRef );
192 sipCpp->SetBoundaryPolyline( aRef );
199 * Returns reference boundary polyline object of calculation case.
201 HYDROData_PolylineXY GetBoundaryPolyline() const [Handle_HYDROData_PolylineXY ()];
203 Handle(HYDROData_PolylineXY) aRef;
205 Py_BEGIN_ALLOW_THREADS
206 aRef = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetBoundaryPolyline() :
207 sipCpp->GetBoundaryPolyline();
210 sipRes = (HYDROData_PolylineXY*)createPointer( aRef );
214 * Remove reference boundary polyline object from calculation case.
216 void RemoveBoundaryPolyline();
220 * Add new one child region for calculation case.
221 * The new region is added into the list of reference regions.
222 * The label of theZone is changed during this operation
223 * because of new region becomes the new parent for this zone.
225 HYDROData_Region AddNewRegion( HYDROData_Zone theZone, const bool theLandCover ) [Handle_HYDROData_Region ( const Handle_HYDROData_Zone&, const bool )];
227 Handle(HYDROData_Zone) aRef =
228 Handle(HYDROData_Zone)::DownCast( createHandle( a0 ) );
229 Handle(HYDROData_Region) aRes;
231 if ( !aRef.IsNull() )
233 Py_BEGIN_ALLOW_THREADS
234 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddNewRegion( aRef, a1 ) :
235 sipCpp->AddNewRegion( aRef, a1 );
239 sipRes = (HYDROData_Region*)createPointer( aRes );
243 * Add new one reference region for calculation case.
244 * The label of theRegion is changed in case if old parent is not this calculation.
246 bool AddRegion( HYDROData_Region theRegion, const bool theLandCover ) [bool ( const Handle_HYDROData_Region&, const bool )];
248 Handle(HYDROData_Region) aRef =
249 Handle(HYDROData_Region)::DownCast( createHandle( a0 ) );
250 if ( !aRef.IsNull() )
252 Py_BEGIN_ALLOW_THREADS
253 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRegion( aRef, a1 ):
254 sipCpp->AddRegion( aRef, a1 );
260 * Returns all reference regions of calculation case.
262 HYDROData_SequenceOfObjects GetRegions( const bool theLandCover ) const;
265 * Updates names of regions to correct order.
267 void UpdateRegionsOrder();
270 * Removes reference region from calculation case.
272 void RemoveRegion( HYDROData_Region theRegion, const bool theLandCover ) [void ( const Handle_HYDROData_Region&, const bool )];
274 Handle(HYDROData_Region) aRef =
275 Handle(HYDROData_Region)::DownCast( createHandle( a0 ) );
276 if ( !aRef.IsNull() )
278 Py_BEGIN_ALLOW_THREADS
279 if ( sipSelfWasArg ) {
280 sipCpp->HYDROData_CalculationCase::RemoveRegion( aRef, a1 );
282 sipCpp->RemoveRegion( aRef, a1 );
289 * Removes all reference regions from calculation case.
291 void RemoveRegions( const bool theLandCover );
295 * Returns all reference geometry groups of calculation case.
297 HYDROData_SequenceOfObjects GetSplittedGroups() const;
300 * Removes all reference geometry groups from calculation case.
302 void RemoveSplittedGroups();
306 * Exports the calculation case data (shell and groups) to GEOM module.
307 * \param theGeomEngine GEOM module engine
308 * \param theStudy SALOMEDS study, is used for publishing of GEOM objects
309 * \return true in case of success
311 //TODO: virtual bool Export( GEOM::GEOM_Gen_var theGeomEngine,
312 // SALOMEDS::Study_ptr theStudy );
314 QString Export( int theStudyId ) const;
317 // Public methods to work with Calculation services
320 * Returns altitude for given point.
321 * \param thePoint the point to examine
322 * \return result altitude value
324 double GetAltitudeForPoint( const double theCoordX,
325 const double theCoordY ) const [double ( const gp_XY& )];
327 gp_XY aPnt( a0, a1 );
329 Py_BEGIN_ALLOW_THREADS
330 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt ) :
331 sipCpp->GetAltitudeForPoint( aPnt );
336 * Returns altitude for given point on given region.
337 * \param thePoint the point to examine
338 * \param theRegion reference region to check
339 * \return result altitude value
341 double GetAltitudeForPoint( const double theCoordX,
342 const double theCoordY,
343 HYDROData_Region theRegion ) const
344 [double ( const gp_XY&, const Handle_HYDROData_Region& )];
346 gp_XY aPnt( a0, a1 );
347 Handle(HYDROData_Region) aRefRegion =
348 Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
350 Py_BEGIN_ALLOW_THREADS
351 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefRegion ) :
352 sipCpp->GetAltitudeForPoint( aPnt, aRefRegion );
357 * Returns altitude for given point on given zone.
358 * \param thePoint the point to examine
359 * \param theZone reference zone to check
360 * \return result altitude value
362 double GetAltitudeForPoint( const double theCoordX,
363 const double theCoordY,
364 HYDROData_Zone theZone ) const
365 [double ( const gp_XY&, const Handle_HYDROData_Zone& )];
367 gp_XY aPnt( a0, a1 );
368 Handle(HYDROData_Zone) aRefZone =
369 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
371 Py_BEGIN_ALLOW_THREADS
372 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefZone ) :
373 sipCpp->GetAltitudeForPoint( aPnt, aRefZone );
378 * Returns altitudes for given points on given region.
379 * \param thePoints the points to examine
380 * \param theZone reference region to check
381 * \return result altitude value
383 NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
384 const NCollection_Sequence<double>& theCoordsY,
385 HYDROData_Region theRegion ) const
386 [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, const Handle_HYDROData_Region& )];
389 NCollection_Sequence<gp_XY> aPnts;
391 int aLen = qMin( a0->Length(), a1->Length() );
392 for ( int i = 1; i <= aLen; ++i )
394 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
395 aPnts.Append( aPnt );
398 Handle(HYDROData_Region) aRefRegion =
399 Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
401 NCollection_Sequence<double> aRes;
402 Py_BEGIN_ALLOW_THREADS
403 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefRegion ) :
404 sipCpp->GetAltitudesForPoints( aPnts, aRefRegion );
407 sipRes = new NCollection_Sequence<double>( aRes );
411 * Returns altitudes for given points on given zone.
412 * \param thePoints the points to examine
413 * \param theZone reference zone to check
414 * \return result altitude value
416 NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
417 const NCollection_Sequence<double>& theCoordsY,
418 HYDROData_Zone theZone ) const
419 [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, const Handle_HYDROData_Zone& )];
422 NCollection_Sequence<gp_XY> aPnts;
424 int aLen = qMin( a0->Length(), a1->Length() );
425 for ( int i = 1; i <= aLen; ++i )
427 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
428 aPnts.Append( aPnt );
431 Handle(HYDROData_Zone) aRefZone =
432 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
434 NCollection_Sequence<double> aRes;
435 Py_BEGIN_ALLOW_THREADS
436 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefZone ) :
437 sipCpp->GetAltitudesForPoints( aPnts, aRefZone );
440 sipRes = new NCollection_Sequence<double>( aRes );
444 * Returns region to which the point is belongs.
445 * \param thePoint the point to examine
446 * \return result region
448 HYDROData_Region GetRegionFromPoint( const double theCoordX,
449 const double theCoordY,
450 const bool theLandCover ) const
451 [Handle_HYDROData_Region ( const gp_XY&, const bool )];
453 Handle(HYDROData_Region) aRes;
455 gp_XY aPnt( a0, a1 );
457 Py_BEGIN_ALLOW_THREADS
458 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetRegionFromPoint( aPnt, a2 ) :
459 sipCpp->GetRegionFromPoint( aPnt, a2 );
462 sipRes = (HYDROData_Region*)createPointer( aRes );
466 * Returns zone to which the point is belongs.
467 * \param thePoint the point to examine
468 * \return result zone
470 HYDROData_Zone GetZoneFromPoint( const double theCoordX,
471 const double theCoordY,
472 const bool theLandCover ) const
473 [Handle_HYDROData_Zone ( const gp_XY&, const bool )];
475 Handle(HYDROData_Zone) aRes;
477 gp_XY aPnt( a0, a1 );
479 Py_BEGIN_ALLOW_THREADS
480 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetZoneFromPoint( aPnt, a2 ) :
481 sipCpp->GetZoneFromPoint( aPnt, a2 );
484 sipRes = (HYDROData_Zone*)createPointer( aRes );
488 * Returns classification of point for given zone.
489 * \param thePoint the point to examine
490 * \param theZone the zone to examine
491 * \return result classification
493 PointClassification GetPointClassification( const double theCoordX,
494 const double theCoordY,
495 HYDROData_Zone theZone ) const
496 [PointClassification ( const gp_XY&, const Handle_HYDROData_Zone& )];
498 gp_XY aPnt( a0, a1 );
500 Handle(HYDROData_Zone) aRef =
501 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
503 Py_BEGIN_ALLOW_THREADS
504 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetPointClassification( aPnt, aRef ) :
505 sipCpp->GetPointClassification( aPnt, aRef );
510 void ClearRules( HYDROData_CalculationCase::DataTag theDataTag );
512 void AddRule( HYDROData_Entity theObject1,
513 HYDROData_PriorityType thePriority,
514 HYDROData_Entity theObject2,
515 HYDROData_Zone::MergeType theMergeType,
516 HYDROData_CalculationCase::DataTag theDataTag )
517 [void ( const Handle_HYDROData_Entity&, HYDROData_PriorityType, const Handle_HYDROData_Entity&, HYDROData_Zone::MergeType, HYDROData_CalculationCase::DataTag )];
519 Handle(HYDROData_Entity) anObject1 =
520 Handle(HYDROData_Entity)::DownCast( createHandle( a0 ) );
521 Handle(HYDROData_Entity) anObject2 =
522 Handle(HYDROData_Entity)::DownCast( createHandle( a2 ) );
524 Py_BEGIN_ALLOW_THREADS
525 sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRule( anObject1, a1, anObject2, a3, a4 ) :
526 sipCpp->AddRule( anObject1, a1, anObject2, a3, a4 );
531 QString DumpLandCoverRules();
533 void SetAssignmentMode( AssignmentMode theMode );
534 AssignmentMode GetAssignmentMode() const;
536 void SetAssignmentLandCoverMode( AssignmentMode theMode );
537 AssignmentMode GetAssignmentLandCoverMode() const;
542 * Creates new object in the internal data structure. Use higher level objects
543 * to create objects with real content.
545 HYDROData_CalculationCase();
548 * Destructs properties of the object and object itself, removes it from the document.
550 ~HYDROData_CalculationCase();