1 // Copyright (C) 2007-2013 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.
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 );
298 // Public methods to work with Calculation services
301 * Returns altitude for given point.
302 * \param thePoint the point to examine
303 * \return result altitude value
305 double GetAltitudeForPoint( const double theCoordX,
306 const double theCoordY ) const [double ( const gp_XY& )];
308 gp_XY aPnt( a0, a1 );
310 Py_BEGIN_ALLOW_THREADS
311 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt ) :
312 sipCpp->GetAltitudeForPoint( aPnt );
317 * Returns altitude for given point on given region.
318 * \param thePoint the point to examine
319 * \param theRegion reference region to check
320 * \return result altitude value
322 double GetAltitudeForPoint( const double theCoordX,
323 const double theCoordY,
324 HYDROData_Region theRegion ) const
325 [double ( const gp_XY&, const Handle_HYDROData_Region& )];
327 gp_XY aPnt( a0, a1 );
328 Handle(HYDROData_Region) aRefRegion =
329 Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
331 Py_BEGIN_ALLOW_THREADS
332 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefRegion ) :
333 sipCpp->GetAltitudeForPoint( aPnt, aRefRegion );
338 * Returns altitude for given point on given zone.
339 * \param thePoint the point to examine
340 * \param theZone reference zone to check
341 * \return result altitude value
343 double GetAltitudeForPoint( const double theCoordX,
344 const double theCoordY,
345 HYDROData_Zone theZone ) const
346 [double ( const gp_XY&, const Handle_HYDROData_Zone& )];
348 gp_XY aPnt( a0, a1 );
349 Handle(HYDROData_Zone) aRefZone =
350 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
352 Py_BEGIN_ALLOW_THREADS
353 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefZone ) :
354 sipCpp->GetAltitudeForPoint( aPnt, aRefZone );
359 * Returns altitudes for given points on given region.
360 * \param thePoints the points to examine
361 * \param theZone reference region to check
362 * \return result altitude value
364 NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
365 const NCollection_Sequence<double>& theCoordsY,
366 HYDROData_Region theRegion ) const
367 [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, const Handle_HYDROData_Region& )];
370 NCollection_Sequence<gp_XY> aPnts;
372 int aLen = qMin( a0->Length(), a1->Length() );
373 for ( int i = 1; i <= aLen; ++i )
375 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
376 aPnts.Append( aPnt );
379 Handle(HYDROData_Region) aRefRegion =
380 Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
382 NCollection_Sequence<double> aRes;
383 Py_BEGIN_ALLOW_THREADS
384 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefRegion ) :
385 sipCpp->GetAltitudesForPoints( aPnts, aRefRegion );
388 sipRes = new NCollection_Sequence<double>( aRes );
392 * Returns altitudes for given points on given zone.
393 * \param thePoints the points to examine
394 * \param theZone reference zone to check
395 * \return result altitude value
397 NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
398 const NCollection_Sequence<double>& theCoordsY,
399 HYDROData_Zone theZone ) const
400 [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, const Handle_HYDROData_Zone& )];
403 NCollection_Sequence<gp_XY> aPnts;
405 int aLen = qMin( a0->Length(), a1->Length() );
406 for ( int i = 1; i <= aLen; ++i )
408 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
409 aPnts.Append( aPnt );
412 Handle(HYDROData_Zone) aRefZone =
413 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
415 NCollection_Sequence<double> aRes;
416 Py_BEGIN_ALLOW_THREADS
417 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefZone ) :
418 sipCpp->GetAltitudesForPoints( aPnts, aRefZone );
421 sipRes = new NCollection_Sequence<double>( aRes );
425 * Returns region to which the point is belongs.
426 * \param thePoint the point to examine
427 * \return result region
429 HYDROData_Region GetRegionFromPoint( const double theCoordX,
430 const double theCoordY ) const
431 [Handle_HYDROData_Region ( const gp_XY& )];
433 Handle(HYDROData_Region) aRes;
435 gp_XY aPnt( a0, a1 );
437 Py_BEGIN_ALLOW_THREADS
438 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetRegionFromPoint( aPnt ) :
439 sipCpp->GetRegionFromPoint( aPnt );
442 sipRes = (HYDROData_Region*)createPointer( aRes );
446 * Returns zone to which the point is belongs.
447 * \param thePoint the point to examine
448 * \return result zone
450 HYDROData_Zone GetZoneFromPoint( const double theCoordX,
451 const double theCoordY ) const
452 [Handle_HYDROData_Zone ( const gp_XY& )];
454 Handle(HYDROData_Zone) aRes;
456 gp_XY aPnt( a0, a1 );
458 Py_BEGIN_ALLOW_THREADS
459 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetZoneFromPoint( aPnt ) :
460 sipCpp->GetZoneFromPoint( aPnt );
463 sipRes = (HYDROData_Zone*)createPointer( aRes );
467 * Returns classification of point for given zone.
468 * \param thePoint the point to examine
469 * \param theZone the zone to examine
470 * \return result classification
472 PointClassification GetPointClassification( const double theCoordX,
473 const double theCoordY,
474 HYDROData_Zone theZone ) const
475 [PointClassification ( const gp_XY&, const Handle_HYDROData_Zone& )];
477 gp_XY aPnt( a0, a1 );
479 Handle(HYDROData_Zone) aRef =
480 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
482 Py_BEGIN_ALLOW_THREADS
483 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetPointClassification( aPnt, aRef ) :
484 sipCpp->GetPointClassification( aPnt, aRef );
491 void AddRule( HYDROData_Object theObject1,
492 HYDROData_PriorityType thePriority,
493 HYDROData_Object theObject2,
494 HYDROData_Zone::MergeAltitudesType theMergeType )
495 [void ( const Handle_HYDROData_Object&, HYDROData_PriorityType, const Handle_HYDROData_Object&, HYDROData_Zone::MergeAltitudesType )];
497 Handle(HYDROData_Object) anObject1 =
498 Handle(HYDROData_Object)::DownCast( createHandle( a0 ) );
499 Handle(HYDROData_Object) anObject2 =
500 Handle(HYDROData_Object)::DownCast( createHandle( a2 ) );
502 Py_BEGIN_ALLOW_THREADS
503 sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRule( anObject1, a1, anObject2, a3 ) :
504 sipCpp->AddRule( anObject1, a1, anObject2, a3 );
510 void SetAssignmentMode( AssignmentMode theMode );
511 AssignmentMode GetAssignmentMode() const;
516 * Creates new object in the internal data structure. Use higher level objects
517 * to create objects with real content.
519 HYDROData_CalculationCase();
522 * Destructs properties of the object and object itself, removes it from the document.
524 ~HYDROData_CalculationCase();