Salome HOME
6823cbda658d33d89f2fd78717f2b03279aabee7
[modules/hydro.git] / src / HYDROData / HYDROData_Region.h
1 // Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #ifndef HYDROData_Region_HeaderFile
24 #define HYDROData_Region_HeaderFile
25
26 #include "HYDROData_ShapesGroup.h"
27
28
29 DEFINE_STANDARD_HANDLE(HYDROData_Region, HYDROData_Entity)
30
31 class Handle(HYDROData_Zone);
32 class Handle(HYDROData_Document);
33 class TopoDS_Shape;
34 class TopoDS_Face;
35 class QStringList;
36
37 /**\class HYDROData_Region
38  * \brief Regions are groups (lists) of zones, they can include one or several zones.
39  */
40 class HYDROData_Region : public HYDROData_Entity
41 {
42
43 protected:
44
45   /**
46    * Enumeration of tags corresponding to the persistent object parameters.
47    */
48   enum DataTag
49   {
50     DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
51     DataTag_ChildZone,    ///< child zones
52     DataTag_Zone,         ///< reference zones
53   };
54
55 public:
56   DEFINE_STANDARD_RTTI(HYDROData_Region);
57
58   /**
59    * Returns the kind of this object. Must be redefined in all objects of known type.
60    */
61   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_REGION; }
62
63   /**
64    * Dump object to Python script representation.
65    */
66   HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const;
67
68   /**
69    * Returns flag indicating that object is updateble or not.
70    */
71   HYDRODATA_EXPORT virtual bool CanBeUpdated() const;
72
73
74   /**
75    * Removes object and it child sub-objects from the data structure.
76    * Reimplemented to update names of regions in father calculation.
77    */
78   HYDRODATA_EXPORT virtual void Remove();
79
80   /**
81    * Returns flag indicating that object can be removed or not.
82    */
83   HYDRODATA_EXPORT virtual bool CanRemove();
84
85   /**
86    * Returns the list of all reference objects of this object.
87    */
88   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const;
89
90
91   /**
92    * Add new one reference zone for region.
93    * The label of theZone is changed in case if old parent is not this region.
94    */
95   HYDRODATA_EXPORT virtual bool AddZone( const Handle(HYDROData_Zone)& theZone );
96
97   /**
98    * Returns all reference zone of region.
99    */
100   HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetZones() const;
101
102   /**
103    * Removes reference zone from region.
104    */
105   HYDRODATA_EXPORT virtual void RemoveZone( const Handle(HYDROData_Zone)& theZone );
106
107   /**
108    * Removes all reference zones from region.
109    */
110   HYDRODATA_EXPORT virtual void RemoveZones();
111
112   /**
113    * \brief Returns the shape of the region.
114    * Shape of the region could be:
115    * - a face which is the union of the region zones faces
116    * - a shell if the zones faces can't be united into one face
117    * \return shape as TopoDS_Shape
118    */
119   HYDRODATA_EXPORT virtual TopoDS_Shape GetShape( HYDROData_ShapesGroup::SeqOfGroupsDefs* theSeqOfGroups = 0 ) const;
120
121 protected:
122
123   /**
124    * Create new one reference zone for region on child label.
125    * The new zone is added into the list of reference zones.
126    */
127   HYDRODATA_EXPORT virtual Handle(HYDROData_Zone) addNewZone( const Handle(HYDROData_Document)& theDoc,
128                                                               const QString& thePrefix,
129                                                               const TopoDS_Face& theFace,
130                                                               const QStringList& theRefObjects );
131
132 protected:
133
134   friend class HYDROData_CalculationCase;
135   friend class HYDROData_Iterator;
136
137   /**
138    * Creates new object in the internal data structure. Use higher level objects 
139    * to create objects with real content.
140    */
141   HYDRODATA_EXPORT HYDROData_Region();
142
143   /**
144    * Destructs properties of the object and object itself, removes it from the document.
145    */
146   HYDRODATA_EXPORT ~HYDROData_Region();
147 };
148
149 #endif