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>
12 #include <SALOMEconfig.h>
13 #include CORBA_SERVER_HEADER(GEOM_Gen)
19 class TopTools_ListOfShape;
21 class Handle(HYDROData_Object);
22 class Handle(HYDROData_Region);
23 class Handle(HYDROData_Zone);
24 class Handle(HYDROData_PolylineXY);
25 class Handle(HYDROData_ShapesGroup);
26 class Handle(HYDROData_SplittedShapesGroup);
27 class Handle(HYDROData_Document);
29 DEFINE_STANDARD_HANDLE(HYDROData_CalculationCase, HYDROData_Entity)
32 /**\class HYDROData_CalculationCase
33 * \brief Calculation case is defined by selection of Geometry objects with or without
\93Zone of water
\94.
36 class HYDROData_CalculationCase : public HYDROData_Entity
40 enum PointClassification
42 POINT_OUT, ///< point is out of zone face
43 POINT_IN, ///< point is inside of zone face
44 POINT_ON ///< point is on the edge of zone face
56 * Enumeration of tags corresponding to the persistent object parameters.
60 DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
61 DataTag_GeometryObject, ///< reference geometry objects
62 DataTag_ChildRegion, ///< child regions
63 DataTag_Region, ///< reference regions
64 DataTag_Polyline, ///< reference boundary polyline
65 DataTag_GeometryGroup, ///< reference geometry groups
66 DataTag_SplittedGroups, ///< reference splitted groups
67 DataTag_CustomRules, ///< custom rules
68 DataTag_AssignmentMode, ///< assignment mode
73 DEFINE_STANDARD_RTTI(HYDROData_CalculationCase);
76 * Returns the kind of this object. Must be redefined in all objects of known type.
78 HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_CALCULATION; }
81 * Updates the name of this object.
82 * Reimplemented to update the names of regions, zones and splitted groups.
84 HYDRODATA_EXPORT virtual void SetName( const QString& theName );
87 * Dump Calculation object to Python script representation.
89 HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
92 * Update the calcualtion case object.
93 * Call this method whenever you made changes for object data.
95 HYDRODATA_EXPORT virtual void Update();
98 * Returns the list of all reference objects of this object.
100 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
103 // Public methods to work with Calculation
106 * Add new one reference geometry object for calculation case.
108 HYDRODATA_EXPORT virtual bool AddGeometryObject( const Handle(HYDROData_Object)& theObject );
111 * Returns all reference geometry objects of calculation case.
113 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGeometryObjects() const;
116 * Removes reference geometry object from calculation case.
118 HYDRODATA_EXPORT virtual void RemoveGeometryObject( const Handle(HYDROData_Object)& theObject );
121 * Removes all reference geometry objects from calculation case.
123 HYDRODATA_EXPORT virtual void RemoveGeometryObjects();
127 * Add new one reference geometry group for calculation case.
129 HYDRODATA_EXPORT virtual bool AddGeometryGroup( const Handle(HYDROData_ShapesGroup)& theGroup );
132 * Returns all reference geometry groups of calculation case.
134 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGeometryGroups() const;
137 * Removes reference geometry group from calculation case.
139 HYDRODATA_EXPORT virtual void RemoveGeometryGroup( const Handle(HYDROData_ShapesGroup)& theGroup );
142 * Removes all reference geometry groups from calculation case.
144 HYDRODATA_EXPORT virtual void RemoveGeometryGroups();
148 * Sets reference boundary polyline object for calculation case.
150 HYDRODATA_EXPORT virtual void SetBoundaryPolyline( const Handle(HYDROData_PolylineXY)& thePolyline );
153 * Returns reference boundary polyline object of calculation case.
155 HYDRODATA_EXPORT virtual Handle(HYDROData_PolylineXY) GetBoundaryPolyline() const;
158 * Remove reference boundary polyline object from calculation case.
160 HYDRODATA_EXPORT virtual void RemoveBoundaryPolyline();
164 * Add new one child region for calculation case.
165 * The new region is added into the list of reference regions.
166 * The label of theZone is changed during this operation
167 * because of new region becomes the new parent for this zone.
169 HYDRODATA_EXPORT virtual Handle(HYDROData_Region) AddNewRegion( const Handle(HYDROData_Zone)& theZone );
173 * Add new one reference region for calculation case.
174 * The label of theRegion is changed in case if old parent is not this calculation.
176 HYDRODATA_EXPORT virtual bool AddRegion( const Handle(HYDROData_Region)& theRegion );
179 * Returns all reference regions of calculation case.
181 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetRegions() const;
184 * Updates names of regions to correct order.
186 HYDRODATA_EXPORT virtual void UpdateRegionsOrder();
189 * Removes reference region from calculation case.
191 HYDRODATA_EXPORT virtual void RemoveRegion( const Handle(HYDROData_Region)& theRegion );
194 * Removes all reference regions from calculation case.
196 HYDRODATA_EXPORT virtual void RemoveRegions();
200 * Returns all reference geometry groups of calculation case.
202 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetSplittedGroups() const;
205 * Removes all reference geometry groups from calculation case.
207 HYDRODATA_EXPORT virtual void RemoveSplittedGroups();
211 * Exports the calculation case data (shell and groups) to GEOM module.
212 * \param theGeomEngine GEOM module engine
213 * \param theStudy SALOMEDS study, is used for publishing of GEOM objects
214 * \return true in case of success
216 HYDRODATA_EXPORT virtual bool Export( GEOM::GEOM_Gen_var theGeomEngine,
217 SALOMEDS::Study_ptr theStudy ) const;
220 // Public methods to work with Calculation services
223 * Returns altitude for given point.
224 * \param thePoint the point to examine
225 * \return result altitude value
227 HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint ) const;
230 * Returns altitude for given point on given region.
231 * \param thePoint the point to examine
232 * \param theRegion reference region to check
233 * \return result altitude value
235 HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint,
236 const Handle(HYDROData_Region)& theRegion ) const;
239 * Returns altitude for given point on given zone.
240 * \param thePoint the point to examine
241 * \param theZone reference zone to check
242 * \return result altitude value
244 HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint,
245 const Handle(HYDROData_Zone)& theZone ) const;
248 * Returns altitudes for given points on given region.
249 * \param thePoints the points to examine
250 * \param theRegion reference region to check
251 * \return result altitude value
253 HYDRODATA_EXPORT virtual NCollection_Sequence<double> GetAltitudesForPoints(
254 const NCollection_Sequence<gp_XY>& thePoints,
255 const Handle(HYDROData_Region)& theRegion ) const;
258 * Returns altitudes for given points on given zone.
259 * \param thePoints the points to examine
260 * \param theZone reference zone to check
261 * \return result altitude value
263 HYDRODATA_EXPORT virtual NCollection_Sequence<double> GetAltitudesForPoints(
264 const NCollection_Sequence<gp_XY>& thePoints,
265 const Handle(HYDROData_Zone)& theZone ) const;
268 * Returns region to which the point is belongs.
269 * \param thePoint the point to examine
270 * \return result region
272 HYDRODATA_EXPORT virtual Handle(HYDROData_Region) GetRegionFromPoint( const gp_XY& thePoint ) const;
275 * Returns zone to which the point is belongs.
276 * \param thePoint the point to examine
277 * \return result zone
279 HYDRODATA_EXPORT virtual Handle(HYDROData_Zone) GetZoneFromPoint( const gp_XY& thePoint ) const;
282 * Returns classification of point for given zone.
283 * \param thePoint the point to examine
284 * \param theZone the zone to examine
285 * \return result classification
287 HYDRODATA_EXPORT virtual PointClassification GetPointClassification(
288 const gp_XY& thePoint,
289 const Handle(HYDROData_Zone)& theZone ) const;
291 HYDRODATA_EXPORT void SetAssignmentMode( AssignmentMode theMode );
292 HYDRODATA_EXPORT AssignmentMode GetAssignmentMode() const;
294 HYDRODATA_EXPORT void ClearRules();
295 HYDRODATA_EXPORT void AddRule( const Handle(HYDROData_Object)& theObject1,
296 HYDROData_PriorityType thePriority,
297 const Handle(HYDROData_Object)& theObject2,
298 HYDROData_Zone::MergeAltitudesType theMergeType );
300 HYDRODATA_EXPORT QString DumpRules();
305 * Add new one region for calculation case.
306 * The new region is added into the list of reference regions.
308 Handle(HYDROData_Region) addNewRegion( const Handle(HYDROData_Document)& theDoc,
309 const QString& thePrefixOrName,
310 bool isPrefix = true );
313 * Add new one splitted edges group for calculation case.
315 Handle(HYDROData_SplittedShapesGroup) addNewSplittedGroup( const QString& theName );
318 * Exports the given faces as shell and the given groups to GEOM module.
319 * \param theGeomEngine GEOM module engine
320 * \param theStudy SALOMEDS study, is used for publishing of GEOM objects
321 * \param theFaces the list of faces to make shell
322 * \param theSplittedGroups the list of groups
323 * \return true in case of success
325 bool Export( GEOM::GEOM_Gen_var theGeomEngine,
326 SALOMEDS::Study_ptr theStudy,
327 const TopTools_ListOfShape& theFaces,
328 const HYDROData_ShapesGroup::SeqOfGroupsDefs& theGroupsDefs ) const;
331 * Publish the given shape in GEOM as a GEOM object.
332 * \param theGeomEngine GEOM module engine
333 * \param theStudy SALOMEDS study, used for publishing of the shape
334 * \param theShape the shape to publish as a GEOM object
335 * \param theName the name of the published object
336 * \return the published GEOM object
338 GEOM::GEOM_Object_ptr publishShapeInGEOM( GEOM::GEOM_Gen_var theGeomEngine,
339 SALOMEDS::Study_ptr theStudy,
340 const TopoDS_Shape& theShape,
341 const QString& theName ) const;
343 void CreateRegionsDef( const Handle(HYDROData_Document)& theDoc,
344 const HYDROData_SplitToZonesTool::SplitDataList& theZones );
345 void CreateRegionsAuto( const Handle(HYDROData_Document)& theDoc,
346 const HYDROData_SplitToZonesTool::SplitDataList& theZones );
348 void CreateEdgeGroupsDef( const Handle(HYDROData_Document)& theDoc,
349 const HYDROData_SplitToZonesTool::SplitDataList& theEdges );
351 void DumpRulesToPython( const QString& theCalcCaseName, QStringList& theScript ) const;
354 friend class HYDROData_Iterator;
357 * Creates new object in the internal data structure. Use higher level objects
358 * to create objects with real content.
360 HYDRODATA_EXPORT HYDROData_CalculationCase();
363 * Destructs properties of the object and object itself, removes it from the document.
365 HYDRODATA_EXPORT ~HYDROData_CalculationCase();