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