Salome HOME
Initial merge of branch 'BR_HYDRO_IMPS_2016' into BR_PORTING_OCCT_7
[modules/hydro.git] / src / HYDROData / HYDROData_Zone.h
1 // Copyright (C) 2014-2015  EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
6 //
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10 // Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 #ifndef HYDROData_Zone_HeaderFile
20 #define HYDROData_Zone_HeaderFile
21
22 #include "HYDROData_Entity.h"
23 #include "HYDROData_IInterpolator.h"
24
25 class HYDROData_LandCover;
26 class TopoDS_Shape;
27
28
29 /**\class HYDROData_Zone
30  * \brief Class that stores/retreives information about the 2d face.
31  */
32 class HYDROData_Zone : public HYDROData_Entity
33 {
34
35 public:
36   // Enumeration of mergin types for conflict altitudes/types
37   enum MergeType
38   {
39     Merge_UNKNOWN, // Undefined
40     Merge_ZMIN,    // The minimum values
41     Merge_ZMAX,    // The maximum values
42     Merge_Object   // Only one altitude/land cover will be taken into account
43   };
44
45 protected:
46   /**
47    * Enumeration of tags corresponding to the persistent object parameters.
48    */
49   enum DataTag
50   {
51     DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
52     DataTag_Shape,           ///< reference shape
53     DataTag_Object,          ///< reference objects
54     DataTag_MergeType,       ///< mergin type of conflict bathymetries/types
55     DataTag_MergeObject,     ///< reference altitude/land cover for conflict merge
56   };
57
58 public:
59   DEFINE_STANDARD_RTTIEXT(HYDROData_Zone, HYDROData_Entity);
60
61   /**
62    * Returns the kind of this object. Must be redefined in all objects of known type.
63    */
64   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_ZONE; }
65
66
67   /**
68    * Returns flag indicating that object is updateble or not.
69    */
70   HYDRODATA_EXPORT virtual bool CanBeUpdated() const;
71
72
73   /**
74    * Checks that object has 2D presentation. Reimlemented to retun true.
75    */
76   HYDRODATA_EXPORT virtual bool IsHas2dPrs() const;
77
78
79   /**
80    * Returns flag indicating that object can be removed or not.
81    */
82   HYDRODATA_EXPORT virtual bool CanRemove();
83
84   /**
85    * Returns the list of all reference objects of this object.
86    */
87   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
88
89
90   /**
91    * Sets the shape of the zone.
92    */
93   HYDRODATA_EXPORT virtual void SetShape( const TopoDS_Shape& theShape );
94
95   /**
96    * Returns the shape of the zone.
97    */
98   HYDRODATA_EXPORT virtual TopoDS_Shape GetShape() const;
99
100
101   /**
102    * Returns true if zone needs merge of bathymetries.
103    */
104   HYDRODATA_EXPORT virtual bool IsMergingNeed() const;
105
106
107   /**
108    * Sets the interpolator for zone. By default it is NULL and original
109    * interpolation algorithms are used to calculate points altitudes.
110    * If you set interpolator it won't be stored in the data model structure,
111    * it will be deleted during that time as this zone will be freed.
112    */
113   HYDRODATA_EXPORT virtual void SetInterpolator( HYDROData_IInterpolator* theInter );
114
115   /**
116    * * Returns the interpolator of zone object.
117    */
118   HYDRODATA_EXPORT virtual HYDROData_IInterpolator* GetInterpolator() const;
119   
120   /**
121    * Sets the merging type for conflict altitudes.
122    * By default it is set to Merge_UNKNOWN.
123    */
124   HYDRODATA_EXPORT virtual void SetMergeType( const MergeType& theType );
125
126   /**
127    * Returns the merging type for conflict altitudes/types.
128    */
129   HYDRODATA_EXPORT virtual MergeType GetMergeType() const;
130
131
132   /**
133    * Sets the reference object to resolve the conflict.
134    * This object is used only in case of "Merge_Object" merge type.
135    * \param theObject the merge object
136    */
137   HYDRODATA_EXPORT virtual void SetMergeObject( const Handle(HYDROData_Entity)& theObject );
138
139   /**
140    * Returns the reference object to resolve the conflict.
141    * \return the merge object
142    */
143   HYDRODATA_EXPORT virtual Handle(HYDROData_Entity) GetMergeObject() const;
144
145   /**
146    * Removes the reference object for resolving the conflict.
147    */
148   HYDRODATA_EXPORT virtual void RemoveMergeObject();
149   
150   /**
151    * Add new one object for zone.
152    * \param theObject the object to add
153    */
154   HYDRODATA_EXPORT virtual bool AddObject( const Handle(HYDROData_Entity)& theObject );
155
156   /**
157    * Returns all objects of zone.
158    * \return the list of objects
159    */
160   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetObjects() const;
161
162   /**
163    * Removes all objects from zone.
164    */
165   HYDRODATA_EXPORT virtual void RemoveObjects();
166
167   /**
168    * Returns submersible flag.
169    * \return true if all objects of the zone is submersible
170    */
171   HYDRODATA_EXPORT bool IsSubmersible() const;
172
173 protected:
174
175   friend class HYDROData_Region;
176   friend class HYDROData_Iterator;
177
178   /**
179    * Creates new object in the internal data structure. Use higher level objects 
180    * to create objects with real content.
181    */
182   HYDRODATA_EXPORT HYDROData_Zone();
183
184   /**
185    * Destructs properties of the object and object itself, removes it from the document.
186    */
187   HYDRODATA_EXPORT ~HYDROData_Zone();
188
189 private:
190   HYDROData_IInterpolator* myInterpolator;
191
192 };
193
194 #endif