mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-26 01:10:35 +05:00
To separate interface and implementation of the SMESH_Object class
This commit is contained in:
parent
bfe435ad43
commit
d43a813fc0
@ -31,7 +31,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl
|
||||
|
||||
@COMMENCE@
|
||||
|
||||
EXPORT_HEADERS = SMESH_Actor.h SMESH_ActorDef.h SMESH_Object.h SMESH_ActorUtils.h
|
||||
EXPORT_HEADERS = SMESH_Actor.h SMESH_Object.h SMESH_ObjectDef.h SMESH_ActorUtils.h
|
||||
|
||||
|
||||
# Libraries targets
|
||||
|
@ -792,9 +792,9 @@ void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){
|
||||
|
||||
|
||||
bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
|
||||
const char* theEntry,
|
||||
const char* theName,
|
||||
int theIsClear)
|
||||
const char* theEntry,
|
||||
const char* theName,
|
||||
int theIsClear)
|
||||
{
|
||||
Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(theEntry,"SMESH",theName);
|
||||
setIO(anIO);
|
||||
@ -1047,13 +1047,13 @@ namespace{
|
||||
}
|
||||
|
||||
void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
|
||||
if(!myVisualObj->GetNbEntities(SMESH::EDGE))
|
||||
if(!myVisualObj->GetNbEntities(SMDSAbs_Edge))
|
||||
theMode &= ~eEdges;
|
||||
|
||||
if(!myVisualObj->GetNbEntities(SMESH::FACE))
|
||||
if(!myVisualObj->GetNbEntities(SMDSAbs_Face))
|
||||
theMode &= ~eFaces;
|
||||
|
||||
if(!myVisualObj->GetNbEntities(SMESH::VOLUME))
|
||||
if(!myVisualObj->GetNbEntities(SMDSAbs_Volume))
|
||||
theMode &= ~eVolumes;
|
||||
|
||||
if(!theMode)
|
||||
@ -1080,9 +1080,9 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
|
||||
}
|
||||
|
||||
void SMESH_ActorDef::SetRepresentation(int theMode){
|
||||
int aNbEdges = myVisualObj->GetNbEntities(SMESH::EDGE);
|
||||
int aNbFaces = myVisualObj->GetNbEntities(SMESH::FACE);
|
||||
int aNbVolumes = myVisualObj->GetNbEntities(SMESH::VOLUME);
|
||||
int aNbEdges = myVisualObj->GetNbEntities(SMDSAbs_Edge);
|
||||
int aNbFaces = myVisualObj->GetNbEntities(SMDSAbs_Face);
|
||||
int aNbVolumes = myVisualObj->GetNbEntities(SMDSAbs_Volume);
|
||||
if(theMode < 0){
|
||||
myRepresentation = eSurface;
|
||||
if(!aNbFaces && !aNbVolumes && aNbEdges){
|
||||
|
@ -25,7 +25,8 @@
|
||||
// Author : Nicolas REJNERI
|
||||
// Module : SMESH
|
||||
|
||||
#include "SMESH_Object.h"
|
||||
#include "SMESH_ObjectDef.h"
|
||||
|
||||
#include "SMDS_Mesh.hxx"
|
||||
#include "SMESH_Actor.h"
|
||||
#include "SMESH_ControlsDef.hxx"
|
||||
@ -260,7 +261,7 @@ namespace{
|
||||
|
||||
}
|
||||
/*
|
||||
Class : SMESH_VisualObj
|
||||
Class : SMESH_VisualObjDef
|
||||
Description : Base class for all mesh objects to be visuilised
|
||||
*/
|
||||
|
||||
@ -268,36 +269,39 @@ namespace{
|
||||
// function : getCellType
|
||||
// purpose : Get type of VTK cell
|
||||
//=================================================================================
|
||||
static inline vtkIdType getCellType( const SMESH::ElementType theType,
|
||||
static inline vtkIdType getCellType( const SMDSAbs_ElementType theType,
|
||||
const int theNbNodes )
|
||||
{
|
||||
switch( theType )
|
||||
{
|
||||
case SMESH::EDGE: return theNbNodes == 2 ? VTK_LINE : VTK_EMPTY_CELL;
|
||||
case SMDSAbs_Edge:
|
||||
return theNbNodes == 2 ? VTK_LINE : VTK_EMPTY_CELL;
|
||||
|
||||
case SMESH::FACE : if ( theNbNodes == 3 ) return VTK_TRIANGLE;
|
||||
else if ( theNbNodes == 4 ) return VTK_QUAD;
|
||||
else return VTK_EMPTY_CELL;
|
||||
|
||||
case SMESH::VOLUME: if ( theNbNodes == 4 ) return VTK_TETRA;
|
||||
else if ( theNbNodes == 5 ) return VTK_PYRAMID;
|
||||
else if ( theNbNodes == 6 ) return VTK_WEDGE;
|
||||
else if ( theNbNodes == 8 ) return VTK_HEXAHEDRON;
|
||||
else return VTK_EMPTY_CELL;
|
||||
case SMDSAbs_Face :
|
||||
if ( theNbNodes == 3 ) return VTK_TRIANGLE;
|
||||
else if ( theNbNodes == 4 ) return VTK_QUAD;
|
||||
else return VTK_EMPTY_CELL;
|
||||
|
||||
case SMDSAbs_Volume:
|
||||
if ( theNbNodes == 4 ) return VTK_TETRA;
|
||||
else if ( theNbNodes == 5 ) return VTK_PYRAMID;
|
||||
else if ( theNbNodes == 6 ) return VTK_WEDGE;
|
||||
else if ( theNbNodes == 8 ) return VTK_HEXAHEDRON;
|
||||
else return VTK_EMPTY_CELL;
|
||||
|
||||
default: return VTK_EMPTY_CELL;
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// functions : SMESH_VisualObj
|
||||
// functions : SMESH_VisualObjDef
|
||||
// purpose : Constructor
|
||||
//=================================================================================
|
||||
SMESH_VisualObj::SMESH_VisualObj()
|
||||
SMESH_VisualObjDef::SMESH_VisualObjDef()
|
||||
{
|
||||
myGrid = vtkUnstructuredGrid::New();
|
||||
}
|
||||
SMESH_VisualObj::~SMESH_VisualObj()
|
||||
SMESH_VisualObjDef::~SMESH_VisualObjDef()
|
||||
{
|
||||
if ( MYDEBUG )
|
||||
MESSAGE( "~SMESH_MeshObj - myGrid->GetReferenceCount() = " << myGrid->GetReferenceCount() );
|
||||
@ -308,37 +312,37 @@ SMESH_VisualObj::~SMESH_VisualObj()
|
||||
// functions : GetNodeObjId, GetNodeVTKId, GetElemObjId, GetElemVTKId
|
||||
// purpose : Methods for retrieving VTK IDs by SMDS IDs and vice versa
|
||||
//=================================================================================
|
||||
vtkIdType SMESH_VisualObj::GetNodeObjId( int theVTKID )
|
||||
vtkIdType SMESH_VisualObjDef::GetNodeObjId( int theVTKID )
|
||||
{
|
||||
return myVTK2SMDSNodes.find(theVTKID) == myVTK2SMDSNodes.end() ? -1 : myVTK2SMDSNodes[theVTKID];
|
||||
}
|
||||
|
||||
vtkIdType SMESH_VisualObj::GetNodeVTKId( int theObjID )
|
||||
vtkIdType SMESH_VisualObjDef::GetNodeVTKId( int theObjID )
|
||||
{
|
||||
return mySMDS2VTKNodes.find(theObjID) == mySMDS2VTKNodes.end() ? -1 : mySMDS2VTKNodes[theObjID];
|
||||
}
|
||||
|
||||
vtkIdType SMESH_VisualObj::GetElemObjId( int theVTKID )
|
||||
vtkIdType SMESH_VisualObjDef::GetElemObjId( int theVTKID )
|
||||
{
|
||||
return myVTK2SMDSElems.find(theVTKID) == myVTK2SMDSElems.end() ? -1 : myVTK2SMDSElems[theVTKID];
|
||||
}
|
||||
|
||||
vtkIdType SMESH_VisualObj::GetElemVTKId( int theObjID )
|
||||
vtkIdType SMESH_VisualObjDef::GetElemVTKId( int theObjID )
|
||||
{
|
||||
return mySMDS2VTKElems.find(theObjID) == mySMDS2VTKElems.end() ? -1 : mySMDS2VTKElems[theObjID];
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SMESH_VisualObj::createPoints
|
||||
// function : SMESH_VisualObjDef::createPoints
|
||||
// purpose : Create points from nodes
|
||||
//=================================================================================
|
||||
void SMESH_VisualObj::createPoints( vtkPoints* thePoints )
|
||||
void SMESH_VisualObjDef::createPoints( vtkPoints* thePoints )
|
||||
{
|
||||
if ( thePoints == 0 )
|
||||
return;
|
||||
|
||||
TEntityList aNodes;
|
||||
vtkIdType nbNodes = GetEntities( SMESH::NODE, aNodes );
|
||||
vtkIdType nbNodes = GetEntities( SMDSAbs_Node, aNodes );
|
||||
thePoints->SetNumberOfPoints( nbNodes );
|
||||
|
||||
int nbPoints = 0;
|
||||
@ -365,7 +369,7 @@ void SMESH_VisualObj::createPoints( vtkPoints* thePoints )
|
||||
// function : buildPrs
|
||||
// purpose : create VTK cells( fill unstructured grid )
|
||||
//=================================================================================
|
||||
void SMESH_VisualObj::buildPrs()
|
||||
void SMESH_VisualObjDef::buildPrs()
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -396,7 +400,7 @@ void SMESH_VisualObj::buildPrs()
|
||||
// function : buildNodePrs
|
||||
// purpose : create VTK cells for nodes
|
||||
//=================================================================================
|
||||
void SMESH_VisualObj::buildNodePrs()
|
||||
void SMESH_VisualObjDef::buildNodePrs()
|
||||
{
|
||||
vtkPoints* aPoints = vtkPoints::New();
|
||||
createPoints( aPoints );
|
||||
@ -446,7 +450,7 @@ void SMESH_VisualObj::buildNodePrs()
|
||||
// function : buildElemPrs
|
||||
// purpose : Create VTK cells for elements
|
||||
//=================================================================================
|
||||
void SMESH_VisualObj::buildElemPrs()
|
||||
void SMESH_VisualObjDef::buildElemPrs()
|
||||
{
|
||||
// Create points
|
||||
|
||||
@ -460,7 +464,7 @@ void SMESH_VisualObj::buildElemPrs()
|
||||
|
||||
// Calculate cells size
|
||||
|
||||
static SMESH::ElementType aTypes[ 3 ] = { SMESH::EDGE, SMESH::FACE, SMESH::VOLUME };
|
||||
static SMDSAbs_ElementType aTypes[ 3 ] = { SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Volume };
|
||||
|
||||
// get entity data
|
||||
map< int, int > nbEnts;
|
||||
@ -469,7 +473,7 @@ void SMESH_VisualObj::buildElemPrs()
|
||||
for ( int i = 0; i <= 2; i++ )
|
||||
nbEnts[ aTypes[ i ] ] = GetEntities( aTypes[ i ], anEnts[ aTypes[ i ] ] );
|
||||
|
||||
vtkIdType aCellsSize = 3 * nbEnts[ SMESH::EDGE ];
|
||||
vtkIdType aCellsSize = 3 * nbEnts[ SMDSAbs_Edge ];
|
||||
|
||||
for ( int i = 1; i <= 2; i++ ) // iterate through faces and volumes
|
||||
{
|
||||
@ -482,7 +486,7 @@ void SMESH_VisualObj::buildElemPrs()
|
||||
}
|
||||
}
|
||||
|
||||
vtkIdType aNbCells = nbEnts[ SMESH::EDGE ] + nbEnts[ SMESH::FACE ] + nbEnts[ SMESH::VOLUME ];
|
||||
vtkIdType aNbCells = nbEnts[ SMDSAbs_Edge ] + nbEnts[ SMDSAbs_Face ] + nbEnts[ SMDSAbs_Volume ];
|
||||
|
||||
if ( MYDEBUG )
|
||||
MESSAGE( "Update - aNbCells = "<<aNbCells<<"; aCellsSize = "<<aCellsSize );
|
||||
@ -554,10 +558,10 @@ void SMESH_VisualObj::buildElemPrs()
|
||||
// function : GetEdgeNodes
|
||||
// purpose : Retrieve ids of nodes from edge of elements ( edge is numbered from 1 )
|
||||
//=================================================================================
|
||||
bool SMESH_VisualObj::GetEdgeNodes( const int theElemId,
|
||||
const int theEdgeNum,
|
||||
int& theNodeId1,
|
||||
int& theNodeId2 ) const
|
||||
bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId,
|
||||
const int theEdgeNum,
|
||||
int& theNodeId1,
|
||||
int& theNodeId2 ) const
|
||||
{
|
||||
const SMDS_Mesh* aMesh = GetMesh();
|
||||
if ( aMesh == 0 )
|
||||
@ -753,26 +757,26 @@ int SMESH_MeshObj::GetElemDimension( const int theObjId )
|
||||
// function : GetEntities
|
||||
// purpose : Get entities of specified type. Return number of entities
|
||||
//=================================================================================
|
||||
int SMESH_MeshObj::GetNbEntities( const SMESH::ElementType theType) const
|
||||
int SMESH_MeshObj::GetNbEntities( const SMDSAbs_ElementType theType) const
|
||||
{
|
||||
switch ( theType )
|
||||
{
|
||||
case SMESH::NODE:
|
||||
case SMDSAbs_Node:
|
||||
{
|
||||
return myMesh->NbNodes();
|
||||
}
|
||||
break;
|
||||
case SMESH::EDGE:
|
||||
case SMDSAbs_Edge:
|
||||
{
|
||||
return myMesh->NbEdges();
|
||||
}
|
||||
break;
|
||||
case SMESH::FACE:
|
||||
case SMDSAbs_Face:
|
||||
{
|
||||
return myMesh->NbFaces();
|
||||
}
|
||||
break;
|
||||
case SMESH::VOLUME:
|
||||
case SMDSAbs_Volume:
|
||||
{
|
||||
return myMesh->NbVolumes();
|
||||
}
|
||||
@ -783,31 +787,31 @@ int SMESH_MeshObj::GetNbEntities( const SMESH::ElementType theType) const
|
||||
}
|
||||
}
|
||||
|
||||
int SMESH_MeshObj::GetEntities( const SMESH::ElementType theType, TEntityList& theObjs ) const
|
||||
int SMESH_MeshObj::GetEntities( const SMDSAbs_ElementType theType, TEntityList& theObjs ) const
|
||||
{
|
||||
theObjs.clear();
|
||||
|
||||
switch ( theType )
|
||||
{
|
||||
case SMESH::NODE:
|
||||
case SMDSAbs_Node:
|
||||
{
|
||||
SMDS_NodeIteratorPtr anIter = myMesh->nodesIterator();
|
||||
while ( anIter->more() ) theObjs.push_back( anIter->next() );
|
||||
}
|
||||
break;
|
||||
case SMESH::EDGE:
|
||||
case SMDSAbs_Edge:
|
||||
{
|
||||
SMDS_EdgeIteratorPtr anIter = myMesh->edgesIterator();
|
||||
while ( anIter->more() ) theObjs.push_back( anIter->next() );
|
||||
}
|
||||
break;
|
||||
case SMESH::FACE:
|
||||
case SMDSAbs_Face:
|
||||
{
|
||||
SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
|
||||
while ( anIter->more() ) theObjs.push_back( anIter->next() );
|
||||
}
|
||||
break;
|
||||
case SMESH::VOLUME:
|
||||
case SMDSAbs_Volume:
|
||||
{
|
||||
SMDS_VolumeIteratorPtr anIter = myMesh->volumesIterator();
|
||||
while ( anIter->more() ) theObjs.push_back( anIter->next() );
|
||||
@ -957,14 +961,14 @@ static int getNodesFromElems( SMESH::long_array_var& theElemIds,
|
||||
// function : getPointers
|
||||
// purpose : Get std::list<const SMDS_MeshElement*> from list of IDs
|
||||
//=================================================================================
|
||||
static int getPointers( const SMESH::ElementType theRequestType,
|
||||
static int getPointers( const SMDSAbs_ElementType theRequestType,
|
||||
SMESH::long_array_var& theElemIds,
|
||||
const SMDS_Mesh* theMesh,
|
||||
std::list<const SMDS_MeshElement*>& theResList )
|
||||
{
|
||||
for ( CORBA::Long i = 0, n = theElemIds->length(); i < n; i++ )
|
||||
{
|
||||
const SMDS_MeshElement* anElem = theRequestType == SMESH::NODE
|
||||
const SMDS_MeshElement* anElem = theRequestType == SMDSAbs_Node
|
||||
? theMesh->FindNode( theElemIds[ i ] ) : theMesh->FindElement( theElemIds[ i ] );
|
||||
|
||||
if ( anElem != 0 )
|
||||
@ -979,15 +983,15 @@ static int getPointers( const SMESH::ElementType theRequestType,
|
||||
// function : GetEntities
|
||||
// purpose : Get entities of specified type. Return number of entities
|
||||
//=================================================================================
|
||||
int SMESH_GroupObj::GetNbEntities( const SMESH::ElementType theType) const
|
||||
int SMESH_GroupObj::GetNbEntities( const SMDSAbs_ElementType theType) const
|
||||
{
|
||||
if(myGroupServer->GetType() == theType){
|
||||
if(SMDSAbs_ElementType(myGroupServer->GetType()) == theType){
|
||||
return myGroupServer->Size();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SMESH_GroupObj::GetEntities( const SMESH::ElementType theType, TEntityList& theResList ) const
|
||||
int SMESH_GroupObj::GetEntities( const SMDSAbs_ElementType theType, TEntityList& theResList ) const
|
||||
{
|
||||
theResList.clear();
|
||||
SMDS_Mesh* aMesh = myMeshObj->GetMesh();
|
||||
@ -995,12 +999,12 @@ int SMESH_GroupObj::GetEntities( const SMESH::ElementType theType, TEntityList&
|
||||
if ( myGroupServer->Size() == 0 || aMesh == 0 )
|
||||
return 0;
|
||||
|
||||
SMESH::ElementType aGrpType = myGroupServer->GetType();
|
||||
SMDSAbs_ElementType aGrpType = SMDSAbs_ElementType(myGroupServer->GetType());
|
||||
SMESH::long_array_var anIds = myGroupServer->GetListOfID();
|
||||
|
||||
if ( aGrpType == theType )
|
||||
return getPointers( theType, anIds, aMesh, theResList );
|
||||
else if ( theType == SMESH::NODE )
|
||||
else if ( theType == SMDSAbs_Node )
|
||||
return getNodesFromElems( anIds, aMesh, theResList );
|
||||
else
|
||||
return 0;
|
||||
@ -1037,20 +1041,21 @@ SMESH_subMeshObj::~SMESH_subMeshObj()
|
||||
// function : GetEntities
|
||||
// purpose : Get entities of specified type. Return number of entities
|
||||
//=================================================================================
|
||||
int SMESH_subMeshObj::GetNbEntities( const SMESH::ElementType theType) const
|
||||
int SMESH_subMeshObj::GetNbEntities( const SMDSAbs_ElementType theType) const
|
||||
{
|
||||
switch ( theType )
|
||||
{
|
||||
case SMESH::NODE:
|
||||
case SMDSAbs_Node:
|
||||
{
|
||||
return mySubMeshServer->GetNumberOfNodes( false );
|
||||
}
|
||||
break;
|
||||
case SMESH::EDGE:
|
||||
case SMESH::FACE:
|
||||
case SMESH::VOLUME:
|
||||
case SMDSAbs_Edge:
|
||||
case SMDSAbs_Face:
|
||||
case SMDSAbs_Volume:
|
||||
{
|
||||
SMESH::long_array_var anIds = mySubMeshServer->GetElementsByType( theType );
|
||||
SMESH::long_array_var anIds =
|
||||
mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) );
|
||||
return anIds->length();
|
||||
}
|
||||
default:
|
||||
@ -1059,7 +1064,7 @@ int SMESH_subMeshObj::GetNbEntities( const SMESH::ElementType theType) const
|
||||
}
|
||||
}
|
||||
|
||||
int SMESH_subMeshObj::GetEntities( const SMESH::ElementType theType, TEntityList& theResList ) const
|
||||
int SMESH_subMeshObj::GetEntities( const SMDSAbs_ElementType theType, TEntityList& theResList ) const
|
||||
{
|
||||
theResList.clear();
|
||||
|
||||
@ -1071,22 +1076,23 @@ int SMESH_subMeshObj::GetEntities( const SMESH::ElementType theType, TEntityList
|
||||
|
||||
if ( isNodal )
|
||||
{
|
||||
if ( theType == SMESH::NODE )
|
||||
if ( theType == SMDSAbs_Node )
|
||||
{
|
||||
SMESH::long_array_var anIds = mySubMeshServer->GetNodesId();
|
||||
return getPointers( SMESH::NODE, anIds, aMesh, theResList );
|
||||
return getPointers( SMDSAbs_Node, anIds, aMesh, theResList );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( theType == SMESH::NODE )
|
||||
if ( theType == SMDSAbs_Node )
|
||||
{
|
||||
SMESH::long_array_var anIds = mySubMeshServer->GetElementsId();
|
||||
return getNodesFromElems( anIds, aMesh, theResList );
|
||||
}
|
||||
else
|
||||
{
|
||||
SMESH::long_array_var anIds = mySubMeshServer->GetElementsByType( theType );
|
||||
SMESH::long_array_var anIds =
|
||||
mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) );
|
||||
return getPointers( theType, anIds, aMesh, theResList );
|
||||
}
|
||||
}
|
||||
|
@ -29,30 +29,14 @@
|
||||
#ifndef SMESH_OBJECT_H
|
||||
#define SMESH_OBJECT_H
|
||||
|
||||
// IDL Headers
|
||||
#include "SALOMEconfig.h"
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
#include CORBA_SERVER_HEADER(SMESH_Group)
|
||||
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <vtkSystemIncludes.h>
|
||||
|
||||
#include "SMESH_Controls.hxx"
|
||||
#include "SMDSAbs_ElementType.hxx"
|
||||
|
||||
class vtkUnstructuredGrid;
|
||||
class vtkPoints;
|
||||
class SALOME_ExtractUnstructuredGrid;
|
||||
|
||||
class SMESH_Actor;
|
||||
class SMDS_Mesh;
|
||||
class SMDS_MeshNode;
|
||||
class SMDS_MeshElement;
|
||||
|
||||
class SMESH_VisualObj;
|
||||
typedef boost::shared_ptr<SMESH_VisualObj> TVisualObjPtr;
|
||||
|
||||
class vtkUnstructuredGrid;
|
||||
|
||||
/*
|
||||
Class : SMESH_VisualObj
|
||||
@ -60,155 +44,27 @@ typedef boost::shared_ptr<SMESH_VisualObj> TVisualObjPtr;
|
||||
*/
|
||||
class SMESH_VisualObj
|
||||
{
|
||||
protected:
|
||||
|
||||
typedef std::list<const SMDS_MeshElement*> TEntityList;
|
||||
typedef std::map<vtkIdType,vtkIdType> TMapOfIds;
|
||||
|
||||
public:
|
||||
SMESH_VisualObj();
|
||||
virtual ~SMESH_VisualObj();
|
||||
virtual void Update( int theIsClear = true ) = 0;
|
||||
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 SMDS_Mesh* GetMesh() const = 0;
|
||||
|
||||
virtual bool GetEdgeNodes( const int theElemId,
|
||||
const int theEdgeNum,
|
||||
int& theNodeId1,
|
||||
int& theNodeId2 ) const = 0;
|
||||
|
||||
virtual void Update( int theIsClear = true ) = 0;
|
||||
virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor ) = 0;
|
||||
virtual int GetElemDimension( const int theObjId ) = 0;
|
||||
|
||||
virtual int GetNbEntities( const SMESH::ElementType) const = 0;
|
||||
virtual int GetEntities( const SMESH::ElementType, TEntityList& ) const = 0;
|
||||
virtual bool IsNodePrs() const = 0;
|
||||
virtual SMDS_Mesh* GetMesh() const = 0;
|
||||
|
||||
bool GetEdgeNodes( const int theElemId,
|
||||
const int theEdgeNum,
|
||||
int& theNodeId1,
|
||||
int& theNodeId2 ) const;
|
||||
|
||||
vtkUnstructuredGrid* GetUnstructuredGrid() { return myGrid; }
|
||||
virtual vtkUnstructuredGrid* GetUnstructuredGrid() = 0;
|
||||
|
||||
vtkIdType GetNodeObjId( int theVTKID );
|
||||
vtkIdType GetNodeVTKId( int theObjID );
|
||||
vtkIdType GetElemObjId( int theVTKID );
|
||||
vtkIdType GetElemVTKId( int theObjID );
|
||||
|
||||
protected:
|
||||
|
||||
void createPoints( vtkPoints* );
|
||||
void buildPrs();
|
||||
void buildNodePrs();
|
||||
void buildElemPrs();
|
||||
|
||||
private:
|
||||
|
||||
TMapOfIds mySMDS2VTKNodes;
|
||||
TMapOfIds myVTK2SMDSNodes;
|
||||
TMapOfIds mySMDS2VTKElems;
|
||||
TMapOfIds myVTK2SMDSElems;
|
||||
|
||||
vtkUnstructuredGrid* myGrid;
|
||||
virtual vtkIdType GetNodeObjId( int theVTKID ) = 0;
|
||||
virtual vtkIdType GetNodeVTKId( int theObjID ) = 0;
|
||||
virtual vtkIdType GetElemObjId( int theVTKID ) = 0;
|
||||
virtual vtkIdType GetElemVTKId( int theObjID ) = 0;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Class : SMESH_MeshObj
|
||||
Description : Class for visualisation of mesh
|
||||
*/
|
||||
|
||||
class SMESH_MeshObj: public SMESH_VisualObj
|
||||
{
|
||||
public:
|
||||
|
||||
SMESH_MeshObj( SMESH::SMESH_Mesh_ptr );
|
||||
virtual ~SMESH_MeshObj();
|
||||
|
||||
virtual void Update( int theIsClear = true );
|
||||
|
||||
virtual int GetNbEntities( const SMESH::ElementType) const;
|
||||
virtual int GetEntities( const SMESH::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 myMeshServer.in(); }
|
||||
SMDS_Mesh* GetMesh() const { return myMesh; }
|
||||
|
||||
protected:
|
||||
|
||||
SMESH::SMESH_Mesh_var myMeshServer;
|
||||
SMDS_Mesh* myMesh;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Class : SMESH_SubMeshObj
|
||||
Description : Base class for visualisation of submeshes and groups
|
||||
*/
|
||||
|
||||
class SMESH_SubMeshObj: public SMESH_VisualObj
|
||||
{
|
||||
public:
|
||||
|
||||
SMESH_SubMeshObj(SMESH_MeshObj* theMeshObj);
|
||||
virtual ~SMESH_SubMeshObj();
|
||||
|
||||
virtual void Update( int theIsClear = true );
|
||||
|
||||
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 SMESH_GroupObj: public SMESH_SubMeshObj
|
||||
{
|
||||
public:
|
||||
SMESH_GroupObj( SMESH::SMESH_GroupBase_ptr, SMESH_MeshObj* );
|
||||
virtual ~SMESH_GroupObj();
|
||||
|
||||
virtual int GetNbEntities( const SMESH::ElementType) const;
|
||||
virtual int GetEntities( const SMESH::ElementType, TEntityList& ) const;
|
||||
virtual bool IsNodePrs() const;
|
||||
|
||||
private:
|
||||
|
||||
SMESH::SMESH_GroupBase_var myGroupServer;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Class : SMESH_subMeshObj
|
||||
Description : Class for visualisation of submeshes
|
||||
*/
|
||||
|
||||
class SMESH_subMeshObj : public SMESH_SubMeshObj
|
||||
{
|
||||
public:
|
||||
|
||||
SMESH_subMeshObj( SMESH::SMESH_subMesh_ptr,
|
||||
SMESH_MeshObj* );
|
||||
virtual ~SMESH_subMeshObj();
|
||||
|
||||
virtual int GetNbEntities( const SMESH::ElementType) const;
|
||||
virtual int GetEntities( const SMESH::ElementType, TEntityList& ) const;
|
||||
virtual bool IsNodePrs() const;
|
||||
|
||||
protected:
|
||||
|
||||
SMESH::SMESH_subMesh_var mySubMeshServer;
|
||||
};
|
||||
|
||||
|
||||
extern void WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid, const char* theFileName);
|
||||
|
||||
typedef boost::shared_ptr<SMESH_VisualObj> TVisualObjPtr;
|
||||
|
||||
#endif
|
||||
|
207
src/OBJECT/SMESH_ObjectDef.h
Normal file
207
src/OBJECT/SMESH_ObjectDef.h
Normal file
@ -0,0 +1,207 @@
|
||||
// SMESH OBJECT : interactive object for SMESH visualization
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESH_Object.h
|
||||
// Author : Nicolas REJNERI
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef SMESH_OBJECTDEF_H
|
||||
#define SMESH_OBJECTDEF_H
|
||||
|
||||
// IDL Headers
|
||||
#include "SALOMEconfig.h"
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
#include CORBA_SERVER_HEADER(SMESH_Group)
|
||||
|
||||
#include <map>
|
||||
#include <list>
|
||||
|
||||
#include "SMESH_Controls.hxx"
|
||||
#include "SMESH_Object.h"
|
||||
|
||||
class vtkPoints;
|
||||
class SALOME_ExtractUnstructuredGrid;
|
||||
|
||||
class SMESH_Actor;
|
||||
class SMDS_MeshNode;
|
||||
class SMDS_MeshElement;
|
||||
|
||||
/*
|
||||
Class : SMESH_VisualObj
|
||||
Description : Base class for all mesh objects to be visuilised
|
||||
*/
|
||||
class SMESH_VisualObjDef: public SMESH_VisualObj
|
||||
{
|
||||
protected:
|
||||
|
||||
typedef std::list<const SMDS_MeshElement*> TEntityList;
|
||||
typedef std::map<vtkIdType,vtkIdType> TMapOfIds;
|
||||
|
||||
public:
|
||||
SMESH_VisualObjDef();
|
||||
virtual ~SMESH_VisualObjDef();
|
||||
|
||||
virtual void Update( int theIsClear = true ) = 0;
|
||||
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;
|
||||
|
||||
virtual bool GetEdgeNodes( const int theElemId,
|
||||
const int theEdgeNum,
|
||||
int& theNodeId1,
|
||||
int& theNodeId2 ) const;
|
||||
|
||||
virtual vtkUnstructuredGrid* GetUnstructuredGrid() { return myGrid; }
|
||||
|
||||
virtual vtkIdType GetNodeObjId( int theVTKID );
|
||||
virtual vtkIdType GetNodeVTKId( int theObjID );
|
||||
virtual vtkIdType GetElemObjId( int theVTKID );
|
||||
virtual vtkIdType GetElemVTKId( int theObjID );
|
||||
|
||||
protected:
|
||||
|
||||
void createPoints( vtkPoints* );
|
||||
void buildPrs();
|
||||
void buildNodePrs();
|
||||
void buildElemPrs();
|
||||
|
||||
private:
|
||||
|
||||
TMapOfIds mySMDS2VTKNodes;
|
||||
TMapOfIds myVTK2SMDSNodes;
|
||||
TMapOfIds mySMDS2VTKElems;
|
||||
TMapOfIds myVTK2SMDSElems;
|
||||
|
||||
vtkUnstructuredGrid* myGrid;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Class : SMESH_MeshObj
|
||||
Description : Class for visualisation of mesh
|
||||
*/
|
||||
|
||||
class SMESH_MeshObj: public SMESH_VisualObjDef
|
||||
{
|
||||
public:
|
||||
|
||||
SMESH_MeshObj( SMESH::SMESH_Mesh_ptr );
|
||||
virtual ~SMESH_MeshObj();
|
||||
|
||||
virtual void Update( int theIsClear = true );
|
||||
|
||||
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 myMeshServer.in(); }
|
||||
SMDS_Mesh* GetMesh() const { return myMesh; }
|
||||
|
||||
protected:
|
||||
|
||||
SMESH::SMESH_Mesh_var myMeshServer;
|
||||
SMDS_Mesh* myMesh;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Class : SMESH_SubMeshObj
|
||||
Description : Base class for visualisation of submeshes and groups
|
||||
*/
|
||||
|
||||
class SMESH_SubMeshObj: public SMESH_VisualObjDef
|
||||
{
|
||||
public:
|
||||
|
||||
SMESH_SubMeshObj(SMESH_MeshObj* theMeshObj);
|
||||
virtual ~SMESH_SubMeshObj();
|
||||
|
||||
virtual void Update( int theIsClear = true );
|
||||
|
||||
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 SMESH_GroupObj: public SMESH_SubMeshObj
|
||||
{
|
||||
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;
|
||||
|
||||
private:
|
||||
|
||||
SMESH::SMESH_GroupBase_var myGroupServer;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Class : SMESH_subMeshObj
|
||||
Description : Class for visualisation of submeshes
|
||||
*/
|
||||
|
||||
class SMESH_subMeshObj : public SMESH_SubMeshObj
|
||||
{
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
extern void WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid, const char* theFileName);
|
||||
|
||||
|
||||
#endif
|
@ -2381,9 +2381,9 @@ bool SMESHGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString
|
||||
popup->setItemChecked( 9010, anActor->GetPointsLabeled() ); // Numbering / Display Nodes #
|
||||
popup->setItemChecked( 9011, anActor->GetCellsLabeled() ); // Numbering / Display Elements #
|
||||
TVisualObjPtr aVisualObj = anActor->GetObject();
|
||||
int aNbEdges = aVisualObj->GetNbEntities(SMESH::EDGE);
|
||||
int aNbFaces = aVisualObj->GetNbEntities(SMESH::FACE);
|
||||
int aNbVolumes = aVisualObj->GetNbEntities(SMESH::VOLUME);
|
||||
int aNbEdges = aVisualObj->GetNbEntities(SMDSAbs_Edge);
|
||||
int aNbFaces = aVisualObj->GetNbEntities(SMDSAbs_Face);
|
||||
int aNbVolumes = aVisualObj->GetNbEntities(SMDSAbs_Volume);
|
||||
|
||||
QMenuItem* mi = popup->findItem( 1131 );
|
||||
if ( mi && mi->popup() ) {
|
||||
|
@ -56,6 +56,10 @@
|
||||
#include <qvalidator.h>
|
||||
#include <qpixmap.h>
|
||||
|
||||
// IDL Headers
|
||||
#include "SALOMEconfig.h"
|
||||
#include CORBA_SERVER_HEADER(SMESH_Group)
|
||||
|
||||
using namespace std;
|
||||
|
||||
//=================================================================================
|
||||
|
@ -81,6 +81,10 @@
|
||||
#include <qobjectlist.h>
|
||||
#include <qvalidator.h>
|
||||
|
||||
// IDL Headers
|
||||
#include "SALOMEconfig.h"
|
||||
#include CORBA_SERVER_HEADER(SMESH_Group)
|
||||
|
||||
#define SPACING 5
|
||||
#define MARGIN 10
|
||||
|
||||
|
@ -70,6 +70,10 @@
|
||||
#include <qpushbutton.h>
|
||||
#include <qapplication.h>
|
||||
|
||||
// IDL Headers
|
||||
#include "SALOMEconfig.h"
|
||||
#include CORBA_SERVER_HEADER(SMESH_Group)
|
||||
|
||||
#define SPACING 5
|
||||
#define MARGIN 10
|
||||
|
||||
|
@ -46,6 +46,8 @@
|
||||
#include "QAD_MessageBox.h"
|
||||
|
||||
#include "SMESH_Actor.h"
|
||||
#include "SMESH_ObjectDef.h"
|
||||
|
||||
#include "SMDS_Mesh.hxx"
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
|
||||
|
@ -56,6 +56,10 @@
|
||||
#include <qvalidator.h>
|
||||
#include <qpixmap.h>
|
||||
|
||||
// IDL Headers
|
||||
#include "SALOMEconfig.h"
|
||||
#include CORBA_SERVER_HEADER(SMESH_Group)
|
||||
|
||||
using namespace std;
|
||||
|
||||
//=================================================================================
|
||||
|
@ -55,6 +55,10 @@
|
||||
#include <qlayout.h>
|
||||
#include <qpixmap.h>
|
||||
|
||||
// IDL Headers
|
||||
#include "SALOMEconfig.h"
|
||||
#include CORBA_SERVER_HEADER(SMESH_Group)
|
||||
|
||||
using namespace std;
|
||||
|
||||
//=================================================================================
|
||||
|
@ -58,6 +58,10 @@
|
||||
#include <qvalidator.h>
|
||||
#include <qpixmap.h>
|
||||
|
||||
// IDL Headers
|
||||
#include "SALOMEconfig.h"
|
||||
#include CORBA_SERVER_HEADER(SMESH_Group)
|
||||
|
||||
using namespace std;
|
||||
|
||||
//=================================================================================
|
||||
|
@ -55,6 +55,10 @@
|
||||
#include <qlayout.h>
|
||||
#include <qpixmap.h>
|
||||
|
||||
// IDL Headers
|
||||
#include "SALOMEconfig.h"
|
||||
#include CORBA_SERVER_HEADER(SMESH_Group)
|
||||
|
||||
using namespace std;
|
||||
|
||||
//=================================================================================
|
||||
|
@ -56,6 +56,10 @@
|
||||
#include <qspinbox.h>
|
||||
#include <qpixmap.h>
|
||||
|
||||
// IDL Headers
|
||||
#include "SALOMEconfig.h"
|
||||
#include CORBA_SERVER_HEADER(SMESH_Group)
|
||||
|
||||
using namespace std;
|
||||
|
||||
//=================================================================================
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
|
||||
|
||||
#include "SMESH_Actor.h"
|
||||
#include "SMESH_ObjectDef.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user