Salome HOME
Merge branch 'BR_LAND_COVER_MAP' of ssh://git.salome-platform.org/modules/hydro into...
[modules/hydro.git] / src / HYDROData / HYDROData_Region.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_Region_HeaderFile
20 #define HYDROData_Region_HeaderFile
21
22 #include "HYDROData_ShapesGroup.h"
23
24
25 DEFINE_STANDARD_HANDLE(HYDROData_Region, HYDROData_Entity)
26
27 class Handle(HYDROData_Zone);
28 class Handle(HYDROData_Document);
29 class TopoDS_Shape;
30 class TopoDS_Face;
31 class QStringList;
32
33 /**\class HYDROData_Region
34  * \brief Regions are groups (lists) of zones, they can include one or several zones.
35  */
36 class HYDROData_Region : public HYDROData_Entity
37 {
38
39 protected:
40
41   /**
42    * Enumeration of tags corresponding to the persistent object parameters.
43    */
44   enum DataTag
45   {
46     DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
47     DataTag_ChildZone,    ///< child zones
48     DataTag_Zone,         ///< reference zones
49   };
50
51 public:
52   DEFINE_STANDARD_RTTI(HYDROData_Region);
53
54   /**
55    * Returns the kind of this object. Must be redefined in all objects of known type.
56    */
57   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_REGION; }
58
59   /**
60    * Dump object to Python script representation.
61    */
62   HYDRODATA_EXPORT virtual QStringList DumpToPython( const QString& thePyScriptPath,
63                                                      MapOfTreatedObjects& theTreatedObjects ) const;
64
65   /**
66    * Returns flag indicating that object is updateble or not.
67    */
68   HYDRODATA_EXPORT virtual bool CanBeUpdated() const;
69
70
71   /**
72    * Removes object and it child sub-objects from the data structure.
73    * Reimplemented to update names of regions in father calculation.
74    */
75   HYDRODATA_EXPORT virtual void Remove();
76
77   /**
78    * Returns flag indicating that object can be removed or not.
79    */
80   HYDRODATA_EXPORT virtual bool CanRemove();
81
82   /**
83    * Returns the list of all reference objects of this object.
84    */
85   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
86
87
88   /**
89    * Add new one reference zone for region.
90    * The label of theZone is changed in case if old parent is not this region.
91    */
92   HYDRODATA_EXPORT virtual bool AddZone( const Handle(HYDROData_Zone)& theZone );
93
94   /**
95    * Returns all reference zone of region.
96    */
97   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetZones() const;
98
99   /**
100    * Removes reference zone from region.
101    */
102   HYDRODATA_EXPORT virtual void RemoveZone( const Handle(HYDROData_Zone)& theZone );
103
104   /**
105    * Removes all reference zones from region.
106    */
107   HYDRODATA_EXPORT virtual void RemoveZones();
108
109   /**
110    * \brief Returns the shape of the region.
111    * Shape of the region could be:
112    * - a face which is the union of the region zones faces
113    * - a shell if the zones faces can't be united into one face
114    * \return shape as TopoDS_Shape
115    */
116   HYDRODATA_EXPORT virtual TopoDS_Shape GetShape( HYDROData_ShapesGroup::SeqOfGroupsDefs* theSeqOfGroups = 0 ) const;
117
118   HYDRODATA_EXPORT bool IsSubmersible() const;
119
120 protected:
121
122   /**
123    * Create new one reference zone for region on child label.
124    * The new zone is added into the list of reference zones.
125    */
126   HYDRODATA_EXPORT virtual Handle(HYDROData_Zone) addNewZone( const Handle(HYDROData_Document)& theDoc,
127                                                               const QString& thePrefix,
128                                                               const TopoDS_Face& theFace,
129                                                               const QStringList& theRefObjects );
130
131 protected:
132
133   friend class HYDROData_CalculationCase;
134   friend class HYDROData_Iterator;
135
136   /**
137    * Creates new object in the internal data structure. Use higher level objects 
138    * to create objects with real content.
139    */
140   HYDRODATA_EXPORT HYDROData_Region();
141
142   /**
143    * Destructs properties of the object and object itself, removes it from the document.
144    */
145   HYDRODATA_EXPORT ~HYDROData_Region();
146 };
147
148 #endif