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