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