Salome HOME
eef8ea0b2ad04a10119b4a03a4931bfbd72f79f6
[modules/hydro.git] / src / HYDROData / HYDROData_CalculationCase.h
1
2
3 #ifndef HYDROData_CalculationCase_HeaderFile
4 #define HYDROData_CalculationCase_HeaderFile
5
6 #include <HYDROData_Entity.h>
7
8 class gp_XY;
9
10 class TopoDS_Shell;
11
12 class Handle(HYDROData_Object);
13 class Handle(HYDROData_Region);
14 class Handle(HYDROData_Zone);
15 class Handle(HYDROData_PolylineXY);
16 class Handle(HYDROData_EdgesGroup);
17 class Handle(HYDROData_SplittedEdgesGroup);
18
19 DEFINE_STANDARD_HANDLE(HYDROData_CalculationCase, HYDROData_Entity)
20
21
22 /**\class HYDROData_CalculationCase
23  * \brief Calculation case is defined by selection of Geometry objects with or without \93Zone of water\94.
24  *
25  */
26 class HYDROData_CalculationCase : public HYDROData_Entity
27 {
28 public:
29
30   enum PointClassification
31   {
32     POINT_OUT,  ///< point is out of zone face
33     POINT_IN,   ///< point is inside of zone face
34     POINT_ON    ///< point is on the edge of zone face
35   };
36
37 protected:
38
39   /**
40    * Enumeration of tags corresponding to the persistent object parameters.
41    */
42   enum DataTag
43   {
44     DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
45     DataTag_GeometryObject,   ///< reference geometry objects
46     DataTag_ChildRegion,      ///< child regions
47     DataTag_Region,           ///< reference regions
48     DataTag_Polyline,         ///< reference boundary polyline
49     DataTag_GeometryGroup,    ///< reference geometry groups
50     DataTag_SplittedGroups,   ///< reference splitted groups
51   };
52
53 public:
54
55   DEFINE_STANDARD_RTTI(HYDROData_CalculationCase);
56
57   /**
58    * Returns the kind of this object. Must be redefined in all objects of known type.
59    */
60   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_CALCULATION; }
61
62   /**
63    * Updates the name of this object.
64    * Reimplemented to update the names of regions and zones.
65    */
66   HYDRODATA_EXPORT virtual void SetName( const QString& theName );
67
68   /**
69    * Dump Calculation object to Python script representation.
70    */
71   HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
72
73   /**
74    * Update the calcualtion case object.
75    * Call this method whenever you made changes for object data.
76    */
77   HYDRODATA_EXPORT virtual void Update();
78
79   /**
80    * Returns the list of all reference objects of this object.
81    */
82   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
83
84 public:      
85   // Public methods to work with Calculation
86
87   /**
88    * Add new one reference geometry object for calculation case.
89    */
90   HYDRODATA_EXPORT virtual bool AddGeometryObject( const Handle(HYDROData_Object)& theObject );
91
92   /**
93    * Returns all reference geometry objects of calculation case.
94    */
95   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGeometryObjects() const;
96
97   /**
98    * Removes reference geometry object from calculation case.
99    */
100   HYDRODATA_EXPORT virtual void RemoveGeometryObject( const Handle(HYDROData_Object)& theObject );
101
102   /**
103    * Removes all reference geometry objects from calculation case.
104    */
105   HYDRODATA_EXPORT virtual void RemoveGeometryObjects();
106
107
108   /**
109    * Add new one reference geometry group for calculation case.
110    */
111   HYDRODATA_EXPORT virtual bool AddGeometryGroup( const Handle(HYDROData_EdgesGroup)& theGroup );
112
113   /**
114    * Returns all reference geometry groups of calculation case.
115    */
116   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGeometryGroups() const;
117
118   /**
119    * Removes reference geometry group from calculation case.
120    */
121   HYDRODATA_EXPORT virtual void RemoveGeometryGroup( const Handle(HYDROData_EdgesGroup)& theGroup );
122
123   /**
124    * Removes all reference geometry groups from calculation case.
125    */
126   HYDRODATA_EXPORT virtual void RemoveGeometryGroups();
127
128
129   /**
130    * Sets reference boundary polyline object for calculation case.
131    */
132   HYDRODATA_EXPORT virtual void SetBoundaryPolyline( const Handle(HYDROData_PolylineXY)& thePolyline );
133
134   /**
135    * Returns reference boundary polyline object of calculation case.
136    */
137   HYDRODATA_EXPORT virtual Handle(HYDROData_PolylineXY) GetBoundaryPolyline() const;
138
139   /**
140    * Remove reference boundary polyline object from calculation case.
141    */
142   HYDRODATA_EXPORT virtual void RemoveBoundaryPolyline();
143
144
145   /**
146    * Add new one child region for calculation case.
147    * The new region is added into the list of reference regions.
148    * The label of theZone is changed during this operation
149    * because of new region becomes the new parent for this zone.
150    */
151   HYDRODATA_EXPORT virtual Handle(HYDROData_Region) AddNewRegion( const Handle(HYDROData_Zone)& theZone );
152
153
154   /**
155    * Add new one reference region for calculation case.
156    * The label of theRegion is changed in case if old parent is not this calculation.
157    */
158   HYDRODATA_EXPORT virtual bool AddRegion( const Handle(HYDROData_Region)& theRegion );
159
160   /**
161    * Returns all reference regions of calculation case.
162    */
163   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetRegions() const;
164
165   /**
166    * Updates names of regions to correct order.
167    */
168   HYDRODATA_EXPORT virtual void UpdateRegionsOrder();
169
170   /**
171    * Removes reference region from calculation case.
172    */
173   HYDRODATA_EXPORT virtual void RemoveRegion( const Handle(HYDROData_Region)& theRegion );
174
175   /**
176    * Removes all reference regions from calculation case.
177    */
178   HYDRODATA_EXPORT virtual void RemoveRegions();
179
180   
181   /**
182    * Returns all reference geometry groups of calculation case.
183    */
184   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetSplittedGroups() const;
185
186   /**
187    * Removes all reference geometry groups from calculation case.
188    */
189   HYDRODATA_EXPORT virtual void RemoveSplittedGroups();
190
191
192   /**
193    * Returns shell containing faces which correspond to regions.
194    * \return shell as TopoDS_Shell
195    */
196   HYDRODATA_EXPORT virtual TopoDS_Shell GetShell();
197
198
199 public:      
200   // Public methods to work with Calculation services
201
202   /**
203    * Returns altitude for given point.
204    * \param thePoint the point to examine
205    * \return result altitude value
206    */
207   HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint ) const;
208
209   /**
210    * Returns zone to which the point is belongs.
211    * \param thePoint the point to examine
212    * \return result zone
213    */
214   HYDRODATA_EXPORT virtual Handle(HYDROData_Zone) GetZoneFromPoint( const gp_XY& thePoint ) const;
215
216   /**
217    * Returns classification of point for given zone.
218    * \param thePoint the point to examine
219    * \param theZone the zone to examine
220    * \return result classification
221    */
222   HYDRODATA_EXPORT virtual PointClassification GetPointClassification(
223     const gp_XY&                  thePoint,
224     const Handle(HYDROData_Zone)& theZone ) const;
225
226 private:
227
228   /**
229    * Add new one region for calculation case.
230    * The new region is added into the list of reference regions.
231    */
232   HYDRODATA_EXPORT virtual Handle(HYDROData_Region) addNewRegion();
233
234   /**
235    * Add new one splitted edges group for calculation case.
236    */
237   HYDRODATA_EXPORT virtual Handle(HYDROData_SplittedEdgesGroup) addNewSplittedGroup();
238
239 protected:
240
241   friend class HYDROData_Iterator;
242
243   /**
244    * Creates new object in the internal data structure. Use higher level objects 
245    * to create objects with real content.
246    */
247   HYDRODATA_EXPORT HYDROData_CalculationCase();
248
249   /**
250    * Destructs properties of the object and object itself, removes it from the document.
251    */
252   HYDRODATA_EXPORT ~HYDROData_CalculationCase();
253 };
254
255 #endif