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