smesh/src/OBJECT/SMESH_ObjectDef.h

218 lines
6.8 KiB
C
Raw Normal View History

2011-06-06 14:15:39 +06:00
// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
2009-02-17 10:27:49 +05:00
//
2011-06-06 14:15:39 +06:00
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
2009-02-17 10:27:49 +05:00
//
2011-06-06 14:15:39 +06:00
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
2005-01-20 11:25:54 +05:00
//
2011-06-06 14:15:39 +06:00
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
2005-01-20 11:25:54 +05:00
//
2011-06-06 14:15:39 +06:00
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2005-01-20 11:25:54 +05:00
//
2011-06-06 14:15:39 +06:00
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
2005-01-20 11:25:54 +05:00
//
2010-05-14 21:32:37 +06:00
2009-02-17 10:27:49 +05:00
// SMESH OBJECT : interactive object for SMESH visualization
2005-01-20 11:25:54 +05:00
// File : SMESH_Object.h
// Author : Nicolas REJNERI
// Module : SMESH
// $Header$
2009-02-17 10:27:49 +05:00
//
2005-01-20 11:25:54 +05:00
#ifndef SMESH_OBJECTDEF_H
#define SMESH_OBJECTDEF_H
#include "SMESH_Controls.hxx"
#include "SMESH_Object.h"
#include "SMESH_Client.hxx"
#include "SMESH_Actor.h"
2005-01-20 11:25:54 +05:00
// IDL Headers
#include <SALOMEconfig.h>
2005-01-20 11:25:54 +05:00
#include CORBA_SERVER_HEADER(SMESH_Mesh)
#include CORBA_SERVER_HEADER(SMESH_Group)
#include <map>
#include <list>
class vtkPoints;
class SALOME_ExtractUnstructuredGrid;
class SMDS_MeshNode;
class SMDS_MeshElement;
/*
Class : SMESH_VisualObj
Description : Base class for all mesh objects to be visuilised
*/
class SMESHOBJECT_EXPORT SMESH_VisualObjDef: public SMESH_VisualObj
2005-01-20 11:25:54 +05:00
{
public:
typedef std::list<const SMDS_MeshElement*> TEntityList;
typedef std::map<vtkIdType,vtkIdType> TMapOfIds;
SMESH_VisualObjDef();
virtual ~SMESH_VisualObjDef();
virtual bool Update( int theIsClear = true ) = 0;
virtual bool NulData() {return 0; };
2005-01-20 11:25:54 +05:00
virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor ) = 0;
virtual int GetElemDimension( const int theObjId ) = 0;
virtual int GetNbEntities( const SMDSAbs_ElementType theType) const = 0;
virtual int GetEntities( const SMDSAbs_ElementType, TEntityList& ) const = 0;
virtual bool IsNodePrs() const = 0;
virtual SMDS_Mesh* GetMesh() const = 0;
2009-12-08 18:11:42 +05:00
virtual bool IsValid() const;
2005-01-20 11:25:54 +05:00
virtual bool GetEdgeNodes( const int theElemId,
const int theEdgeNum,
int& theNodeId1,
int& theNodeId2 ) const;
virtual vtkUnstructuredGrid* GetUnstructuredGrid();
2005-01-20 11:25:54 +05:00
virtual vtkIdType GetNodeObjId( int theVTKID );
virtual vtkIdType GetNodeVTKId( int theObjID );
virtual vtkIdType GetElemObjId( int theVTKID );
virtual vtkIdType GetElemVTKId( int theObjID );
virtual void ClearEntitiesFlags();
virtual bool GetEntitiesFlag();
virtual unsigned int GetEntitiesState();
2005-01-20 11:25:54 +05:00
protected:
void createPoints( vtkPoints* );
void buildPrs(bool buildGrid = false);
2005-01-20 11:25:54 +05:00
void buildNodePrs();
void buildElemPrs();
void updateEntitiesFlags();
//private:
2005-01-20 11:25:54 +05:00
TMapOfIds mySMDS2VTKNodes;
TMapOfIds myVTK2SMDSNodes;
TMapOfIds mySMDS2VTKElems;
TMapOfIds myVTK2SMDSElems;
bool myLocalGrid;
2005-01-20 11:25:54 +05:00
bool myEntitiesFlag;
unsigned int myEntitiesState;
2005-01-20 11:25:54 +05:00
vtkUnstructuredGrid* myGrid;
std::map<SMDSAbs_ElementType,int> myEntitiesCache;
2005-01-20 11:25:54 +05:00
};
/*
Class : SMESH_MeshObj
Description : Class for visualisation of mesh
*/
class SMESHOBJECT_EXPORT SMESH_MeshObj: public SMESH_VisualObjDef
2005-01-20 11:25:54 +05:00
{
public:
SMESH_MeshObj( SMESH::SMESH_Mesh_ptr );
virtual ~SMESH_MeshObj();
virtual bool Update( int theIsClear = true );
virtual bool NulData();
2005-01-20 11:25:54 +05:00
virtual int GetNbEntities( const SMDSAbs_ElementType) const;
virtual int GetEntities( const SMDSAbs_ElementType, TEntityList& ) const;
virtual bool IsNodePrs() const;
virtual int GetElemDimension( const int theObjId );
virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor );
SMESH::SMESH_Mesh_ptr GetMeshServer() { return myClient.GetMeshServer(); }
SMDS_Mesh* GetMesh() const { return myClient.GetMesh(); }
2005-01-20 11:25:54 +05:00
protected:
SMESH_Client myClient;
vtkUnstructuredGrid* myEmptyGrid;
2005-01-20 11:25:54 +05:00
};
/*
Class : SMESH_SubMeshObj
Description : Base class for visualisation of submeshes and groups
*/
class SMESHOBJECT_EXPORT SMESH_SubMeshObj: public SMESH_VisualObjDef
2005-01-20 11:25:54 +05:00
{
public:
SMESH_SubMeshObj(SMESH_MeshObj* theMeshObj);
virtual ~SMESH_SubMeshObj();
virtual bool Update( int theIsClear = true );
2005-01-20 11:25:54 +05:00
virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor );
virtual int GetElemDimension( const int theObjId );
virtual SMDS_Mesh* GetMesh() const { return myMeshObj->GetMesh(); }
protected:
SMESH_MeshObj* myMeshObj;
};
/*
Class : SMESH_GroupObj
Description : Class for visualisation of groups
*/
class SMESHOBJECT_EXPORT SMESH_GroupObj: public SMESH_SubMeshObj
2005-01-20 11:25:54 +05:00
{
public:
SMESH_GroupObj( SMESH::SMESH_GroupBase_ptr, SMESH_MeshObj* );
virtual ~SMESH_GroupObj();
virtual int GetNbEntities( const SMDSAbs_ElementType) const;
virtual int GetEntities( const SMDSAbs_ElementType, TEntityList& ) const;
virtual bool IsNodePrs() const;
virtual SMDSAbs_ElementType GetElementType() const;
2005-01-20 11:25:54 +05:00
private:
SMESH::SMESH_GroupBase_var myGroupServer;
};
/*
Class : SMESH_subMeshObj
Description : Class for visualisation of submeshes
*/
class SMESHOBJECT_EXPORT SMESH_subMeshObj : public SMESH_SubMeshObj
2005-01-20 11:25:54 +05:00
{
public:
SMESH_subMeshObj( SMESH::SMESH_subMesh_ptr,
SMESH_MeshObj* );
virtual ~SMESH_subMeshObj();
virtual int GetNbEntities( const SMDSAbs_ElementType) const;
virtual int GetEntities( const SMDSAbs_ElementType, TEntityList& ) const;
virtual bool IsNodePrs() const;
protected:
SMESH::SMESH_subMesh_var mySubMeshServer;
};
#endif