mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-19 04:00:32 +05:00
Fix for the bug IPAL22828 TC6.4.0: Displayed entities are wrong
This commit is contained in:
parent
8191e5eb44
commit
6665afd414
@ -41,8 +41,10 @@
|
||||
#include "utilities.h"
|
||||
|
||||
#include <vtkUnstructuredGrid.h>
|
||||
#include <vtkCellType.h>
|
||||
#include <vtkXMLUnstructuredGridWriter.h>
|
||||
#include <vtkUnstructuredGridWriter.h>
|
||||
#include <vtkUnsignedCharArray.h>
|
||||
|
||||
//#ifdef _DEBUG_
|
||||
//static int MYDEBUG = 1;
|
||||
@ -155,6 +157,20 @@ namespace SMESH
|
||||
}
|
||||
}
|
||||
|
||||
std::map<SMDSAbs_ElementType,int> GetEntitiesFromObject(SMESH_VisualObj *theObject) {
|
||||
std::map<SMDSAbs_ElementType,int> entities;
|
||||
entities.insert(std::pair<SMDSAbs_ElementType,int>(SMDSAbs_0DElement,
|
||||
theObject ? theObject->GetNbEntities(SMDSAbs_0DElement) : 0));
|
||||
entities.insert(std::pair<SMDSAbs_ElementType,int>(SMDSAbs_Edge,
|
||||
theObject ? theObject->GetNbEntities(SMDSAbs_Edge) : 0));
|
||||
entities.insert(std::pair<SMDSAbs_ElementType,int>(SMDSAbs_Face,
|
||||
theObject ? theObject->GetNbEntities(SMDSAbs_Face) : 0));
|
||||
entities.insert(std::pair<SMDSAbs_ElementType,int>(SMDSAbs_Volume,
|
||||
theObject ? theObject->GetNbEntities(SMDSAbs_Volume) : 0));
|
||||
return entities;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifndef DISABLE_PLOT2DVIEWER
|
||||
//=======================================================================
|
||||
|
@ -24,6 +24,7 @@
|
||||
#define SMESH_ACTORUTILS_H
|
||||
|
||||
#include "SMESH_Object.h"
|
||||
#include <map>
|
||||
|
||||
#include <QColor>
|
||||
|
||||
@ -75,6 +76,10 @@ SMESHOBJECT_EXPORT
|
||||
int& delta,
|
||||
QString def);
|
||||
|
||||
SMESHOBJECT_EXPORT
|
||||
std::map<SMDSAbs_ElementType,int>
|
||||
GetEntitiesFromObject(SMESH_VisualObj *theObject);
|
||||
|
||||
SMESHOBJECT_EXPORT
|
||||
void
|
||||
WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid,
|
||||
|
@ -136,6 +136,8 @@ SMESH_VisualObjDef::SMESH_VisualObjDef()
|
||||
MESSAGE("---------------------------------------------SMESH_VisualObjDef::SMESH_VisualObjDef");
|
||||
myGrid = vtkUnstructuredGrid::New();
|
||||
myLocalGrid = false;
|
||||
ClearEntitiesFlags();
|
||||
SMESH::GetEntitiesFromObject(NULL);
|
||||
}
|
||||
SMESH_VisualObjDef::~SMESH_VisualObjDef()
|
||||
{
|
||||
@ -275,6 +277,7 @@ void SMESH_VisualObjDef::buildPrs(bool buildGrid)
|
||||
GetMesh()->compactMesh();
|
||||
}
|
||||
vtkUnstructuredGrid *theGrid = GetMesh()->getGrid();
|
||||
updateEntitiesFlags();
|
||||
myGrid->ShallowCopy(theGrid);
|
||||
//MESSAGE(myGrid->GetReferenceCount());
|
||||
//MESSAGE( "Update - myGrid->GetNumberOfCells() = "<<myGrid->GetNumberOfCells() );
|
||||
@ -598,6 +601,7 @@ vtkUnstructuredGrid* SMESH_VisualObjDef::GetUnstructuredGrid()
|
||||
if ( !myLocalGrid && !GetMesh()->isCompacted() )
|
||||
{
|
||||
GetMesh()->compactMesh();
|
||||
updateEntitiesFlags();
|
||||
vtkUnstructuredGrid *theGrid = GetMesh()->getGrid();
|
||||
myGrid->ShallowCopy(theGrid);
|
||||
}
|
||||
@ -619,6 +623,62 @@ bool SMESH_VisualObjDef::IsValid() const
|
||||
GetNbEntities(SMDSAbs_Volume) > 0 ;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : updateEntitiesFlags
|
||||
// purpose : Update entities flags
|
||||
//=================================================================================
|
||||
void SMESH_VisualObjDef::updateEntitiesFlags() {
|
||||
|
||||
unsigned int tmp = myEntitiesState;
|
||||
ClearEntitiesFlags();
|
||||
|
||||
map<SMDSAbs_ElementType,int> entities = SMESH::GetEntitiesFromObject(this);
|
||||
|
||||
|
||||
if( myEntitiesCache[SMDSAbs_0DElement] != 0 || myEntitiesCache[SMDSAbs_0DElement] >= entities[SMDSAbs_0DElement] )
|
||||
myEntitiesState &= ~SMESH_Actor::e0DElements;
|
||||
|
||||
if( myEntitiesCache[SMDSAbs_Edge] != 0 || myEntitiesCache[SMDSAbs_Edge] >= entities[SMDSAbs_Edge] )
|
||||
myEntitiesState &= ~SMESH_Actor::eEdges;
|
||||
|
||||
if( myEntitiesCache[SMDSAbs_Face] != 0 || myEntitiesCache[SMDSAbs_Face] >= entities[SMDSAbs_Face] )
|
||||
myEntitiesState &= ~SMESH_Actor::eFaces;
|
||||
|
||||
if( myEntitiesCache[SMDSAbs_Volume] != 0 || myEntitiesCache[SMDSAbs_Volume] >= entities[SMDSAbs_Volume] )
|
||||
myEntitiesState &= ~SMESH_Actor::eVolumes;
|
||||
|
||||
if( tmp != myEntitiesState ) {
|
||||
myEntitiesFlag = true;
|
||||
}
|
||||
|
||||
myEntitiesCache = entities;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClearEntitiesFlags
|
||||
// purpose : Clear the entities flags
|
||||
//=================================================================================
|
||||
void SMESH_VisualObjDef::ClearEntitiesFlags() {
|
||||
myEntitiesState = SMESH_Actor::eAllEntity;
|
||||
myEntitiesFlag = false;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : GetEntitiesFlag
|
||||
// purpose : Return the entities flag
|
||||
//=================================================================================
|
||||
bool SMESH_VisualObjDef::GetEntitiesFlag() {
|
||||
return myEntitiesFlag;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : GetEntitiesState
|
||||
// purpose : Return the entities state
|
||||
//=================================================================================
|
||||
unsigned int SMESH_VisualObjDef::GetEntitiesState() {
|
||||
return myEntitiesState;
|
||||
}
|
||||
|
||||
/*
|
||||
Class : SMESH_MeshObj
|
||||
Description : Class for visualisation of mesh
|
||||
|
@ -75,6 +75,9 @@ public:
|
||||
virtual vtkIdType GetNodeVTKId( int theObjID ) = 0;
|
||||
virtual vtkIdType GetElemObjId( int theVTKID ) = 0;
|
||||
virtual vtkIdType GetElemVTKId( int theObjID ) = 0;
|
||||
virtual void ClearEntitiesFlags() = 0;
|
||||
virtual bool GetEntitiesFlag() = 0;
|
||||
virtual unsigned int GetEntitiesState() = 0;
|
||||
};
|
||||
|
||||
typedef boost::shared_ptr<SMESH_VisualObj> TVisualObjPtr;
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "SMESH_Controls.hxx"
|
||||
#include "SMESH_Object.h"
|
||||
#include "SMESH_Client.hxx"
|
||||
#include "SMESH_Actor.h"
|
||||
|
||||
// IDL Headers
|
||||
#include <SALOMEconfig.h>
|
||||
@ -44,7 +45,6 @@
|
||||
class vtkPoints;
|
||||
class SALOME_ExtractUnstructuredGrid;
|
||||
|
||||
class SMESH_Actor;
|
||||
class SMDS_MeshNode;
|
||||
class SMDS_MeshElement;
|
||||
|
||||
@ -85,13 +85,17 @@ public:
|
||||
virtual vtkIdType GetElemObjId( int theVTKID );
|
||||
virtual vtkIdType GetElemVTKId( int theObjID );
|
||||
|
||||
virtual void ClearEntitiesFlags();
|
||||
virtual bool GetEntitiesFlag();
|
||||
virtual unsigned int GetEntitiesState();
|
||||
|
||||
protected:
|
||||
|
||||
void createPoints( vtkPoints* );
|
||||
void buildPrs(bool buildGrid = false);
|
||||
void buildNodePrs();
|
||||
void buildElemPrs();
|
||||
|
||||
void updateEntitiesFlags();
|
||||
//private:
|
||||
|
||||
TMapOfIds mySMDS2VTKNodes;
|
||||
@ -100,7 +104,11 @@ protected:
|
||||
TMapOfIds myVTK2SMDSElems;
|
||||
bool myLocalGrid;
|
||||
|
||||
bool myEntitiesFlag;
|
||||
unsigned int myEntitiesState;
|
||||
|
||||
vtkUnstructuredGrid* myGrid;
|
||||
std::map<SMDSAbs_ElementType,int> myEntitiesCache;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user