3 #ifndef HYDROData_CalculationCase_HeaderFile
4 #define HYDROData_CalculationCase_HeaderFile
6 #include <HYDROData_ShapesGroup.h>
7 #include <HYDROData_SplitToZonesTool.h>
8 #include <HYDROData_PriorityQueue.h>
9 #include <HYDROData_Zone.h>
10 #include <HYDROData_Warning.h>
13 #include <SALOMEconfig.h>
14 #include CORBA_SERVER_HEADER(GEOM_Gen)
20 class TopTools_ListOfShape;
22 class Handle(HYDROData_Object);
23 class Handle(HYDROData_Region);
24 class Handle(HYDROData_Zone);
25 class Handle(HYDROData_PolylineXY);
26 class Handle(HYDROData_ShapesGroup);
27 class Handle(HYDROData_SplittedShapesGroup);
28 class Handle(HYDROData_Document);
30 DEFINE_STANDARD_HANDLE(HYDROData_CalculationCase, HYDROData_Entity)
33 /**\class HYDROData_CalculationCase
34 * \brief Calculation case is defined by selection of Geometry objects with or without
\93Zone of water
\94.
37 class HYDROData_CalculationCase : public HYDROData_Entity
41 enum PointClassification
43 POINT_OUT, ///< point is out of zone face
44 POINT_IN, ///< point is inside of zone face
45 POINT_ON ///< point is on the edge of zone face
57 * Enumeration of tags corresponding to the persistent object parameters.
61 DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
62 DataTag_GeometryObject, ///< reference geometry objects
63 DataTag_ChildRegion, ///< child regions
64 DataTag_Region, ///< reference regions
65 DataTag_Polyline, ///< reference boundary polyline
66 DataTag_GeometryGroup, ///< reference geometry groups
67 DataTag_SplittedGroups, ///< reference splitted groups
68 DataTag_CustomRules, ///< custom rules
69 DataTag_AssignmentMode, ///< assignment mode
74 DEFINE_STANDARD_RTTI(HYDROData_CalculationCase);
77 * Returns the kind of this object. Must be redefined in all objects of known type.
79 HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_CALCULATION; }
82 * Updates the name of this object.
83 * Reimplemented to update the names of regions, zones and splitted groups.
85 HYDRODATA_EXPORT virtual void SetName( const QString& theName );
88 * Dump Calculation object to Python script representation.
90 HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
93 * Update the calcualtion case object.
94 * Call this method whenever you made changes for object data.
96 HYDRODATA_EXPORT virtual void Update();
99 * Returns the list of all reference objects of this object.
101 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
104 // Public methods to work with Calculation
107 * Add new one reference geometry object for calculation case.
109 HYDRODATA_EXPORT virtual bool AddGeometryObject( const Handle(HYDROData_Object)& theObject );
112 * Returns all reference geometry objects of calculation case.
114 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGeometryObjects() const;
117 * Removes reference geometry object from calculation case.
119 HYDRODATA_EXPORT virtual void RemoveGeometryObject( const Handle(HYDROData_Object)& theObject );
122 * Removes all reference geometry objects from calculation case.
124 HYDRODATA_EXPORT virtual void RemoveGeometryObjects();
128 * Add new one reference geometry group for calculation case.
130 HYDRODATA_EXPORT virtual bool AddGeometryGroup( const Handle(HYDROData_ShapesGroup)& theGroup );
133 * Returns all reference geometry groups of calculation case.
135 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGeometryGroups() const;
138 * Removes reference geometry group from calculation case.
140 HYDRODATA_EXPORT virtual void RemoveGeometryGroup( const Handle(HYDROData_ShapesGroup)& theGroup );
143 * Removes all reference geometry groups from calculation case.
145 HYDRODATA_EXPORT virtual void RemoveGeometryGroups();
149 * Sets reference boundary polyline object for calculation case.
151 HYDRODATA_EXPORT virtual void SetBoundaryPolyline( const Handle(HYDROData_PolylineXY)& thePolyline );
154 * Returns reference boundary polyline object of calculation case.
156 HYDRODATA_EXPORT virtual Handle(HYDROData_PolylineXY) GetBoundaryPolyline() const;
159 * Remove reference boundary polyline object from calculation case.
161 HYDRODATA_EXPORT virtual void RemoveBoundaryPolyline();
165 * Add new one child region for calculation case.
166 * The new region is added into the list of reference regions.
167 * The label of theZone is changed during this operation
168 * because of new region becomes the new parent for this zone.
170 HYDRODATA_EXPORT virtual Handle(HYDROData_Region) AddNewRegion( const Handle(HYDROData_Zone)& theZone );
174 * Add new one reference region for calculation case.
175 * The label of theRegion is changed in case if old parent is not this calculation.
177 HYDRODATA_EXPORT virtual bool AddRegion( const Handle(HYDROData_Region)& theRegion );
180 * Returns all reference regions of calculation case.
182 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetRegions() const;
185 * Updates names of regions to correct order.
187 HYDRODATA_EXPORT virtual void UpdateRegionsOrder();
190 * Removes reference region from calculation case.
192 HYDRODATA_EXPORT virtual void RemoveRegion( const Handle(HYDROData_Region)& theRegion );
195 * Removes all reference regions from calculation case.
197 HYDRODATA_EXPORT virtual void RemoveRegions();
201 * Returns all reference geometry groups of calculation case.
203 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetSplittedGroups() const;
206 * Removes all reference geometry groups from calculation case.
208 HYDRODATA_EXPORT virtual void RemoveSplittedGroups();
211 * Exports the calculation case data (shell and groups) to GEOM module.
212 * \param theStudyId the id of the study where the GEOM module should be used for export
213 * \return the entry of the GEOM object (empty string in the case of error)
215 HYDRODATA_EXPORT virtual QString Export( int theStudyId ) const;
218 * Exports the calculation case data (shell and groups) to GEOM module.
219 * \param theGeomEngine GEOM module engine
220 * \param theStudy SALOMEDS study, is used for publishing of GEOM objects
221 * \return true in case of success
223 HYDRODATA_EXPORT virtual bool Export( GEOM::GEOM_Gen_var theGeomEngine,
224 SALOMEDS::Study_ptr theStudy,
225 QString& theGeomObjEntry ) const;
228 // Public methods to work with Calculation services
231 * Returns altitude for given point.
232 * \param thePoint the point to examine
233 * \return result altitude value
235 HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint ) const;
238 * Returns altitude for given point on given region.
239 * \param thePoint the point to examine
240 * \param theRegion reference region to check
241 * \return result altitude value
243 HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint,
244 const Handle(HYDROData_Region)& theRegion ) const;
247 * Returns altitude for given point on given zone.
248 * \param thePoint the point to examine
249 * \param theZone reference zone to check
250 * \return result altitude value
252 HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint,
253 const Handle(HYDROData_Zone)& theZone ) const;
256 * Returns altitudes for given points on given region.
257 * \param thePoints the points to examine
258 * \param theRegion reference region to check
259 * \return result altitude value
261 HYDRODATA_EXPORT virtual NCollection_Sequence<double> GetAltitudesForPoints(
262 const NCollection_Sequence<gp_XY>& thePoints,
263 const Handle(HYDROData_Region)& theRegion ) const;
266 * Returns altitudes for given points on given zone.
267 * \param thePoints the points to examine
268 * \param theZone reference zone to check
269 * \return result altitude value
271 HYDRODATA_EXPORT virtual NCollection_Sequence<double> GetAltitudesForPoints(
272 const NCollection_Sequence<gp_XY>& thePoints,
273 const Handle(HYDROData_Zone)& theZone ) const;
276 * Returns region to which the point is belongs.
277 * \param thePoint the point to examine
278 * \return result region
280 HYDRODATA_EXPORT virtual Handle(HYDROData_Region) GetRegionFromPoint( const gp_XY& thePoint ) const;
283 * Returns zone to which the point is belongs.
284 * \param thePoint the point to examine
285 * \return result zone
287 HYDRODATA_EXPORT virtual Handle(HYDROData_Zone) GetZoneFromPoint( const gp_XY& thePoint ) const;
290 * Returns classification of point for given zone.
291 * \param thePoint the point to examine
292 * \param theZone the zone to examine
293 * \return result classification
295 HYDRODATA_EXPORT virtual PointClassification GetPointClassification(
296 const gp_XY& thePoint,
297 const Handle(HYDROData_Zone)& theZone ) const;
299 HYDRODATA_EXPORT void SetAssignmentMode( AssignmentMode theMode );
300 HYDRODATA_EXPORT AssignmentMode GetAssignmentMode() const;
302 HYDRODATA_EXPORT void ClearRules( const bool theIsSetToUpdate = true );
303 HYDRODATA_EXPORT void AddRule( const Handle(HYDROData_Object)& theObject1,
304 HYDROData_PriorityType thePriority,
305 const Handle(HYDROData_Object)& theObject2,
306 HYDROData_Zone::MergeAltitudesType theMergeType );
307 HYDRODATA_EXPORT bool GetRule( int theIndex,
308 Handle(HYDROData_Object)& theObject1,
309 HYDROData_PriorityType& thePriority,
310 Handle(HYDROData_Object)& theObject2,
311 HYDROData_Zone::MergeAltitudesType& theMergeType ) const;
313 HYDRODATA_EXPORT QString DumpRules() const;
315 HYDRODATA_EXPORT HYDROData_Warning GetLastWarning() const;
320 * Add new one region for calculation case.
321 * The new region is added into the list of reference regions.
323 Handle(HYDROData_Region) addNewRegion( const Handle(HYDROData_Document)& theDoc,
324 const QString& thePrefixOrName,
325 bool isPrefix = true );
328 * Add new one splitted edges group for calculation case.
330 Handle(HYDROData_SplittedShapesGroup) addNewSplittedGroup( const QString& theName );
333 * Exports the given faces as shell and the given groups to GEOM module.
334 * \param theGeomEngine GEOM module engine
335 * \param theStudy SALOMEDS study, is used for publishing of GEOM objects
336 * \param theFaces the list of faces to make shell
337 * \param theSplittedGroups the list of groups
338 * \return true in case of success
340 bool Export( GEOM::GEOM_Gen_var theGeomEngine,
341 SALOMEDS::Study_ptr theStudy,
342 const TopTools_ListOfShape& theFaces,
343 const HYDROData_ShapesGroup::SeqOfGroupsDefs& theGroupsDefs,
344 QString& theGeomObjEntry ) const;
347 * Publish the given shape in GEOM as a GEOM object.
348 * \param theGeomEngine GEOM module engine
349 * \param theStudy SALOMEDS study, used for publishing of the shape
350 * \param theShape the shape to publish as a GEOM object
351 * \param theName the name of the published object
352 * \return the published GEOM object
354 GEOM::GEOM_Object_ptr publishShapeInGEOM( GEOM::GEOM_Gen_var theGeomEngine,
355 SALOMEDS::Study_ptr theStudy,
356 const TopoDS_Shape& theShape,
357 const QString& theName,
358 QString& theGeomObjEntry ) const;
360 void CreateRegionsDef( const Handle(HYDROData_Document)& theDoc,
361 const HYDROData_SplitToZonesTool::SplitDataList& theZones );
362 void CreateRegionsAuto( const Handle(HYDROData_Document)& theDoc,
363 const HYDROData_SplitToZonesTool::SplitDataList& theZones );
365 void CreateEdgeGroupsDef( const Handle(HYDROData_Document)& theDoc,
366 const HYDROData_SplitToZonesTool::SplitDataList& theEdges );
368 void DumpRulesToPython( const QString& theCalcCaseName, QStringList& theScript ) const;
370 void SetWarning( HYDROData_WarningType theType = WARN_OK, const QString& theData = "" );
373 friend class HYDROData_Iterator;
376 * Creates new object in the internal data structure. Use higher level objects
377 * to create objects with real content.
379 HYDRODATA_EXPORT HYDROData_CalculationCase();
382 * Destructs properties of the object and object itself, removes it from the document.
384 HYDRODATA_EXPORT ~HYDROData_CalculationCase();
386 void DumpSampleMeshing( QStringList& theScript,
387 const QString& theStudyName,
388 const QString& theGeomShapeName,
389 const QString& theMeshName ) const;
392 HYDROData_Warning myLastWarning;