Salome HOME
394bf16e3d059f2bc367655103e9dcd4f3554475
[modules/hydro.git] / src / HYDROData / HYDROData_ShapesGroup.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_ShapesGroup_HeaderFile
20 #define HYDROData_ShapesGroup_HeaderFile
21
22 #include <HYDROData_Entity.h>
23
24 #include <TopTools_SequenceOfShape.hxx>
25
26 #include <QString>
27
28 class TopoDS_Shape;
29 class TopTools_ListOfShape;
30 class BRepBuilderAPI_MakeShape;
31 class ShapeUpgrade_UnifySameDomain;
32 class BRepTools_ReShape;
33
34 DEFINE_STANDARD_HANDLE(HYDROData_ShapesGroup, HYDROData_Entity)
35
36 /**\class HYDROData_ShapesGroup
37  * \brief Class that stores/retreives the sequence of shapes.
38  */
39 class HYDROData_ShapesGroup : public HYDROData_Entity
40 {
41 public:
42
43   struct GroupDefinition
44   {
45     GroupDefinition() {}
46
47     static void Update( NCollection_Sequence<GroupDefinition>* theGroupsDefs,
48                         BRepBuilderAPI_MakeShape*              theAlgo );
49
50     static void Update( NCollection_Sequence<GroupDefinition>* theGroupsDefs,
51                         ShapeUpgrade_UnifySameDomain*          theAlgo );
52
53     static void Update( NCollection_Sequence<GroupDefinition>* theGroupsDefs,
54                         BRepTools_ReShape*                     theAlgo );
55     
56
57     void        Dump( std::ostream& theStream ) const;
58
59     static void Dump( std::ostream&                                theStream,
60                       const NCollection_Sequence<GroupDefinition>& theGroups );
61
62     TCollection_AsciiString            Name;
63     TopTools_SequenceOfShape           Shapes;
64   };
65   typedef NCollection_Sequence<GroupDefinition> SeqOfGroupsDefs;
66
67 protected:
68   /**
69    * Enumeration of tags corresponding to the persistent object parameters.
70    */
71   enum DataTag
72   {
73     DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
74     DataTag_Shape,   ///< reference edges
75   };
76
77 public:
78   DEFINE_STANDARD_RTTI(HYDROData_ShapesGroup);
79
80   /**
81    * Returns the kind of this object. Must be redefined in all objects of known type.
82    */
83   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_SHAPES_GROUP; }
84
85   /**
86    * Returns flag indicating that object is updateble or not.
87    */
88   HYDRODATA_EXPORT virtual bool CanBeUpdated() const;
89
90     /**
91    * Returns flag indicating that object can be removed or not.
92    */
93   HYDRODATA_EXPORT virtual bool CanRemove();
94
95 public:      
96   // Public methods to work with reference Shapes
97
98   /**
99    * Add new one shape for the group.
100    */
101   HYDRODATA_EXPORT virtual void AddShape( const TopoDS_Shape& theShape );
102
103   /**
104    * Sets new sequence of shapes for the group.
105    */
106   HYDRODATA_EXPORT virtual void SetShapes( const TopTools_SequenceOfShape& theShapes );
107
108   /**
109    * Sets new list of shapes for the group.
110    */
111   HYDRODATA_EXPORT virtual void SetShapes( const TopTools_ListOfShape& theShapes );
112
113   /**
114    * Returns all shapes of the group.
115    */
116   HYDRODATA_EXPORT virtual void GetShapes( TopTools_SequenceOfShape& theShapes ) const;
117
118   /**
119    * Removes all shapes from the group.
120    */
121   HYDRODATA_EXPORT virtual void RemoveShapes();
122
123
124 protected:
125
126   friend class HYDROData_Iterator;
127
128   /**
129    * Creates new object in the internal data structure. Use higher level objects 
130    * to create objects with real content.
131    */
132   HYDRODATA_EXPORT HYDROData_ShapesGroup();
133
134   /**
135    * Destructs properties of the object and object itself, removes it from the document.
136    */
137   virtual HYDRODATA_EXPORT ~HYDROData_ShapesGroup();
138 };
139
140 #endif