Back to index

salome-smesh  6.5.0
SMESH_Group_i.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 SMESH_I : idl implementation based on 'SMESH' unit's classes
00024 //  File   : SMESH_Group_i.hxx
00025 //  Author : Sergey ANIKIN, OCC
00026 //  Module : SMESH
00027 //
00028 #ifndef SMESH_Group_i_HeaderFile
00029 #define SMESH_Group_i_HeaderFile
00030 
00031 #include "SMESH.hxx"
00032 #include "SMESH_Mesh_i.hxx"
00033 #include "SMESH_Filter_i.hxx"
00034 
00035 #include <SALOMEconfig.h>
00036 #include CORBA_SERVER_HEADER(SMESH_Group)
00037 #include CORBA_SERVER_HEADER(SMESH_Mesh)
00038 #include CORBA_CLIENT_HEADER(GEOM_Gen)
00039 
00040 #include "SALOME_GenericObj_i.hh"
00041 
00042 class SMESH_Group;
00043 class SMESHDS_GroupBase;
00044 class SMESH_PreMeshInfo;
00045 
00046 // ===========
00047 // Group Base
00048 // ===========
00049 class SMESH_I_EXPORT SMESH_GroupBase_i:
00050   public virtual POA_SMESH::SMESH_GroupBase,
00051   public virtual SALOME::GenericObj_i
00052 {
00053  public:
00054   SMESH_GroupBase_i(PortableServer::POA_ptr thePOA,
00055                     SMESH_Mesh_i*           theMeshServant,
00056                     const int               theLocalID );
00057   virtual ~SMESH_GroupBase_i();
00058 
00059   // CORBA interface implementation
00060   void SetName(const char* name);
00061   char* GetName();
00062   SMESH::ElementType GetType();
00063   CORBA::Long Size();
00064   CORBA::Boolean IsEmpty();
00065   CORBA::Boolean Contains(CORBA::Long elem_id);
00066   CORBA::Long GetID(CORBA::Long elem_index);
00067   SMESH::long_array* GetListOfID();
00068   SMESH::long_array* GetNodeIDs();
00069   CORBA::Long GetNumberOfNodes();
00070   CORBA::Boolean IsNodeInfoAvailable(); // for gui
00071 
00072   virtual SMESH::SMESH_Mesh_ptr GetMesh();
00073 
00079   virtual SMESH::long_array* GetMeshInfo();
00080 
00081   // Inherited from SMESH_IDSource interface
00082   virtual SMESH::long_array* GetIDs();
00083 
00088   virtual SMESH::array_of_ElementType* GetTypes();
00093   virtual bool IsMeshInfoCorrect();
00094 
00095   // Internal C++ interface
00096   int GetLocalID() const { return myLocalID; }
00097   SMESH_Mesh_i* GetMeshServant() const { return myMeshServant; }
00098   SMESH_Group* GetSmeshGroup() const;
00099   SMESHDS_GroupBase* GetGroupDS() const;
00100 
00101   void SetColor(const SALOMEDS::Color& color);
00102   SALOMEDS::Color GetColor();
00103 
00104   void SetColorNumber(CORBA::Long color);
00105   CORBA::Long GetColorNumber();
00106 
00107 protected:
00108 
00109   SMESH_PreMeshInfo* & changePreMeshInfo() { return myPreMeshInfo; }
00110   SMESH_PreMeshInfo* myPreMeshInfo; // mesh info before full loading from study file
00111   friend class SMESH_PreMeshInfo;
00112 
00113 private:
00114   SMESH_Mesh_i* myMeshServant;
00115   int myLocalID;
00116 
00117   void changeLocalId(int localId) { myLocalID = localId; }
00118   friend class SMESH_Mesh_i;
00119 
00120   int myNbNodes, myGroupDSTic;
00121 };
00122 
00123 // ======
00124 // Group
00125 // ======
00126 
00127 class SMESH_I_EXPORT SMESH_Group_i:
00128   public virtual POA_SMESH::SMESH_Group,
00129   public SMESH_GroupBase_i
00130 {
00131  public:
00132   SMESH_Group_i( PortableServer::POA_ptr thePOA,
00133                  SMESH_Mesh_i*           theMeshServant,
00134                  const int               theLocalID );
00135   // CORBA interface implementation
00136   void Clear();
00137   CORBA::Long Add( const SMESH::long_array& theIDs );
00138   CORBA::Long Remove( const SMESH::long_array& theIDs );
00139 
00140   CORBA::Long AddByPredicate( SMESH::Predicate_ptr thePredicate );
00141   CORBA::Long RemoveByPredicate( SMESH::Predicate_ptr thePredicate );
00142 
00143   CORBA::Long AddFrom( SMESH::SMESH_IDSource_ptr theSource );
00144 };
00145 
00146 // =========================
00147 // Group linked to geometry
00148 // =========================
00149 
00150 class SMESH_I_EXPORT SMESH_GroupOnGeom_i:
00151   public virtual POA_SMESH::SMESH_GroupOnGeom,
00152   public SMESH_GroupBase_i
00153 {
00154  public:
00155   SMESH_GroupOnGeom_i( PortableServer::POA_ptr thePOA,
00156                        SMESH_Mesh_i*           theMeshServant,
00157                        const int               theLocalID );
00158   // CORBA interface implementation
00159   GEOM::GEOM_Object_ptr GetShape();
00160 };
00161 
00162 // =========================
00163 // Group deined by filter
00164 // =========================
00165 
00166 class SMESH_I_EXPORT SMESH_GroupOnFilter_i:
00167   public virtual POA_SMESH::SMESH_GroupOnFilter,
00168   public SMESH_GroupBase_i,
00169   public SMESH::Filter_i::TPredicateChangeWaiter
00170 {
00171  public:
00172   SMESH_GroupOnFilter_i( PortableServer::POA_ptr thePOA,
00173                          SMESH_Mesh_i*           theMeshServant,
00174                          const int               theLocalID );
00175   ~SMESH_GroupOnFilter_i();
00176 
00177   // Persistence
00178   static SMESH::Filter_ptr StringToFilter(const std::string& thePersistentString );
00179   std::string FilterToString() const;
00180 
00181   static SMESH_PredicatePtr GetPredicate( SMESH::Filter_ptr );
00182 
00183   // CORBA interface implementation
00184   void SetFilter(SMESH::Filter_ptr theFilter);
00185   SMESH::Filter_ptr GetFilter();
00186 
00187   // method of SMESH::Filter_i::TPredicateChangeWaiter
00188   virtual void PredicateChanged();
00189 
00190  private:
00191   SMESH::Filter_var myFilter;
00192 };
00193 #endif