Back to index

salome-smesh  6.5.0
SMESHDS_GroupBase.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  SMESH SMESHDS : management of mesh data and SMESH document
00024 //  File   : SMESHDS_Group.hxx
00025 //  Module : SMESH
00026 //  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESHDS/SMESHDS_GroupBase.hxx,v 1.9.20.6.8.1 2012-04-13 09:31:09 vsr Exp $
00027 //
00028 #ifndef _SMESHDS_GroupBase_HeaderFile
00029 #define _SMESHDS_GroupBase_HeaderFile
00030 
00031 #include "SMESH_SMESHDS.hxx"
00032 
00033 #include <string>
00034 #include "SMDSAbs_ElementType.hxx"
00035 #include "SMDS_MeshElement.hxx"
00036 
00037 #include <Quantity_Color.hxx>
00038   
00039 class SMESHDS_Mesh;
00040 
00041 class SMESHDS_EXPORT SMESHDS_GroupBase
00042 {
00043  public:
00044 
00045   SMESHDS_GroupBase (const int                 theID,
00046                      const SMESHDS_Mesh*       theMesh,
00047                      const SMDSAbs_ElementType theType);
00048 
00049   int GetID() const { return myID; }
00050 
00051   const SMESHDS_Mesh* GetMesh() const { return myMesh; }
00052 
00053   virtual void SetType(SMDSAbs_ElementType theType);
00054 
00055   SMDSAbs_ElementType GetType() const { return myType; }
00056 
00057   void SetStoreName (const char* theName) { myStoreName = theName; }
00058 
00059   const char* GetStoreName () const { return myStoreName.c_str(); }
00060 
00061   virtual int Extent() const;
00062 
00063   virtual bool IsEmpty();
00064 
00065   virtual bool Contains (const int theID);
00066 
00067   virtual bool Contains (const SMDS_MeshElement* elem);
00068 
00069   virtual SMDS_ElemIteratorPtr GetElements() const = 0;
00070 
00071   virtual int GetID (const int theIndex);
00072   // use it for iterations 1..Extent()
00073 
00074   virtual int GetTic() const = 0;
00075 
00076   virtual ~SMESHDS_GroupBase() {}
00077 
00078   void SetColor (const Quantity_Color& theColor)
00079   { myColor = theColor;}
00080   
00081   Quantity_Color GetColor() const
00082   { return myColor;}
00083 
00084   void SetColorGroup (int theColorGroup);
00085 
00086   int GetColorGroup() const;
00087   
00088  protected:
00089   const SMDS_MeshElement* findInMesh (const int theID) const;
00090   void resetIterator();
00091 
00092  private:
00093   SMESHDS_GroupBase (const SMESHDS_GroupBase& theOther);
00094   // prohibited copy constructor
00095   SMESHDS_GroupBase& operator = (const SMESHDS_GroupBase& theOther);
00096   // prohibited assign operator
00097 
00098   int                  myID;
00099   const SMESHDS_Mesh*  myMesh;
00100   SMDSAbs_ElementType  myType;
00101   std::string          myStoreName;
00102   Quantity_Color       myColor;
00103 
00104   // for GetID()
00105   int                  myCurIndex;
00106   int                  myCurID;
00107   SMDS_ElemIteratorPtr myIterator;
00108 };
00109 
00110 #endif