Fix. Bug PAL8109 CRASH of "Salome" happens if to check "Free Borders" control at the clipping of mesh.

Fix. Bug PAL8024 Incorrect selection of the elements.
This commit is contained in:
enk 2005-02-11 12:34:57 +00:00
parent fa397b27d1
commit fb7bf211bb
2 changed files with 49 additions and 12 deletions

View File

@ -239,6 +239,7 @@ SMESH_ActorDef::SMESH_ActorDef(){
myBaseActor->SetUserMatrix(aMatrix); myBaseActor->SetUserMatrix(aMatrix);
myBaseActor->SetStoreMapping(true); myBaseActor->SetStoreMapping(true);
myBaseActor->GetProperty()->SetOpacity(0.0); myBaseActor->GetProperty()->SetOpacity(0.0);
myBaseActor->myGeomFilter->SetInside(true);
myPickableActor = myBaseActor; myPickableActor = myBaseActor;
@ -734,8 +735,6 @@ void SMESH_ActorDef::SetControlMode(eControl theMode){
my1DExtActor->SetExtControlMode(aFunctor,myControlActor); my1DExtActor->SetExtControlMode(aFunctor,myControlActor);
break; break;
case eLength2D: case eLength2D:
my1DExtActor->SetExtControlMode(aFunctor,myControlActor,myScalarBarActor,myLookupTable);
break;
case eMultiConnection2D: case eMultiConnection2D:
my1DExtActor->SetExtControlMode(aFunctor,myControlActor,myScalarBarActor,myLookupTable); my1DExtActor->SetExtControlMode(aFunctor,myControlActor,myScalarBarActor,myLookupTable);
break; break;
@ -1087,11 +1086,46 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
if(!myVisualObj->GetNbEntities(SMDSAbs_Volume)) if(!myVisualObj->GetNbEntities(SMDSAbs_Volume))
theMode &= ~eVolumes; theMode &= ~eVolumes;
if(!theMode) if(!theMode){
return; if(myVisualObj->GetNbEntities(SMDSAbs_Edge))
theMode |= eEdges;
if(myVisualObj->GetNbEntities(SMDSAbs_Face))
theMode |= eFaces;
if(myVisualObj->GetNbEntities(SMDSAbs_Volume))
theMode |= eVolumes;
}
myEntityMode = theMode; myEntityMode = theMode;
SALOME_ExtractUnstructuredGrid* aFilter = NULL;
aFilter = myBaseActor->GetExtractUnstructuredGrid();
aFilter->ClearRegisteredCellsWithType();
aFilter->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::eAdding);
if(myEntityMode & eEdges){
if (MYDEBUG) MESSAGE("EDGES");
aFilter->RegisterCellsWithType(VTK_LINE);
}
if(myEntityMode & eFaces){
if (MYDEBUG) MESSAGE("FACES");
aFilter->RegisterCellsWithType(VTK_TRIANGLE);
aFilter->RegisterCellsWithType(VTK_POLYGON);
aFilter->RegisterCellsWithType(VTK_QUAD);
}
if(myEntityMode & eVolumes){
if (MYDEBUG) MESSAGE("VOLUMES");
aFilter->RegisterCellsWithType(VTK_TETRA);
aFilter->RegisterCellsWithType(VTK_VOXEL);
aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
aFilter->RegisterCellsWithType(VTK_WEDGE);
aFilter->RegisterCellsWithType(VTK_PYRAMID);
aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
}
aFilter->Update();
if (MYDEBUG) MESSAGE(aFilter->GetOutput()->GetNumberOfCells());
SetVisibility(GetVisibility(),false); SetVisibility(GetVisibility(),false);
} }
@ -1292,6 +1326,7 @@ void SMESH_ActorDef::Update(){
if(myIsCellsLabeled){ if(myIsCellsLabeled){
SetCellsLabeled(myIsCellsLabeled); SetCellsLabeled(myIsCellsLabeled);
} }
SetEntityMode(GetEntityMode());
SetVisibility(GetVisibility()); SetVisibility(GetVisibility());
myTimeStamp->Modified(); myTimeStamp->Modified();

View File

@ -143,7 +143,10 @@ SMESH_DeviceActor::~SMESH_DeviceActor(){
void SMESH_DeviceActor::SetStoreMapping(int theStoreMapping){ void SMESH_DeviceActor::SetStoreMapping(int theStoreMapping){
if (myStoreMapping == theStoreMapping)
return;
myStoreMapping = theStoreMapping; myStoreMapping = theStoreMapping;
myGeomFilter->SetStoreMapping( myStoreMapping );
Modified(); Modified();
} }
@ -409,11 +412,10 @@ void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor
using namespace SMESH::Controls; using namespace SMESH::Controls;
if(FreeBorders* aFreeBorders = dynamic_cast<FreeBorders*>(theFunctor.get())){ if(FreeBorders* aFreeBorders = dynamic_cast<FreeBorders*>(theFunctor.get())){
myExtractUnstructuredGrid->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::eAdding); myExtractUnstructuredGrid->SetModeOfChanging(SALOME_ExtractUnstructuredGrid::eAdding);
myExtractUnstructuredGrid->ClearRegisteredCells(); vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
vtkUnstructuredGrid* aGrid = theDeviceActor->GetUnstructuredGrid();
vtkIdType aNbCells = aGrid->GetNumberOfCells(); vtkIdType aNbCells = aGrid->GetNumberOfCells();
for( vtkIdType i = 0; i < aNbCells; i++ ){ for( vtkIdType i = 0; i < aNbCells; i++ ){
vtkIdType anObjId = theDeviceActor->GetElemObjId(i); vtkIdType anObjId = myVisualObj->GetElemObjId(i);
if(aFreeBorders->IsSatisfy(anObjId)) if(aFreeBorders->IsSatisfy(anObjId))
myExtractUnstructuredGrid->RegisterCell(i); myExtractUnstructuredGrid->RegisterCell(i);
} }
@ -517,7 +519,7 @@ void SMESH_DeviceActor::SetRepresentation(EReperesent theMode){
myGeomFilter->SetInside(true); myGeomFilter->SetInside(true);
GetProperty()->SetRepresentation(0); GetProperty()->SetRepresentation(0);
break; break;
case eInsideframe: case eInsideframe:
myGeomFilter->SetInside(true); myGeomFilter->SetInside(true);
GetProperty()->SetRepresentation(1); GetProperty()->SetRepresentation(1);
break; break;
@ -569,20 +571,20 @@ int SMESH_DeviceActor::GetElemObjId(int theVtkID){
vtkIdType anId = myGeomFilter->GetElemObjId(theVtkID); vtkIdType anId = myGeomFilter->GetElemObjId(theVtkID);
if(anId < 0) if(anId < 0)
return -1; return -1;
vtkIdType anId2 = myExtractUnstructuredGrid->GetInputId(anId); vtkIdType anId2 = myExtractGeometry->GetElemObjId(anId);
if(anId2 < 0) if(anId2 < 0)
return -1; return -1;
vtkIdType anId3 = myExtractGeometry->GetElemObjId(anId2); vtkIdType anId3 = myExtractUnstructuredGrid->GetInputId(anId2);
if(anId3 < 0) if(anId3 < 0)
return -1; return -1;
vtkIdType aRetID = myVisualObj->GetElemObjId(anId3); vtkIdType aRetID = myVisualObj->GetElemObjId(anId3);
if(MYDEBUG) if(MYDEBUG)
MESSAGE("GetElemObjId - theVtkID = "<<theVtkID<<"; anId2 = "<<anId2<<"; anId3 = "<<anId3<<"; aRetID = "<<aRetID); MESSAGE("GetElemObjId - theVtkID = "<<theVtkID<<"; anId2 = "<<anId2<<"; anId3 = "<<anId3<<"; aRetID = "<<aRetID);
return aRetID; return aRetID;
} }
vtkCell* SMESH_DeviceActor::GetElemCell(int theObjID){ vtkCell* SMESH_DeviceActor::GetElemCell(int theObjID){
vtkDataSet* aDataSet = myExtractGeometry->GetInput(); vtkDataSet* aDataSet = myVisualObj->GetUnstructuredGrid();
vtkIdType aGridID = myVisualObj->GetElemVTKId(theObjID); vtkIdType aGridID = myVisualObj->GetElemVTKId(theObjID);
vtkCell* aCell = aDataSet->GetCell(aGridID); vtkCell* aCell = aDataSet->GetCell(aGridID);
if(MYDEBUG) if(MYDEBUG)