Salome HOME
Separate action "Find bottom" for context menu.
[modules/hydro.git] / src / HYDROData / HYDROData_ShapesGroup.h
1 // Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #ifndef HYDROData_ShapesGroup_HeaderFile
24 #define HYDROData_ShapesGroup_HeaderFile
25
26 #include <HYDROData_Entity.h>
27
28 #include <TopTools_SequenceOfShape.hxx>
29
30 #include <QString>
31
32 class TopoDS_Shape;
33 class TopTools_ListOfShape;
34 class BRepBuilderAPI_MakeShape;
35 class ShapeUpgrade_UnifySameDomain;
36
37 DEFINE_STANDARD_HANDLE(HYDROData_ShapesGroup, HYDROData_Entity)
38
39 /**\class HYDROData_ShapesGroup
40  * \brief Class that stores/retreives the sequence of shapes.
41  */
42 class HYDROData_ShapesGroup : public HYDROData_Entity
43 {
44 public:
45
46   struct GroupDefinition
47   {
48     GroupDefinition() {}
49
50     static void Update( NCollection_Sequence<GroupDefinition>* theGroupsDefs,
51                         BRepBuilderAPI_MakeShape*              theAlgo );
52
53     static void Update( NCollection_Sequence<GroupDefinition>* theGroupsDefs,
54                         ShapeUpgrade_UnifySameDomain*          theAlgo );
55
56     void        Dump( std::ostream& theStream ) const;
57
58     static void Dump( std::ostream&                                theStream,
59                       const NCollection_Sequence<GroupDefinition>& theGroups );
60
61     TCollection_AsciiString            Name;
62     TopTools_SequenceOfShape           Shapes;
63   };
64   typedef NCollection_Sequence<GroupDefinition> SeqOfGroupsDefs;
65
66 protected:
67   /**
68    * Enumeration of tags corresponding to the persistent object parameters.
69    */
70   enum DataTag
71   {
72     DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve
73     DataTag_Shape,   ///< reference edges
74   };
75
76 public:
77   DEFINE_STANDARD_RTTI(HYDROData_ShapesGroup);
78
79   /**
80    * Returns the kind of this object. Must be redefined in all objects of known type.
81    */
82   HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_SHAPES_GROUP; }
83
84   /**
85    * Returns flag indicating that object is updateble or not.
86    */
87   HYDRODATA_EXPORT virtual bool CanBeUpdated() const;
88
89     /**
90    * Returns flag indicating that object can be removed or not.
91    */
92   HYDRODATA_EXPORT virtual bool CanRemove();
93
94 public:      
95   // Public methods to work with reference Shapes
96
97   /**
98    * Add new one shape for the group.
99    */
100   HYDRODATA_EXPORT virtual void AddShape( const TopoDS_Shape& theShape );
101
102   /**
103    * Sets new sequence of shapes for the group.
104    */
105   HYDRODATA_EXPORT virtual void SetShapes( const TopTools_SequenceOfShape& theShapes );
106
107   /**
108    * Sets new list of shapes for the group.
109    */
110   HYDRODATA_EXPORT virtual void SetShapes( const TopTools_ListOfShape& theShapes );
111
112   /**
113    * Returns all shapes of the group.
114    */
115   HYDRODATA_EXPORT virtual void GetShapes( TopTools_SequenceOfShape& theShapes ) const;
116
117   /**
118    * Removes all shapes from the group.
119    */
120   HYDRODATA_EXPORT virtual void RemoveShapes();
121
122
123 protected:
124
125   friend class HYDROData_Iterator;
126
127   /**
128    * Creates new object in the internal data structure. Use higher level objects 
129    * to create objects with real content.
130    */
131   HYDRODATA_EXPORT HYDROData_ShapesGroup();
132
133   /**
134    * Destructs properties of the object and object itself, removes it from the document.
135    */
136   virtual HYDRODATA_EXPORT ~HYDROData_ShapesGroup();
137 };
138
139 #endif