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
86 * Add new one reference geometry object for calculation case.
88 bool AddGeometryObject( HYDROData_Object theObject ) [bool ( const Handle_HYDROData_Object& )];
90 Handle(HYDROData_Object) aRef =
91 Handle(HYDROData_Object)::DownCast( createHandle( a0 ) );
94 Py_BEGIN_ALLOW_THREADS
95 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddGeometryObject( aRef ):
96 sipCpp->AddGeometryObject( aRef );
102 * Returns all reference geometry objects of calculation case.
104 HYDROData_SequenceOfObjects GetGeometryObjects() const;
107 * Removes reference geometry object from calculation case.
109 void RemoveGeometryObject( HYDROData_Object theObject ) [void ( const Handle_HYDROData_Object& )];
111 Handle(HYDROData_Object) aRef =
112 Handle(HYDROData_Object)::DownCast( createHandle( a0 ) );
113 if ( !aRef.IsNull() )
115 Py_BEGIN_ALLOW_THREADS
116 if ( sipSelfWasArg ) {
117 sipCpp->HYDROData_CalculationCase::RemoveGeometryObject( aRef );
119 sipCpp->RemoveGeometryObject( aRef );
126 * Removes all reference geometry objects from calculation case.
128 void RemoveGeometryObjects();
132 * Add new one reference geometry group for calculation case.
134 bool AddGeometryGroup( HYDROData_ShapesGroup theGroup ) [bool ( const Handle_HYDROData_ShapesGroup& )];
136 Handle(HYDROData_ShapesGroup) aRef =
137 Handle(HYDROData_ShapesGroup)::DownCast( createHandle( a0 ) );
138 if ( !aRef.IsNull() )
140 Py_BEGIN_ALLOW_THREADS
141 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddGeometryGroup( aRef ):
142 sipCpp->AddGeometryGroup( aRef );
148 * Returns all reference geometry groups of calculation case.
150 HYDROData_SequenceOfObjects GetGeometryGroups() const;
153 * Removes reference geometry group from calculation case.
155 void RemoveGeometryGroup( HYDROData_ShapesGroup theGroup ) [void ( const Handle_HYDROData_ShapesGroup& )];
157 Handle(HYDROData_ShapesGroup) aRef =
158 Handle(HYDROData_ShapesGroup)::DownCast( createHandle( a0 ) );
159 if ( !aRef.IsNull() )
161 Py_BEGIN_ALLOW_THREADS
162 if ( sipSelfWasArg ) {
163 sipCpp->HYDROData_CalculationCase::RemoveGeometryGroup( aRef );
165 sipCpp->RemoveGeometryGroup( aRef );
172 * Removes all reference geometry groups from calculation case.
174 void RemoveGeometryGroups();
178 * Sets reference boundary polyline object for calculation case.
180 void SetBoundaryPolyline( HYDROData_PolylineXY thePolyline ) [void ( const Handle_HYDROData_PolylineXY& )];
182 Handle(HYDROData_PolylineXY) aRef =
183 Handle(HYDROData_PolylineXY)::DownCast( createHandle( a0 ) );
184 if ( !aRef.IsNull() )
186 Py_BEGIN_ALLOW_THREADS
187 if ( sipSelfWasArg ) {
188 sipCpp->HYDROData_CalculationCase::SetBoundaryPolyline( aRef );
190 sipCpp->SetBoundaryPolyline( aRef );
197 * Returns reference boundary polyline object of calculation case.
199 HYDROData_PolylineXY GetBoundaryPolyline() const [Handle_HYDROData_PolylineXY ()];
201 Handle(HYDROData_PolylineXY) aRef;
203 Py_BEGIN_ALLOW_THREADS
204 aRef = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetBoundaryPolyline() :
205 sipCpp->GetBoundaryPolyline();
208 sipRes = (HYDROData_PolylineXY*)createPointer( aRef );
212 * Remove reference boundary polyline object from calculation case.
214 void RemoveBoundaryPolyline();
218 * Add new one child region for calculation case.
219 * The new region is added into the list of reference regions.
220 * The label of theZone is changed during this operation
221 * because of new region becomes the new parent for this zone.
223 HYDROData_Region AddNewRegion( HYDROData_Zone theZone ) [Handle_HYDROData_Region ( const Handle_HYDROData_Zone& )];
225 Handle(HYDROData_Zone) aRef =
226 Handle(HYDROData_Zone)::DownCast( createHandle( a0 ) );
227 Handle(HYDROData_Region) aRes;
229 if ( !aRef.IsNull() )
231 Py_BEGIN_ALLOW_THREADS
232 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddNewRegion( aRef ) :
233 sipCpp->AddNewRegion( aRef );
237 sipRes = (HYDROData_Region*)createPointer( aRes );
241 * Add new one reference region for calculation case.
242 * The label of theRegion is changed in case if old parent is not this calculation.
244 bool AddRegion( HYDROData_Region theRegion ) [bool ( const Handle_HYDROData_Region& )];
246 Handle(HYDROData_Region) aRef =
247 Handle(HYDROData_Region)::DownCast( createHandle( a0 ) );
248 if ( !aRef.IsNull() )
250 Py_BEGIN_ALLOW_THREADS
251 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRegion( aRef ):
252 sipCpp->AddRegion( aRef );
258 * Returns all reference regions of calculation case.
260 HYDROData_SequenceOfObjects GetRegions() const;
263 * Updates names of regions to correct order.
265 void UpdateRegionsOrder();
268 * Removes reference region from calculation case.
270 void RemoveRegion( HYDROData_Region theRegion ) [void ( const Handle_HYDROData_Region& )];
272 Handle(HYDROData_Region) aRef =
273 Handle(HYDROData_Region)::DownCast( createHandle( a0 ) );
274 if ( !aRef.IsNull() )
276 Py_BEGIN_ALLOW_THREADS
277 if ( sipSelfWasArg ) {
278 sipCpp->HYDROData_CalculationCase::RemoveRegion( aRef );
280 sipCpp->RemoveRegion( aRef );
287 * Removes all reference regions from calculation case.
289 void RemoveRegions();
293 * Returns all reference geometry groups of calculation case.
295 HYDROData_SequenceOfObjects GetSplittedGroups() const;
298 * Removes all reference geometry groups from calculation case.
300 void RemoveSplittedGroups();
304 * Exports the calculation case data (shell and groups) to GEOM module.
305 * \param theGeomEngine GEOM module engine
306 * \param theStudy SALOMEDS study, is used for publishing of GEOM objects
307 * \return true in case of success
309 //TODO: virtual bool Export( GEOM::GEOM_Gen_var theGeomEngine,
310 // SALOMEDS::Study_ptr theStudy );
312 QString Export( int theStudyId ) const;
315 // Public methods to work with Calculation services
318 * Returns altitude for given point.
319 * \param thePoint the point to examine
320 * \return result altitude value
322 double GetAltitudeForPoint( const double theCoordX,
323 const double theCoordY ) const [double ( const gp_XY& )];
325 gp_XY aPnt( a0, a1 );
327 Py_BEGIN_ALLOW_THREADS
328 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt ) :
329 sipCpp->GetAltitudeForPoint( aPnt );
334 * Returns altitude for given point on given region.
335 * \param thePoint the point to examine
336 * \param theRegion reference region to check
337 * \return result altitude value
339 double GetAltitudeForPoint( const double theCoordX,
340 const double theCoordY,
341 HYDROData_Region theRegion ) const
342 [double ( const gp_XY&, const Handle_HYDROData_Region& )];
344 gp_XY aPnt( a0, a1 );
345 Handle(HYDROData_Region) aRefRegion =
346 Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
348 Py_BEGIN_ALLOW_THREADS
349 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefRegion ) :
350 sipCpp->GetAltitudeForPoint( aPnt, aRefRegion );
355 * Returns altitude for given point on given zone.
356 * \param thePoint the point to examine
357 * \param theZone reference zone to check
358 * \return result altitude value
360 double GetAltitudeForPoint( const double theCoordX,
361 const double theCoordY,
362 HYDROData_Zone theZone ) const
363 [double ( const gp_XY&, const Handle_HYDROData_Zone& )];
365 gp_XY aPnt( a0, a1 );
366 Handle(HYDROData_Zone) aRefZone =
367 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
369 Py_BEGIN_ALLOW_THREADS
370 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefZone ) :
371 sipCpp->GetAltitudeForPoint( aPnt, aRefZone );
376 * Returns altitudes for given points on given region.
377 * \param thePoints the points to examine
378 * \param theZone reference region to check
379 * \return result altitude value
381 NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
382 const NCollection_Sequence<double>& theCoordsY,
383 HYDROData_Region theRegion ) const
384 [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, const Handle_HYDROData_Region& )];
387 NCollection_Sequence<gp_XY> aPnts;
389 int aLen = qMin( a0->Length(), a1->Length() );
390 for ( int i = 1; i <= aLen; ++i )
392 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
393 aPnts.Append( aPnt );
396 Handle(HYDROData_Region) aRefRegion =
397 Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
399 NCollection_Sequence<double> aRes;
400 Py_BEGIN_ALLOW_THREADS
401 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefRegion ) :
402 sipCpp->GetAltitudesForPoints( aPnts, aRefRegion );
405 sipRes = new NCollection_Sequence<double>( aRes );
409 * Returns altitudes for given points on given zone.
410 * \param thePoints the points to examine
411 * \param theZone reference zone to check
412 * \return result altitude value
414 NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
415 const NCollection_Sequence<double>& theCoordsY,
416 HYDROData_Zone theZone ) const
417 [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, const Handle_HYDROData_Zone& )];
420 NCollection_Sequence<gp_XY> aPnts;
422 int aLen = qMin( a0->Length(), a1->Length() );
423 for ( int i = 1; i <= aLen; ++i )
425 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
426 aPnts.Append( aPnt );
429 Handle(HYDROData_Zone) aRefZone =
430 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
432 NCollection_Sequence<double> aRes;
433 Py_BEGIN_ALLOW_THREADS
434 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefZone ) :
435 sipCpp->GetAltitudesForPoints( aPnts, aRefZone );
438 sipRes = new NCollection_Sequence<double>( aRes );
442 * Returns region to which the point is belongs.
443 * \param thePoint the point to examine
444 * \return result region
446 HYDROData_Region GetRegionFromPoint( const double theCoordX,
447 const double theCoordY ) const
448 [Handle_HYDROData_Region ( const gp_XY& )];
450 Handle(HYDROData_Region) aRes;
452 gp_XY aPnt( a0, a1 );
454 Py_BEGIN_ALLOW_THREADS
455 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetRegionFromPoint( aPnt ) :
456 sipCpp->GetRegionFromPoint( aPnt );
459 sipRes = (HYDROData_Region*)createPointer( aRes );
463 * Returns zone to which the point is belongs.
464 * \param thePoint the point to examine
465 * \return result zone
467 HYDROData_Zone GetZoneFromPoint( const double theCoordX,
468 const double theCoordY ) const
469 [Handle_HYDROData_Zone ( const gp_XY& )];
471 Handle(HYDROData_Zone) aRes;
473 gp_XY aPnt( a0, a1 );
475 Py_BEGIN_ALLOW_THREADS
476 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetZoneFromPoint( aPnt ) :
477 sipCpp->GetZoneFromPoint( aPnt );
480 sipRes = (HYDROData_Zone*)createPointer( aRes );
484 * Returns classification of point for given zone.
485 * \param thePoint the point to examine
486 * \param theZone the zone to examine
487 * \return result classification
489 PointClassification GetPointClassification( const double theCoordX,
490 const double theCoordY,
491 HYDROData_Zone theZone ) const
492 [PointClassification ( const gp_XY&, const Handle_HYDROData_Zone& )];
494 gp_XY aPnt( a0, a1 );
496 Handle(HYDROData_Zone) aRef =
497 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
499 Py_BEGIN_ALLOW_THREADS
500 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetPointClassification( aPnt, aRef ) :
501 sipCpp->GetPointClassification( aPnt, aRef );
506 void ClearRules( HYDROData_CalculationCase::DataTag theDataTag );
508 void AddRule( HYDROData_Entity theObject1,
509 HYDROData_PriorityType thePriority,
510 HYDROData_Entity theObject2,
511 HYDROData_Zone::MergeAltitudesType theMergeType,
512 HYDROData_CalculationCase::DataTag theDataTag )
513 [void ( const Handle_HYDROData_Entity&, HYDROData_PriorityType, const Handle_HYDROData_Entity&, HYDROData_Zone::MergeAltitudesType, HYDROData_CalculationCase::DataTag )];
515 Handle(HYDROData_Entity) anObject1 =
516 Handle(HYDROData_Entity)::DownCast( createHandle( a0 ) );
517 Handle(HYDROData_Entity) anObject2 =
518 Handle(HYDROData_Entity)::DownCast( createHandle( a2 ) );
520 Py_BEGIN_ALLOW_THREADS
521 sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRule( anObject1, a1, anObject2, a3, a4 ) :
522 sipCpp->AddRule( anObject1, a1, anObject2, a3, a4 );
528 void SetAssignmentMode( AssignmentMode theMode );
529 AssignmentMode GetAssignmentMode() const;
534 * Creates new object in the internal data structure. Use higher level objects
535 * to create objects with real content.
537 HYDROData_CalculationCase();
540 * Destructs properties of the object and object itself, removes it from the document.
542 ~HYDROData_CalculationCase();