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
50 * Enumeration of tags corresponding to the persistent object parameters.
54 DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
55 DataTag_GeometryObject, ///< reference geometry objects
56 DataTag_ChildRegion, ///< child regions
57 DataTag_Region, ///< reference regions
58 DataTag_Polyline, ///< reference boundary polyline
59 DataTag_GeometryGroup, ///< reference geometry groups
60 DataTag_SplittedGroups, ///< reference splitted groups
61 DataTag_CustomRules, ///< custom rules
66 DEFINE_STANDARD_RTTI(HYDROData_CalculationCase);
69 * Returns the kind of this object. Must be redefined in all objects of known type.
71 HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_CALCULATION; }
74 * Updates the name of this object.
75 * Reimplemented to update the names of regions, zones and splitted groups.
77 HYDRODATA_EXPORT virtual void SetName( const QString& theName );
80 * Dump Calculation object to Python script representation.
82 HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
85 * Update the calcualtion case object.
86 * Call this method whenever you made changes for object data.
88 HYDRODATA_EXPORT virtual void Update();
91 * Returns the list of all reference objects of this object.
93 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
96 // Public methods to work with Calculation
99 * Add new one reference geometry object for calculation case.
101 HYDRODATA_EXPORT virtual bool AddGeometryObject( const Handle(HYDROData_Object)& theObject );
104 * Returns all reference geometry objects of calculation case.
106 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGeometryObjects() const;
109 * Removes reference geometry object from calculation case.
111 HYDRODATA_EXPORT virtual void RemoveGeometryObject( const Handle(HYDROData_Object)& theObject );
114 * Removes all reference geometry objects from calculation case.
116 HYDRODATA_EXPORT virtual void RemoveGeometryObjects();
120 * Add new one reference geometry group for calculation case.
122 HYDRODATA_EXPORT virtual bool AddGeometryGroup( const Handle(HYDROData_ShapesGroup)& theGroup );
125 * Returns all reference geometry groups of calculation case.
127 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGeometryGroups() const;
130 * Removes reference geometry group from calculation case.
132 HYDRODATA_EXPORT virtual void RemoveGeometryGroup( const Handle(HYDROData_ShapesGroup)& theGroup );
135 * Removes all reference geometry groups from calculation case.
137 HYDRODATA_EXPORT virtual void RemoveGeometryGroups();
141 * Sets reference boundary polyline object for calculation case.
143 HYDRODATA_EXPORT virtual void SetBoundaryPolyline( const Handle(HYDROData_PolylineXY)& thePolyline );
146 * Returns reference boundary polyline object of calculation case.
148 HYDRODATA_EXPORT virtual Handle(HYDROData_PolylineXY) GetBoundaryPolyline() const;
151 * Remove reference boundary polyline object from calculation case.
153 HYDRODATA_EXPORT virtual void RemoveBoundaryPolyline();
157 * Add new one child region for calculation case.
158 * The new region is added into the list of reference regions.
159 * The label of theZone is changed during this operation
160 * because of new region becomes the new parent for this zone.
162 HYDRODATA_EXPORT virtual Handle(HYDROData_Region) AddNewRegion( const Handle(HYDROData_Zone)& theZone );
166 * Add new one reference region for calculation case.
167 * The label of theRegion is changed in case if old parent is not this calculation.
169 HYDRODATA_EXPORT virtual bool AddRegion( const Handle(HYDROData_Region)& theRegion );
172 * Returns all reference regions of calculation case.
174 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetRegions() const;
177 * Updates names of regions to correct order.
179 HYDRODATA_EXPORT virtual void UpdateRegionsOrder();
182 * Removes reference region from calculation case.
184 HYDRODATA_EXPORT virtual void RemoveRegion( const Handle(HYDROData_Region)& theRegion );
187 * Removes all reference regions from calculation case.
189 HYDRODATA_EXPORT virtual void RemoveRegions();
193 * Returns all reference geometry groups of calculation case.
195 HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetSplittedGroups() const;
198 * Removes all reference geometry groups from calculation case.
200 HYDRODATA_EXPORT virtual void RemoveSplittedGroups();
204 * Exports the calculation case data (shell and groups) to GEOM module.
205 * \param theGeomEngine GEOM module engine
206 * \param theStudy SALOMEDS study, is used for publishing of GEOM objects
207 * \return true in case of success
209 HYDRODATA_EXPORT virtual bool Export( GEOM::GEOM_Gen_var theGeomEngine,
210 SALOMEDS::Study_ptr theStudy ) const;
213 // Public methods to work with Calculation services
216 * Returns altitude for given point.
217 * \param thePoint the point to examine
218 * \return result altitude value
220 HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint ) const;
223 * Returns altitude for given point on given region.
224 * \param thePoint the point to examine
225 * \param theRegion reference region to check
226 * \return result altitude value
228 HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint,
229 const Handle(HYDROData_Region)& theRegion ) const;
232 * Returns altitude for given point on given zone.
233 * \param thePoint the point to examine
234 * \param theZone reference zone to check
235 * \return result altitude value
237 HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint,
238 const Handle(HYDROData_Zone)& theZone ) const;
241 * Returns altitudes for given points on given region.
242 * \param thePoints the points to examine
243 * \param theRegion reference region to check
244 * \return result altitude value
246 HYDRODATA_EXPORT virtual NCollection_Sequence<double> GetAltitudesForPoints(
247 const NCollection_Sequence<gp_XY>& thePoints,
248 const Handle(HYDROData_Region)& theRegion ) const;
251 * Returns altitudes for given points on given zone.
252 * \param thePoints the points to examine
253 * \param theZone reference zone to check
254 * \return result altitude value
256 HYDRODATA_EXPORT virtual NCollection_Sequence<double> GetAltitudesForPoints(
257 const NCollection_Sequence<gp_XY>& thePoints,
258 const Handle(HYDROData_Zone)& theZone ) const;
261 * Returns region to which the point is belongs.
262 * \param thePoint the point to examine
263 * \return result region
265 HYDRODATA_EXPORT virtual Handle(HYDROData_Region) GetRegionFromPoint( const gp_XY& thePoint ) const;
268 * Returns zone to which the point is belongs.
269 * \param thePoint the point to examine
270 * \return result zone
272 HYDRODATA_EXPORT virtual Handle(HYDROData_Zone) GetZoneFromPoint( const gp_XY& thePoint ) const;
275 * Returns classification of point for given zone.
276 * \param thePoint the point to examine
277 * \param theZone the zone to examine
278 * \return result classification
280 HYDRODATA_EXPORT virtual PointClassification GetPointClassification(
281 const gp_XY& thePoint,
282 const Handle(HYDROData_Zone)& theZone ) const;
284 HYDRODATA_EXPORT void ClearRules();
285 HYDRODATA_EXPORT void AddRule( const Handle(HYDROData_Object)& theObject1,
286 HYDROData_PriorityType thePriority,
287 const Handle(HYDROData_Object)& theObject2,
288 HYDROData_Zone::MergeAltitudesType theMergeType );
290 HYDRODATA_EXPORT QString DumpRules();
295 * Add new one region for calculation case.
296 * The new region is added into the list of reference regions.
298 Handle(HYDROData_Region) addNewRegion( const Handle(HYDROData_Document)& theDoc,
299 const QString& thePrefixOrName,
300 bool isPrefix = true );
303 * Add new one splitted edges group for calculation case.
305 Handle(HYDROData_SplittedShapesGroup) addNewSplittedGroup( const QString& theName );
308 * Exports the given faces as shell and the given groups to GEOM module.
309 * \param theGeomEngine GEOM module engine
310 * \param theStudy SALOMEDS study, is used for publishing of GEOM objects
311 * \param theFaces the list of faces to make shell
312 * \param theSplittedGroups the list of groups
313 * \return true in case of success
315 bool Export( GEOM::GEOM_Gen_var theGeomEngine,
316 SALOMEDS::Study_ptr theStudy,
317 const TopTools_ListOfShape& theFaces,
318 const HYDROData_ShapesGroup::SeqOfGroupsDefs& theGroupsDefs ) const;
321 * Publish the given shape in GEOM as a GEOM object.
322 * \param theGeomEngine GEOM module engine
323 * \param theStudy SALOMEDS study, used for publishing of the shape
324 * \param theShape the shape to publish as a GEOM object
325 * \param theName the name of the published object
326 * \return the published GEOM object
328 GEOM::GEOM_Object_ptr publishShapeInGEOM( GEOM::GEOM_Gen_var theGeomEngine,
329 SALOMEDS::Study_ptr theStudy,
330 const TopoDS_Shape& theShape,
331 const QString& theName ) const;
333 void CreateRegionsDef( const Handle(HYDROData_Document)& theDoc,
334 const HYDROData_SplitToZonesTool::SplitDataList& theZones );
335 void CreateRegionsAuto( const Handle(HYDROData_Document)& theDoc,
336 const HYDROData_SplitToZonesTool::SplitDataList& theZones );
338 void CreateEdgeGroupsDef( const Handle(HYDROData_Document)& theDoc,
339 const HYDROData_SplitToZonesTool::SplitDataList& theEdges );
342 friend class HYDROData_Iterator;
345 * Creates new object in the internal data structure. Use higher level objects
346 * to create objects with real content.
348 HYDRODATA_EXPORT HYDROData_CalculationCase();
351 * Destructs properties of the object and object itself, removes it from the document.
353 HYDRODATA_EXPORT ~HYDROData_CalculationCase();