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
65 * Add new one reference geometry object for calculation case.
67 bool AddGeometryObject( HYDROData_Object theObject ) [bool ( const Handle_HYDROData_Object& )];
69 Handle(HYDROData_Object) aRef =
70 Handle(HYDROData_Object)::DownCast( createHandle( a0 ) );
73 Py_BEGIN_ALLOW_THREADS
74 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddGeometryObject( aRef ):
75 sipCpp->AddGeometryObject( aRef );
81 * Returns all reference geometry objects of calculation case.
83 HYDROData_SequenceOfObjects GetGeometryObjects() const;
86 * Removes reference geometry object from calculation case.
88 void RemoveGeometryObject( HYDROData_Object theObject ) [void ( const Handle_HYDROData_Object& )];
90 Handle(HYDROData_Object) aRef =
91 Handle(HYDROData_Object)::DownCast( createHandle( a0 ) );
94 Py_BEGIN_ALLOW_THREADS
95 if ( sipSelfWasArg ) {
96 sipCpp->HYDROData_CalculationCase::RemoveGeometryObject( aRef );
98 sipCpp->RemoveGeometryObject( aRef );
105 * Removes all reference geometry objects from calculation case.
107 void RemoveGeometryObjects();
111 * Add new one reference geometry group for calculation case.
113 bool AddGeometryGroup( HYDROData_ShapesGroup theGroup ) [bool ( const Handle_HYDROData_ShapesGroup& )];
115 Handle(HYDROData_ShapesGroup) aRef =
116 Handle(HYDROData_ShapesGroup)::DownCast( createHandle( a0 ) );
117 if ( !aRef.IsNull() )
119 Py_BEGIN_ALLOW_THREADS
120 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddGeometryGroup( aRef ):
121 sipCpp->AddGeometryGroup( aRef );
127 * Returns all reference geometry groups of calculation case.
129 HYDROData_SequenceOfObjects GetGeometryGroups() const;
132 * Removes reference geometry group from calculation case.
134 void RemoveGeometryGroup( HYDROData_ShapesGroup theGroup ) [void ( 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 if ( sipSelfWasArg ) {
142 sipCpp->HYDROData_CalculationCase::RemoveGeometryGroup( aRef );
144 sipCpp->RemoveGeometryGroup( aRef );
151 * Removes all reference geometry groups from calculation case.
153 void RemoveGeometryGroups();
157 * Sets reference boundary polyline object for calculation case.
159 void SetBoundaryPolyline( HYDROData_PolylineXY thePolyline ) [void ( const Handle_HYDROData_PolylineXY& )];
161 Handle(HYDROData_PolylineXY) aRef =
162 Handle(HYDROData_PolylineXY)::DownCast( createHandle( a0 ) );
163 if ( !aRef.IsNull() )
165 Py_BEGIN_ALLOW_THREADS
166 if ( sipSelfWasArg ) {
167 sipCpp->HYDROData_CalculationCase::SetBoundaryPolyline( aRef );
169 sipCpp->SetBoundaryPolyline( aRef );
176 * Returns reference boundary polyline object of calculation case.
178 HYDROData_PolylineXY GetBoundaryPolyline() const [Handle_HYDROData_PolylineXY ()];
180 Handle(HYDROData_PolylineXY) aRef;
182 Py_BEGIN_ALLOW_THREADS
183 aRef = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetBoundaryPolyline() :
184 sipCpp->GetBoundaryPolyline();
187 sipRes = (HYDROData_PolylineXY*)createPointer( aRef );
191 * Remove reference boundary polyline object from calculation case.
193 void RemoveBoundaryPolyline();
197 * Add new one child region for calculation case.
198 * The new region is added into the list of reference regions.
199 * The label of theZone is changed during this operation
200 * because of new region becomes the new parent for this zone.
202 HYDROData_Region AddNewRegion( HYDROData_Zone theZone ) [Handle_HYDROData_Region ( const Handle_HYDROData_Zone& )];
204 Handle(HYDROData_Zone) aRef =
205 Handle(HYDROData_Zone)::DownCast( createHandle( a0 ) );
206 Handle(HYDROData_Region) aRes;
208 if ( !aRef.IsNull() )
210 Py_BEGIN_ALLOW_THREADS
211 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddNewRegion( aRef ) :
212 sipCpp->AddNewRegion( aRef );
216 sipRes = (HYDROData_Region*)createPointer( aRes );
220 * Add new one reference region for calculation case.
221 * The label of theRegion is changed in case if old parent is not this calculation.
223 bool AddRegion( HYDROData_Region theRegion ) [bool ( const Handle_HYDROData_Region& )];
225 Handle(HYDROData_Region) aRef =
226 Handle(HYDROData_Region)::DownCast( createHandle( a0 ) );
227 if ( !aRef.IsNull() )
229 Py_BEGIN_ALLOW_THREADS
230 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRegion( aRef ):
231 sipCpp->AddRegion( aRef );
237 * Returns all reference regions of calculation case.
239 HYDROData_SequenceOfObjects GetRegions() const;
242 * Updates names of regions to correct order.
244 void UpdateRegionsOrder();
247 * Removes reference region from calculation case.
249 void RemoveRegion( HYDROData_Region theRegion ) [void ( const Handle_HYDROData_Region& )];
251 Handle(HYDROData_Region) aRef =
252 Handle(HYDROData_Region)::DownCast( createHandle( a0 ) );
253 if ( !aRef.IsNull() )
255 Py_BEGIN_ALLOW_THREADS
256 if ( sipSelfWasArg ) {
257 sipCpp->HYDROData_CalculationCase::RemoveRegion( aRef );
259 sipCpp->RemoveRegion( aRef );
266 * Removes all reference regions from calculation case.
268 void RemoveRegions();
272 * Returns all reference geometry groups of calculation case.
274 HYDROData_SequenceOfObjects GetSplittedGroups() const;
277 * Removes all reference geometry groups from calculation case.
279 void RemoveSplittedGroups();
283 * Exports the calculation case data (shell and groups) to GEOM module.
284 * \param theGeomEngine GEOM module engine
285 * \param theStudy SALOMEDS study, is used for publishing of GEOM objects
286 * \return true in case of success
288 //TODO: virtual bool Export( GEOM::GEOM_Gen_var theGeomEngine,
289 // SALOMEDS::Study_ptr theStudy );
292 // Public methods to work with Calculation services
295 * Returns altitude for given point.
296 * \param thePoint the point to examine
297 * \return result altitude value
299 double GetAltitudeForPoint( const double theCoordX,
300 const double theCoordY ) const [double ( const gp_XY& )];
302 gp_XY aPnt( a0, a1 );
304 Py_BEGIN_ALLOW_THREADS
305 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt ) :
306 sipCpp->GetAltitudeForPoint( aPnt );
311 * Returns altitude for given point on given region.
312 * \param thePoint the point to examine
313 * \param theRegion reference region to check
314 * \return result altitude value
316 double GetAltitudeForPoint( const double theCoordX,
317 const double theCoordY,
318 HYDROData_Region theRegion ) const
319 [double ( const gp_XY&, const Handle_HYDROData_Region& )];
321 gp_XY aPnt( a0, a1 );
322 Handle(HYDROData_Region) aRefRegion =
323 Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
325 Py_BEGIN_ALLOW_THREADS
326 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefRegion ) :
327 sipCpp->GetAltitudeForPoint( aPnt, aRefRegion );
332 * Returns altitude for given point on given zone.
333 * \param thePoint the point to examine
334 * \param theZone reference zone to check
335 * \return result altitude value
337 double GetAltitudeForPoint( const double theCoordX,
338 const double theCoordY,
339 HYDROData_Zone theZone ) const
340 [double ( const gp_XY&, const Handle_HYDROData_Zone& )];
342 gp_XY aPnt( a0, a1 );
343 Handle(HYDROData_Zone) aRefZone =
344 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
346 Py_BEGIN_ALLOW_THREADS
347 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudeForPoint( aPnt, aRefZone ) :
348 sipCpp->GetAltitudeForPoint( aPnt, aRefZone );
353 * Returns altitudes for given points on given region.
354 * \param thePoints the points to examine
355 * \param theZone reference region to check
356 * \return result altitude value
358 NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
359 const NCollection_Sequence<double>& theCoordsY,
360 HYDROData_Region theRegion ) const
361 [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, const Handle_HYDROData_Region& )];
364 NCollection_Sequence<gp_XY> aPnts;
366 int aLen = qMin( a0->Length(), a1->Length() );
367 for ( int i = 1; i <= aLen; ++i )
369 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
370 aPnts.Append( aPnt );
373 Handle(HYDROData_Region) aRefRegion =
374 Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
376 NCollection_Sequence<double> aRes;
377 Py_BEGIN_ALLOW_THREADS
378 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefRegion ) :
379 sipCpp->GetAltitudesForPoints( aPnts, aRefRegion );
382 sipRes = new NCollection_Sequence<double>( aRes );
386 * Returns altitudes for given points on given zone.
387 * \param thePoints the points to examine
388 * \param theZone reference zone to check
389 * \return result altitude value
391 NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
392 const NCollection_Sequence<double>& theCoordsY,
393 HYDROData_Zone theZone ) const
394 [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, const Handle_HYDROData_Zone& )];
397 NCollection_Sequence<gp_XY> aPnts;
399 int aLen = qMin( a0->Length(), a1->Length() );
400 for ( int i = 1; i <= aLen; ++i )
402 gp_XY aPnt( a0->Value( i ), a1->Value( i ) );
403 aPnts.Append( aPnt );
406 Handle(HYDROData_Zone) aRefZone =
407 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
409 NCollection_Sequence<double> aRes;
410 Py_BEGIN_ALLOW_THREADS
411 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefZone ) :
412 sipCpp->GetAltitudesForPoints( aPnts, aRefZone );
415 sipRes = new NCollection_Sequence<double>( aRes );
419 * Returns region to which the point is belongs.
420 * \param thePoint the point to examine
421 * \return result region
423 HYDROData_Region GetRegionFromPoint( const double theCoordX,
424 const double theCoordY ) const
425 [Handle_HYDROData_Region ( const gp_XY& )];
427 Handle(HYDROData_Region) aRes;
429 gp_XY aPnt( a0, a1 );
431 Py_BEGIN_ALLOW_THREADS
432 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetRegionFromPoint( aPnt ) :
433 sipCpp->GetRegionFromPoint( aPnt );
436 sipRes = (HYDROData_Region*)createPointer( aRes );
440 * Returns zone to which the point is belongs.
441 * \param thePoint the point to examine
442 * \return result zone
444 HYDROData_Zone GetZoneFromPoint( const double theCoordX,
445 const double theCoordY ) const
446 [Handle_HYDROData_Zone ( const gp_XY& )];
448 Handle(HYDROData_Zone) aRes;
450 gp_XY aPnt( a0, a1 );
452 Py_BEGIN_ALLOW_THREADS
453 aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetZoneFromPoint( aPnt ) :
454 sipCpp->GetZoneFromPoint( aPnt );
457 sipRes = (HYDROData_Zone*)createPointer( aRes );
461 * Returns classification of point for given zone.
462 * \param thePoint the point to examine
463 * \param theZone the zone to examine
464 * \return result classification
466 PointClassification GetPointClassification( const double theCoordX,
467 const double theCoordY,
468 HYDROData_Zone theZone ) const
469 [PointClassification ( const gp_XY&, const Handle_HYDROData_Zone& )];
471 gp_XY aPnt( a0, a1 );
473 Handle(HYDROData_Zone) aRef =
474 Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
476 Py_BEGIN_ALLOW_THREADS
477 sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetPointClassification( aPnt, aRef ) :
478 sipCpp->GetPointClassification( aPnt, aRef );
485 void AddRule( HYDROData_Object theObject1,
486 HYDROData_PriorityType thePriority,
487 HYDROData_Object theObject2,
488 HYDROData_Zone::MergeAltitudesType theMergeType )
489 [void ( const Handle_HYDROData_Object&, HYDROData_PriorityType, const Handle_HYDROData_Object&, HYDROData_Zone::MergeAltitudesType )];
491 Handle(HYDROData_Object) anObject1 =
492 Handle(HYDROData_Object)::DownCast( createHandle( a0 ) );
493 Handle(HYDROData_Object) anObject2 =
494 Handle(HYDROData_Object)::DownCast( createHandle( a2 ) );
496 Py_BEGIN_ALLOW_THREADS
497 sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRule( anObject1, a1, anObject2, a3 ) :
498 sipCpp->AddRule( anObject1, a1, anObject2, a3 );
507 * Creates new object in the internal data structure. Use higher level objects
508 * to create objects with real content.
510 HYDROData_CalculationCase();
513 * Destructs properties of the object and object itself, removes it from the document.
515 ~HYDROData_CalculationCase();