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 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 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 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 ( const 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 ( const 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 [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();
221 * Add new one child region for calculation case.
222 * The new region is added into the list of reference regions.
223 * The label of theZone is changed during this operation
224 * because of new region becomes the new parent for this zone.
226 HYDROData_Region AddNewRegion( HYDROData_Zone theZone ) [Handle_HYDROData_Region ( const Handle_HYDROData_Zone& )];
228 Handle(HYDROData_Zone) aRef =
229 Handle(HYDROData_Zone)::DownCast( createHandle( a0 ) );
230 Handle(HYDROData_Region) aRes;
232 if ( !aRef.IsNull() )
234 Py_BEGIN_ALLOW_THREADS
235 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddNewRegion( aRef ) :
236 sipCpp->AddNewRegion( aRef );
240 sipRes = (HYDROData_Region*)createPointer( aRes );
244 * Add new one reference region for calculation case.
245 * The label of theRegion is changed in case if old parent is not this calculation.
247 bool AddRegion( HYDROData_Region theRegion ) [bool ( const Handle_HYDROData_Region& )];
249 Handle(HYDROData_Region) aRef =
250 Handle(HYDROData_Region)::DownCast( createHandle( a0 ) );
251 if ( !aRef.IsNull() )
253 Py_BEGIN_ALLOW_THREADS
254 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRegion( aRef ):
255 sipCpp->AddRegion( aRef );
261 * Returns all reference regions of calculation case.
263 HYDROData_SequenceOfObjects GetRegions() const;
266 * Updates names of regions to correct order.
268 void UpdateRegionsOrder();
271 * Removes reference region from calculation case.
273 void RemoveRegion( HYDROData_Region theRegion ) [void ( const Handle_HYDROData_Region& )];
275 Handle(HYDROData_Region) aRef =
276 Handle(HYDROData_Region)::DownCast( createHandle( a0 ) );
277 if ( !aRef.IsNull() )
279 Py_BEGIN_ALLOW_THREADS
280 if ( sipSelfWasArg ) {
281 sipCpp->HYDROData_CalculationCase::RemoveRegion( aRef );
283 sipCpp->RemoveRegion( aRef );
290 * Removes all reference regions from calculation case.
292 void RemoveRegions();
296 * Returns all reference geometry groups of calculation case.
298 HYDROData_SequenceOfObjects GetSplitGroups() const;
301 * Removes all reference geometry groups from calculation case.
303 void RemoveSplitGroups();
307 * Exports the calculation case data (shell and groups) to GEOM module.
308 * \param theGeomEngine GEOM module engine
309 * \param theStudy SALOMEDS study, is used for publishing of GEOM objects
310 * \return true in case of success
312 //TODO: virtual bool Export( GEOM::GEOM_Gen_var theGeomEngine,
313 // SALOMEDS::Study_ptr theStudy );
315 QString Export( int theStudyId ) const;
318 // Public methods to work with Calculation services
321 * Returns strickler coefficient for given point.
322 * \param thePoint the point to examine
323 * \return result strickler coefficient
325 double GetStricklerCoefficientForPoint( const double theCoordX,
326 const double theCoordY ) const [double ( const gp_XY& ) ];
328 gp_XY aPnt( a0, a1 );
330 Py_BEGIN_ALLOW_THREADS
331 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetStricklerCoefficientForPoint( aPnt ) :
332 sipCpp->GetStricklerCoefficientForPoint( aPnt );
337 * Returns altitude for given point.
338 * \param thePoint the point to examine
339 * \return result altitude value
341 double GetAltitudeForPoint( const double theCoordX,
342 const double theCoordY ) const [double ( const gp_XY& )];
344 gp_XY aPnt( a0, a1 );
346 Py_BEGIN_ALLOW_THREADS
347 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt ) :
348 sipCpp->GetAltitudeForPoint( aPnt );
353 * Returns altitude for given point on given region.
354 * \param thePoint the point to examine
355 * \param theRegion reference region to check
356 * \return result altitude value
358 double GetAltitudeForPoint( const double theCoordX,
359 const double theCoordY,
360 HYDROData_Region theRegion ) const
361 [double ( const gp_XY&, const Handle_HYDROData_Region& )];
363 gp_XY aPnt( a0, a1 );
364 Handle(HYDROData_Region) aRefRegion =
365 Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
367 Py_BEGIN_ALLOW_THREADS
368 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefRegion ) :
369 sipCpp->GetAltitudeForPoint( aPnt, aRefRegion );
374 * Returns altitude for given point on given zone.
375 * \param thePoint the point to examine
376 * \param theZone reference zone to check
377 * \return result altitude value
379 double GetAltitudeForPoint( const double theCoordX,
380 const double theCoordY,
381 HYDROData_Zone theZone ) const
382 [double ( const gp_XY&, const Handle_HYDROData_Zone& )];
384 gp_XY aPnt( a0, a1 );
385 Handle(HYDROData_Zone) aRefZone =
386 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
388 Py_BEGIN_ALLOW_THREADS
389 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefZone ) :
390 sipCpp->GetAltitudeForPoint( aPnt, aRefZone );
395 * Returns altitudes for given points on given region.
396 * \param thePoints the points to examine
397 * \param theZone reference region to check
398 * \return result altitude value
400 NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
401 const NCollection_Sequence<double>& theCoordsY,
402 HYDROData_Region theRegion,
403 int theMethod = 0) const
404 [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, const Handle_HYDROData_Region&, int)];
407 NCollection_Sequence<gp_XY> aPnts;
409 int aLen = qMin( a0->Length(), a1->Length() );
410 for ( int i = 1; i <= aLen; ++i )
412 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
413 aPnts.Append( aPnt );
416 Handle(HYDROData_Region) aRefRegion =
417 Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
420 NCollection_Sequence<double> aRes;
421 Py_BEGIN_ALLOW_THREADS
422 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefRegion, aMethod ) :
423 sipCpp->GetAltitudesForPoints( aPnts, aRefRegion, aMethod );
426 sipRes = new NCollection_Sequence<double>( aRes );
430 * Returns altitudes for given points on given zone.
431 * \param thePoints the points to examine
432 * \param theZone reference zone to check
433 * \return result altitude value
435 NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
436 const NCollection_Sequence<double>& theCoordsY,
437 HYDROData_Zone theZone,
438 int theMethod = 0) const
439 [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, const Handle_HYDROData_Zone&, int )];
442 NCollection_Sequence<gp_XY> aPnts;
444 int aLen = qMin( a0->Length(), a1->Length() );
445 for ( int i = 1; i <= aLen; ++i )
447 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
448 aPnts.Append( aPnt );
451 Handle(HYDROData_Zone) aRefZone =
452 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
455 NCollection_Sequence<double> aRes;
456 Py_BEGIN_ALLOW_THREADS
457 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefZone, aMethod ) :
458 sipCpp->GetAltitudesForPoints( aPnts, aRefZone, aMethod );
461 sipRes = new NCollection_Sequence<double>( aRes );
465 * Returns region to which the point is belongs.
466 * \param thePoint the point to examine
467 * \return result region
469 HYDROData_Region GetRegionFromPoint( const double theCoordX,
470 const double theCoordY ) const
471 [Handle_HYDROData_Region ( const gp_XY& )];
473 Handle(HYDROData_Region) aRes;
475 gp_XY aPnt( a0, a1 );
477 Py_BEGIN_ALLOW_THREADS
478 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetRegionFromPoint( aPnt ) :
479 sipCpp->GetRegionFromPoint( aPnt );
482 sipRes = (HYDROData_Region*)createPointer( aRes );
486 * Returns zone to which the point is belongs.
487 * \param thePoint the point to examine
488 * \return result zone
490 HYDROData_Zone GetZoneFromPoint( const double theCoordX,
491 const double theCoordY ) const
492 [Handle_HYDROData_Zone ( const gp_XY& )];
494 Handle(HYDROData_Zone) aRes;
496 gp_XY aPnt( a0, a1 );
498 Py_BEGIN_ALLOW_THREADS
499 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetZoneFromPoint( aPnt ) :
500 sipCpp->GetZoneFromPoint( aPnt );
503 sipRes = (HYDROData_Zone*)createPointer( aRes );
507 * Returns classification of point for given zone.
508 * \param thePoint the point to examine
509 * \param theZone the zone to examine
510 * \return result classification
512 PointClassification GetPointClassification( const double theCoordX,
513 const double theCoordY,
514 HYDROData_Zone theZone ) const
515 [PointClassification ( const gp_XY&, const Handle_HYDROData_Zone& )];
517 gp_XY aPnt( a0, a1 );
519 Handle(HYDROData_Zone) aRef =
520 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
522 Py_BEGIN_ALLOW_THREADS
523 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetPointClassification( aPnt, aRef ) :
524 sipCpp->GetPointClassification( aPnt, aRef );
529 void ClearRules( HYDROData_CalculationCase::DataTag theDataTag );
531 void AddRule( HYDROData_Entity theObject1,
532 HYDROData_PriorityType thePriority,
533 HYDROData_Entity theObject2,
534 HYDROData_Zone::MergeType theMergeType,
535 HYDROData_CalculationCase::DataTag theDataTag )
536 [void ( const Handle_HYDROData_Entity&, HYDROData_PriorityType, const Handle_HYDROData_Entity&, HYDROData_Zone::MergeType, HYDROData_CalculationCase::DataTag )];
538 Handle(HYDROData_Entity) anObject1 =
539 Handle(HYDROData_Entity)::DownCast( createHandle( a0 ) );
540 Handle(HYDROData_Entity) anObject2 =
541 Handle(HYDROData_Entity)::DownCast( createHandle( a2 ) );
543 Py_BEGIN_ALLOW_THREADS
544 sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRule( anObject1, a1, anObject2, a3, a4 ) :
545 sipCpp->AddRule( anObject1, a1, anObject2, a3, a4 );
551 void SetAssignmentMode( AssignmentMode theMode );
552 AssignmentMode GetAssignmentMode() const;
557 * Creates new object in the internal data structure. Use higher level objects
558 * to create objects with real content.
560 HYDROData_CalculationCase();
563 * Destructs properties of the object and object itself, removes it from the document.
565 ~HYDROData_CalculationCase();