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