Salome HOME
patch for crash in channel
[modules/hydro.git] / src / HYDROData / HYDROData_Zone.h
1
2 #ifndef HYDROData_Zone_HeaderFile
3 #define HYDROData_Zone_HeaderFile
4
5 #include "HYDROData_Entity.h"
6 #include "HYDROData_IInterpolator.h"
7
8 class Handle(HYDROData_Object);
9 class Handle(HYDROData_IAltitudeObject);
10 class TopoDS_Shape;
11
12 DEFINE_STANDARD_HANDLE(HYDROData_Zone, HYDROData_Entity)
13
14
15 /**\class HYDROData_Zone
16  * \brief Class that stores/retreives information about the 2d face.
17  */
18 class HYDROData_Zone : public HYDROData_Entity
19 {
20
21 public:
22
23   // Enumeration of mergin types for conflict altitudes
24   enum MergeAltitudesType
25   {
26     Merge_UNKNOWN, // Undefined
27     Merge_ZMIN,    // The minimum values
28     Merge_ZMAX,    // The maximum values
29     Merge_Object   // Only one altitude will be taken into account
30   };
31
32 protected:
33   /**
34    * Enumeration of tags corresponding to the persistent object parameters.
35    */
36   enum DataTag
37   {
38     DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
39     DataTag_Shape,           ///< reference shape
40     DataTag_GeometryObject,  ///< reference geometry objects
41     DataTag_MergeType,       ///< mergin type of conflict bathymetries
42     DataTag_MergeAltitude,   ///< reference altitude for conflict merge
43   };
44
45 public:
46   DEFINE_STANDARD_RTTI(HYDROData_Zone);
47
48   /**
49    * Returns the kind of this object. Must be redefined in all objects of known type.
50    */
51   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_ZONE; }
52
53
54   /**
55    * Returns flag indicating that object is updateble or not.
56    */
57   HYDRODATA_EXPORT virtual bool CanBeUpdated() const;
58
59
60   /**
61    * Returns flag indicating that object can be removed or not.
62    */
63   HYDRODATA_EXPORT virtual bool CanRemove();
64
65   /**
66    * Returns the list of all reference objects of this object.
67    */
68   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
69
70
71   /**
72    * Sets the shape of the zone.
73    */
74   HYDRODATA_EXPORT virtual void SetShape( const TopoDS_Shape& theShape );
75
76   /**
77    * Returns the shape of the zone.
78    */
79   HYDRODATA_EXPORT virtual TopoDS_Shape GetShape() const;
80
81
82   /**
83    * Returns true if zone needs merge of bathymetries.
84    */
85   HYDRODATA_EXPORT virtual bool IsMergingNeed() const;
86
87
88   /**
89    * Sets the interpolator for zone. By default it is NULL and original
90    * interpolation algorithms are used to calculate points altitudes.
91    * If you set interpolator it won't be stored in the data model structure,
92    * it will be deleted during that time as this zone will be freed.
93    */
94   HYDRODATA_EXPORT virtual void SetInterpolator( HYDROData_IInterpolator* theInter );
95
96   /**
97    * * Returns the interpolator of zone object.
98    */
99   HYDRODATA_EXPORT virtual HYDROData_IInterpolator* GetInterpolator() const;
100
101
102   /**
103    * Sets the merging type for conflict altitudes.
104    * By default it is set to Merge_UNKNOWN.
105    */
106   HYDRODATA_EXPORT virtual void SetMergeType( const MergeAltitudesType& theType );
107
108   /**
109    * Returns the merging type for conflict altitudes.
110    */
111   HYDRODATA_EXPORT virtual MergeAltitudesType GetMergeType() const;
112
113
114   /**
115    * Sets the reference altitude to resolve the conflict.
116    * This object is used only in case of "Merge_Object" merge type.
117    */
118   HYDRODATA_EXPORT virtual void SetMergeAltitude( const Handle(HYDROData_IAltitudeObject)& theAltitude );
119
120   /**
121    * Returns the reference altitude to resolve the conflict.
122    */
123   HYDRODATA_EXPORT virtual Handle(HYDROData_IAltitudeObject) GetMergeAltitude() const;
124
125   /**
126    * Removes the reference altitude for resolving the conflict.
127    */
128   HYDRODATA_EXPORT virtual void RemoveMergeAltitude();
129   
130
131   /**
132    * Add new one geometry object for zone.
133    */
134   HYDRODATA_EXPORT virtual bool AddGeometryObject( const Handle(HYDROData_Object)& theObject );
135
136   /**
137    * Returns all geometry objects of zone.
138    */
139   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetGeometryObjects() const;
140
141   /**
142    * Removes all geometry objects from zone.
143    */
144   HYDRODATA_EXPORT virtual void RemoveGeometryObjects();
145
146
147 protected:
148
149   friend class HYDROData_Region;
150   friend class HYDROData_Iterator;
151
152   /**
153    * Creates new object in the internal data structure. Use higher level objects 
154    * to create objects with real content.
155    */
156   HYDRODATA_EXPORT HYDROData_Zone();
157
158   /**
159    * Destructs properties of the object and object itself, removes it from the document.
160    */
161   HYDRODATA_EXPORT ~HYDROData_Zone();
162
163 private:
164   HYDROData_IInterpolator* myInterpolator;
165
166 };
167
168 #endif