Salome HOME
Bug NPAL12872 - EDF189 GEOM, SMESH : Visualization of groups with many colors
[modules/smesh.git] / src / SMESHDS / SMESHDS_GroupBase.hxx
1 //  SMESH SMESHDS : management of mesh data and SMESH document
2 //
3 //  Copyright (C) 2004  CEA
4 // 
5 //  This library is free software; you can redistribute it and/or 
6 //  modify it under the terms of the GNU Lesser General Public 
7 //  License as published by the Free Software Foundation; either 
8 //  version 2.1 of the License. 
9 // 
10 //  This library is distributed in the hope that it will be useful, 
11 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
12 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
13 //  Lesser General Public License for more details. 
14 // 
15 //  You should have received a copy of the GNU Lesser General Public 
16 //  License along with this library; if not, write to the Free Software 
17 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
18 // 
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 //
21 //
22 //
23 //  File   : SMESHDS_Group.hxx
24 //  Module : SMESH
25 //  $Header$
26
27 #ifndef _SMESHDS_GroupBase_HeaderFile
28 #define _SMESHDS_GroupBase_HeaderFile
29
30 #include "SMESH_SMESHDS.hxx"
31
32 #include <string>
33 #include "SMDSAbs_ElementType.hxx"
34 #include "SMDS_MeshElement.hxx"
35   
36 #include "SALOMEconfig.h"
37 #include CORBA_SERVER_HEADER(SALOMEDS)
38 #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
39
40 class SMESHDS_Mesh;
41
42 class SMESHDS_EXPORT SMESHDS_GroupBase
43 {
44  public:
45
46   SMESHDS_GroupBase (const int                 theID,
47                      const SMESHDS_Mesh*       theMesh,
48                      const SMDSAbs_ElementType theType);
49
50   int GetID() const { return myID; }
51
52   const SMESHDS_Mesh* GetMesh() const { return myMesh; }
53
54   virtual void SetType(SMDSAbs_ElementType theType);
55
56   SMDSAbs_ElementType GetType() const { return myType; }
57
58   void SetStoreName (const char* theName) { myStoreName = theName; }
59
60   const char* GetStoreName () const { return myStoreName.c_str(); }
61
62   virtual int Extent();
63
64   virtual bool IsEmpty();
65
66   virtual bool Contains (const int theID);
67
68   virtual SMDS_ElemIteratorPtr GetElements() = 0;
69
70   int GetID (const int theIndex);
71   // use it for iterations 1..Extent()
72
73   virtual ~SMESHDS_GroupBase() {}
74
75   void SetColor (const SALOMEDS::Color& theColor)
76   { myColor = theColor;}
77   
78   SALOMEDS::Color GetColor() const
79   { return myColor;}
80   
81  protected:
82   const SMDS_MeshElement* findInMesh (const int theID) const;
83   void resetIterator();
84
85  private:
86   SMESHDS_GroupBase (const SMESHDS_GroupBase& theOther);
87   // prohibited copy constructor
88   SMESHDS_GroupBase& operator = (const SMESHDS_GroupBase& theOther);
89   // prohibited assign operator
90
91   int                  myID;
92   const SMESHDS_Mesh*  myMesh;
93   SMDSAbs_ElementType  myType;
94   std::string          myStoreName;
95   // for GetID()
96   int                  myCurIndex;
97   int                  myCurID;
98   SMDS_ElemIteratorPtr myIterator;
99   SALOMEDS::Color      myColor;
100 };
101
102 #endif