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();
212 * Exports the calculation case data (shell and groups) to GEOM module.
213 * \param theGeomEngine GEOM module engine
214 * \param theStudy SALOMEDS study, is used for publishing of GEOM objects
215 * \return true in case of success
217 HYDRODATA_EXPORT virtual bool Export( GEOM::GEOM_Gen_var theGeomEngine,
218 SALOMEDS::Study_ptr theStudy ) const;
221 // Public methods to work with Calculation services
224 * Returns altitude for given point.
225 * \param thePoint the point to examine
226 * \return result altitude value
228 HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint ) const;
231 * Returns altitude for given point on given region.
232 * \param thePoint the point to examine
233 * \param theRegion reference region to check
234 * \return result altitude value
236 HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint,
237 const Handle(HYDROData_Region)& theRegion ) const;
240 * Returns altitude for given point on given zone.
241 * \param thePoint the point to examine
242 * \param theZone reference zone to check
243 * \return result altitude value
245 HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint,
246 const Handle(HYDROData_Zone)& theZone ) const;
249 * Returns altitudes for given points on given region.
250 * \param thePoints the points to examine
251 * \param theRegion reference region to check
252 * \return result altitude value
254 HYDRODATA_EXPORT virtual NCollection_Sequence<double> GetAltitudesForPoints(
255 const NCollection_Sequence<gp_XY>& thePoints,
256 const Handle(HYDROData_Region)& theRegion ) const;
259 * Returns altitudes for given points on given zone.
260 * \param thePoints the points to examine
261 * \param theZone reference zone to check
262 * \return result altitude value
264 HYDRODATA_EXPORT virtual NCollection_Sequence<double> GetAltitudesForPoints(
265 const NCollection_Sequence<gp_XY>& thePoints,
266 const Handle(HYDROData_Zone)& theZone ) const;
269 * Returns region to which the point is belongs.
270 * \param thePoint the point to examine
271 * \return result region
273 HYDRODATA_EXPORT virtual Handle(HYDROData_Region) GetRegionFromPoint( const gp_XY& thePoint ) const;
276 * Returns zone to which the point is belongs.
277 * \param thePoint the point to examine
278 * \return result zone
280 HYDRODATA_EXPORT virtual Handle(HYDROData_Zone) GetZoneFromPoint( const gp_XY& thePoint ) const;
283 * Returns classification of point for given zone.
284 * \param thePoint the point to examine
285 * \param theZone the zone to examine
286 * \return result classification
288 HYDRODATA_EXPORT virtual PointClassification GetPointClassification(
289 const gp_XY& thePoint,
290 const Handle(HYDROData_Zone)& theZone ) const;
292 HYDRODATA_EXPORT void SetAssignmentMode( AssignmentMode theMode );
293 HYDRODATA_EXPORT AssignmentMode GetAssignmentMode() const;
295 HYDRODATA_EXPORT void ClearRules( const bool theIsSetToUpdate = true );
296 HYDRODATA_EXPORT void AddRule( const Handle(HYDROData_Object)& theObject1,
297 HYDROData_PriorityType thePriority,
298 const Handle(HYDROData_Object)& theObject2,
299 HYDROData_Zone::MergeAltitudesType theMergeType );
300 HYDRODATA_EXPORT bool GetRule( int theIndex,
301 Handle(HYDROData_Object)& theObject1,
302 HYDROData_PriorityType& thePriority,
303 Handle(HYDROData_Object)& theObject2,
304 HYDROData_Zone::MergeAltitudesType& theMergeType ) const;
306 HYDRODATA_EXPORT QString DumpRules() const;
308 HYDRODATA_EXPORT HYDROData_Warning GetLastWarning() const;
313 * Add new one region for calculation case.
314 * The new region is added into the list of reference regions.
316 Handle(HYDROData_Region) addNewRegion( const Handle(HYDROData_Document)& theDoc,
317 const QString& thePrefixOrName,
318 bool isPrefix = true );
321 * Add new one splitted edges group for calculation case.
323 Handle(HYDROData_SplittedShapesGroup) addNewSplittedGroup( const QString& theName );
326 * Exports the given faces as shell and the given groups to GEOM module.
327 * \param theGeomEngine GEOM module engine
328 * \param theStudy SALOMEDS study, is used for publishing of GEOM objects
329 * \param theFaces the list of faces to make shell
330 * \param theSplittedGroups the list of groups
331 * \return true in case of success
333 bool Export( GEOM::GEOM_Gen_var theGeomEngine,
334 SALOMEDS::Study_ptr theStudy,
335 const TopTools_ListOfShape& theFaces,
336 const HYDROData_ShapesGroup::SeqOfGroupsDefs& theGroupsDefs ) const;
339 * Publish the given shape in GEOM as a GEOM object.
340 * \param theGeomEngine GEOM module engine
341 * \param theStudy SALOMEDS study, used for publishing of the shape
342 * \param theShape the shape to publish as a GEOM object
343 * \param theName the name of the published object
344 * \return the published GEOM object
346 GEOM::GEOM_Object_ptr publishShapeInGEOM( GEOM::GEOM_Gen_var theGeomEngine,
347 SALOMEDS::Study_ptr theStudy,
348 const TopoDS_Shape& theShape,
349 const QString& theName ) const;
351 void CreateRegionsDef( const Handle(HYDROData_Document)& theDoc,
352 const HYDROData_SplitToZonesTool::SplitDataList& theZones );
353 void CreateRegionsAuto( const Handle(HYDROData_Document)& theDoc,
354 const HYDROData_SplitToZonesTool::SplitDataList& theZones );
356 void CreateEdgeGroupsDef( const Handle(HYDROData_Document)& theDoc,
357 const HYDROData_SplitToZonesTool::SplitDataList& theEdges );
359 void DumpRulesToPython( const QString& theCalcCaseName, QStringList& theScript ) const;
361 void SetWarning( HYDROData_WarningType theType = WARN_OK, const QString& theData = "" );
364 friend class HYDROData_Iterator;
367 * Creates new object in the internal data structure. Use higher level objects
368 * to create objects with real content.
370 HYDRODATA_EXPORT HYDROData_CalculationCase();
373 * Destructs properties of the object and object itself, removes it from the document.
375 HYDRODATA_EXPORT ~HYDROData_CalculationCase();
378 HYDROData_Warning myLastWarning;