1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 #include <HYDROData_CalculationCase.h>
25 #include <HYDROData_PriorityQueue.h>
28 enum HYDROData_PriorityType
34 class HYDROData_CalculationCase : public HYDROData_Entity
38 #include <HYDROData_CalculationCase.h>
41 %ConvertToSubClassCode
42 switch ( sipCpp->GetKind() )
44 case KIND_CALCULATION:
45 sipClass = sipClass_HYDROData_CalculationCase;
49 // We don't recognise the type.
56 enum PointClassification
58 POINT_OUT, ///< point is out of zone face
59 POINT_IN, ///< point is inside of zone face
60 POINT_ON ///< point is on the edge of zone face
71 * Add new one reference geometry object for calculation case.
73 bool AddGeometryObject( HYDROData_Object theObject ) [bool ( const Handle_HYDROData_Object& )];
75 Handle(HYDROData_Object) aRef =
76 Handle(HYDROData_Object)::DownCast( createHandle( a0 ) );
79 Py_BEGIN_ALLOW_THREADS
80 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddGeometryObject( aRef ):
81 sipCpp->AddGeometryObject( aRef );
87 * Returns all reference geometry objects of calculation case.
89 HYDROData_SequenceOfObjects GetGeometryObjects() const;
92 * Removes reference geometry object from calculation case.
94 void RemoveGeometryObject( HYDROData_Object theObject ) [void ( const Handle_HYDROData_Object& )];
96 Handle(HYDROData_Object) aRef =
97 Handle(HYDROData_Object)::DownCast( createHandle( a0 ) );
100 Py_BEGIN_ALLOW_THREADS
101 if ( sipSelfWasArg ) {
102 sipCpp->HYDROData_CalculationCase::RemoveGeometryObject( aRef );
104 sipCpp->RemoveGeometryObject( aRef );
111 * Removes all reference geometry objects from calculation case.
113 void RemoveGeometryObjects();
117 * Add new one reference geometry group for calculation case.
119 bool AddGeometryGroup( HYDROData_ShapesGroup theGroup ) [bool ( const Handle_HYDROData_ShapesGroup& )];
121 Handle(HYDROData_ShapesGroup) aRef =
122 Handle(HYDROData_ShapesGroup)::DownCast( createHandle( a0 ) );
123 if ( !aRef.IsNull() )
125 Py_BEGIN_ALLOW_THREADS
126 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddGeometryGroup( aRef ):
127 sipCpp->AddGeometryGroup( aRef );
133 * Returns all reference geometry groups of calculation case.
135 HYDROData_SequenceOfObjects GetGeometryGroups() const;
138 * Removes reference geometry group from calculation case.
140 void RemoveGeometryGroup( HYDROData_ShapesGroup theGroup ) [void ( const Handle_HYDROData_ShapesGroup& )];
142 Handle(HYDROData_ShapesGroup) aRef =
143 Handle(HYDROData_ShapesGroup)::DownCast( createHandle( a0 ) );
144 if ( !aRef.IsNull() )
146 Py_BEGIN_ALLOW_THREADS
147 if ( sipSelfWasArg ) {
148 sipCpp->HYDROData_CalculationCase::RemoveGeometryGroup( aRef );
150 sipCpp->RemoveGeometryGroup( aRef );
157 * Removes all reference geometry groups from calculation case.
159 void RemoveGeometryGroups();
163 * Sets reference boundary polyline object for calculation case.
165 void SetBoundaryPolyline( HYDROData_PolylineXY thePolyline ) [void ( const Handle_HYDROData_PolylineXY& )];
167 Handle(HYDROData_PolylineXY) aRef =
168 Handle(HYDROData_PolylineXY)::DownCast( createHandle( a0 ) );
169 if ( !aRef.IsNull() )
171 Py_BEGIN_ALLOW_THREADS
172 if ( sipSelfWasArg ) {
173 sipCpp->HYDROData_CalculationCase::SetBoundaryPolyline( aRef );
175 sipCpp->SetBoundaryPolyline( aRef );
182 * Returns reference boundary polyline object of calculation case.
184 HYDROData_PolylineXY GetBoundaryPolyline() const [Handle_HYDROData_PolylineXY ()];
186 Handle(HYDROData_PolylineXY) aRef;
188 Py_BEGIN_ALLOW_THREADS
189 aRef = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetBoundaryPolyline() :
190 sipCpp->GetBoundaryPolyline();
193 sipRes = (HYDROData_PolylineXY*)createPointer( aRef );
197 * Remove reference boundary polyline object from calculation case.
199 void RemoveBoundaryPolyline();
203 * Add new one child region for calculation case.
204 * The new region is added into the list of reference regions.
205 * The label of theZone is changed during this operation
206 * because of new region becomes the new parent for this zone.
208 HYDROData_Region AddNewRegion( HYDROData_Zone theZone ) [Handle_HYDROData_Region ( const Handle_HYDROData_Zone& )];
210 Handle(HYDROData_Zone) aRef =
211 Handle(HYDROData_Zone)::DownCast( createHandle( a0 ) );
212 Handle(HYDROData_Region) aRes;
214 if ( !aRef.IsNull() )
216 Py_BEGIN_ALLOW_THREADS
217 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddNewRegion( aRef ) :
218 sipCpp->AddNewRegion( aRef );
222 sipRes = (HYDROData_Region*)createPointer( aRes );
226 * Add new one reference region for calculation case.
227 * The label of theRegion is changed in case if old parent is not this calculation.
229 bool AddRegion( HYDROData_Region theRegion ) [bool ( const Handle_HYDROData_Region& )];
231 Handle(HYDROData_Region) aRef =
232 Handle(HYDROData_Region)::DownCast( createHandle( a0 ) );
233 if ( !aRef.IsNull() )
235 Py_BEGIN_ALLOW_THREADS
236 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRegion( aRef ):
237 sipCpp->AddRegion( aRef );
243 * Returns all reference regions of calculation case.
245 HYDROData_SequenceOfObjects GetRegions() const;
248 * Updates names of regions to correct order.
250 void UpdateRegionsOrder();
253 * Removes reference region from calculation case.
255 void RemoveRegion( HYDROData_Region theRegion ) [void ( const Handle_HYDROData_Region& )];
257 Handle(HYDROData_Region) aRef =
258 Handle(HYDROData_Region)::DownCast( createHandle( a0 ) );
259 if ( !aRef.IsNull() )
261 Py_BEGIN_ALLOW_THREADS
262 if ( sipSelfWasArg ) {
263 sipCpp->HYDROData_CalculationCase::RemoveRegion( aRef );
265 sipCpp->RemoveRegion( aRef );
272 * Removes all reference regions from calculation case.
274 void RemoveRegions();
278 * Returns all reference geometry groups of calculation case.
280 HYDROData_SequenceOfObjects GetSplittedGroups() const;
283 * Removes all reference geometry groups from calculation case.
285 void RemoveSplittedGroups();
289 * Exports the calculation case data (shell and groups) to GEOM module.
290 * \param theGeomEngine GEOM module engine
291 * \param theStudy SALOMEDS study, is used for publishing of GEOM objects
292 * \return true in case of success
294 //TODO: virtual bool Export( GEOM::GEOM_Gen_var theGeomEngine,
295 // SALOMEDS::Study_ptr theStudy );
297 QString Export( int theStudyId ) const;
300 // Public methods to work with Calculation services
303 * Returns altitude for given point.
304 * \param thePoint the point to examine
305 * \return result altitude value
307 double GetAltitudeForPoint( const double theCoordX,
308 const double theCoordY ) const [double ( const gp_XY& )];
310 gp_XY aPnt( a0, a1 );
312 Py_BEGIN_ALLOW_THREADS
313 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt ) :
314 sipCpp->GetAltitudeForPoint( aPnt );
319 * Returns altitude for given point on given region.
320 * \param thePoint the point to examine
321 * \param theRegion reference region to check
322 * \return result altitude value
324 double GetAltitudeForPoint( const double theCoordX,
325 const double theCoordY,
326 HYDROData_Region theRegion ) const
327 [double ( const gp_XY&, const Handle_HYDROData_Region& )];
329 gp_XY aPnt( a0, a1 );
330 Handle(HYDROData_Region) aRefRegion =
331 Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
333 Py_BEGIN_ALLOW_THREADS
334 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefRegion ) :
335 sipCpp->GetAltitudeForPoint( aPnt, aRefRegion );
340 * Returns altitude for given point on given zone.
341 * \param thePoint the point to examine
342 * \param theZone reference zone to check
343 * \return result altitude value
345 double GetAltitudeForPoint( const double theCoordX,
346 const double theCoordY,
347 HYDROData_Zone theZone ) const
348 [double ( const gp_XY&, const Handle_HYDROData_Zone& )];
350 gp_XY aPnt( a0, a1 );
351 Handle(HYDROData_Zone) aRefZone =
352 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
354 Py_BEGIN_ALLOW_THREADS
355 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefZone ) :
356 sipCpp->GetAltitudeForPoint( aPnt, aRefZone );
361 * Returns altitudes for given points on given region.
362 * \param thePoints the points to examine
363 * \param theZone reference region to check
364 * \return result altitude value
366 NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
367 const NCollection_Sequence<double>& theCoordsY,
368 HYDROData_Region theRegion ) const
369 [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, const Handle_HYDROData_Region& )];
372 NCollection_Sequence<gp_XY> aPnts;
374 int aLen = qMin( a0->Length(), a1->Length() );
375 for ( int i = 1; i <= aLen; ++i )
377 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
378 aPnts.Append( aPnt );
381 Handle(HYDROData_Region) aRefRegion =
382 Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
384 NCollection_Sequence<double> aRes;
385 Py_BEGIN_ALLOW_THREADS
386 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefRegion ) :
387 sipCpp->GetAltitudesForPoints( aPnts, aRefRegion );
390 sipRes = new NCollection_Sequence<double>( aRes );
394 * Returns altitudes for given points on given zone.
395 * \param thePoints the points to examine
396 * \param theZone reference zone to check
397 * \return result altitude value
399 NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
400 const NCollection_Sequence<double>& theCoordsY,
401 HYDROData_Zone theZone ) const
402 [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, const Handle_HYDROData_Zone& )];
405 NCollection_Sequence<gp_XY> aPnts;
407 int aLen = qMin( a0->Length(), a1->Length() );
408 for ( int i = 1; i <= aLen; ++i )
410 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
411 aPnts.Append( aPnt );
414 Handle(HYDROData_Zone) aRefZone =
415 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
417 NCollection_Sequence<double> aRes;
418 Py_BEGIN_ALLOW_THREADS
419 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefZone ) :
420 sipCpp->GetAltitudesForPoints( aPnts, aRefZone );
423 sipRes = new NCollection_Sequence<double>( aRes );
427 * Returns region to which the point is belongs.
428 * \param thePoint the point to examine
429 * \return result region
431 HYDROData_Region GetRegionFromPoint( const double theCoordX,
432 const double theCoordY ) const
433 [Handle_HYDROData_Region ( const gp_XY& )];
435 Handle(HYDROData_Region) aRes;
437 gp_XY aPnt( a0, a1 );
439 Py_BEGIN_ALLOW_THREADS
440 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetRegionFromPoint( aPnt ) :
441 sipCpp->GetRegionFromPoint( aPnt );
444 sipRes = (HYDROData_Region*)createPointer( aRes );
448 * Returns zone to which the point is belongs.
449 * \param thePoint the point to examine
450 * \return result zone
452 HYDROData_Zone GetZoneFromPoint( const double theCoordX,
453 const double theCoordY ) const
454 [Handle_HYDROData_Zone ( const gp_XY& )];
456 Handle(HYDROData_Zone) aRes;
458 gp_XY aPnt( a0, a1 );
460 Py_BEGIN_ALLOW_THREADS
461 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetZoneFromPoint( aPnt ) :
462 sipCpp->GetZoneFromPoint( aPnt );
465 sipRes = (HYDROData_Zone*)createPointer( aRes );
469 * Returns classification of point for given zone.
470 * \param thePoint the point to examine
471 * \param theZone the zone to examine
472 * \return result classification
474 PointClassification GetPointClassification( const double theCoordX,
475 const double theCoordY,
476 HYDROData_Zone theZone ) const
477 [PointClassification ( const gp_XY&, const Handle_HYDROData_Zone& )];
479 gp_XY aPnt( a0, a1 );
481 Handle(HYDROData_Zone) aRef =
482 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
484 Py_BEGIN_ALLOW_THREADS
485 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetPointClassification( aPnt, aRef ) :
486 sipCpp->GetPointClassification( aPnt, aRef );
493 void AddRule( HYDROData_Object theObject1,
494 HYDROData_PriorityType thePriority,
495 HYDROData_Object theObject2,
496 HYDROData_Zone::MergeAltitudesType theMergeType )
497 [void ( const Handle_HYDROData_Object&, HYDROData_PriorityType, const Handle_HYDROData_Object&, HYDROData_Zone::MergeAltitudesType )];
499 Handle(HYDROData_Object) anObject1 =
500 Handle(HYDROData_Object)::DownCast( createHandle( a0 ) );
501 Handle(HYDROData_Object) anObject2 =
502 Handle(HYDROData_Object)::DownCast( createHandle( a2 ) );
504 Py_BEGIN_ALLOW_THREADS
505 sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRule( anObject1, a1, anObject2, a3 ) :
506 sipCpp->AddRule( anObject1, a1, anObject2, a3 );
512 void SetAssignmentMode( AssignmentMode theMode );
513 AssignmentMode GetAssignmentMode() const;
518 * Creates new object in the internal data structure. Use higher level objects
519 * to create objects with real content.
521 HYDROData_CalculationCase();
524 * Destructs properties of the object and object itself, removes it from the document.
526 ~HYDROData_CalculationCase();