From: eap Date: Wed, 1 Feb 2017 14:41:37 +0000 (+0300) Subject: IPAL53919: Pb with nodes after element removal X-Git-Tag: V8_3_0a2~19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b99e203236dfebf3a3539d1e05719bc817e12dd7;p=modules%2Fsmesh.git IPAL53919: Pb with nodes after element removal --- diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index 2fcd2a67c..43e4bca32 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -126,6 +126,7 @@ SMESH_ActorDef::SMESH_ActorDef() myIsPointsVisible = false; myIsEntityModeCache = false; + myRepresentationCache = 0; myHighlightActor = SMESH_SVTKActor::New(); myHighlightActor->Delete(); // vtkSmartPointer! @@ -1470,8 +1471,8 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation) myScalarBarActor->VisibilityOff(); - if(GetVisibility()){ - if(theIsUpdateRepersentation) + if ( GetVisibility() ) { + if ( theIsUpdateRepersentation ) SetRepresentation(GetRepresentation()); if(myControlMode != eNone) { @@ -1559,30 +1560,30 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation) void SMESH_ActorDef::SetEntityMode(unsigned int theMode) { - myEntityState = eAllEntity; // entities present in my object + unsigned int anObjectEntities = eAllEntity; // entities present in my object if(!myVisualObj->GetNbEntities(SMDSAbs_0DElement)) { - myEntityState &= ~e0DElements; + anObjectEntities &= ~e0DElements; theMode &= ~e0DElements; } if(!myVisualObj->GetNbEntities(SMDSAbs_Ball)) { - myEntityState &= ~eBallElem; + anObjectEntities &= ~eBallElem; theMode &= ~eBallElem; } if(!myVisualObj->GetNbEntities(SMDSAbs_Edge)) { - myEntityState &= ~eEdges; + anObjectEntities &= ~eEdges; theMode &= ~eEdges; } if(!myVisualObj->GetNbEntities(SMDSAbs_Face)) { - myEntityState &= ~eFaces; + anObjectEntities &= ~eFaces; theMode &= ~eFaces; } if(!myVisualObj->GetNbEntities(SMDSAbs_Volume)) { - myEntityState &= ~eVolumes; + anObjectEntities &= ~eVolumes; theMode &= ~eVolumes; } @@ -1603,102 +1604,109 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode) theMode |= eVolumes; } - myBaseActor->myGeomFilter->SetInside(myEntityMode != myEntityState); + myBaseActor->myGeomFilter->SetInside(myEntityMode != anObjectEntities); - myEntityMode = theMode; // entities to show - - VTKViewer_ExtractUnstructuredGrid* aFilter = myBaseActor->GetExtractUnstructuredGrid(); - aFilter->ClearRegisteredCellsWithType(); - VTKViewer_ExtractUnstructuredGrid* aHightFilter = myHighlitableActor->GetExtractUnstructuredGrid(); - aHightFilter->ClearRegisteredCellsWithType(); - - bool isPassAll = - (( myEntityMode & e0DElements || myVisualObj->GetNbEntities(SMDSAbs_0DElement) == 0 ) && - ( myEntityMode & eBallElem || myVisualObj->GetNbEntities(SMDSAbs_Ball) == 0 ) && - ( myEntityMode & eEdges || myVisualObj->GetNbEntities(SMDSAbs_Edge) == 0 ) && - ( myEntityMode & eFaces || myVisualObj->GetNbEntities(SMDSAbs_Face) == 0 ) && - ( myEntityMode & eVolumes || myVisualObj->GetNbEntities(SMDSAbs_Volume) == 0 )); - if ( isPassAll && myEntityMode ) + if ( anObjectEntities == 0 && myRepresentation != ePoint ) // no elements, show nodes { - aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll); - aHightFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll); + myRepresentationCache = GetRepresentation(); + SetRepresentation( ePoint ); } - else + + if ( myEntityMode != theMode ) { - aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding); - aHightFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding); + myEntityMode = theMode; // entities to show - if (myEntityMode & e0DElements) { - aFilter->RegisterCellsWithType(VTK_VERTEX); - aHightFilter->RegisterCellsWithType(VTK_VERTEX); - } + // Set cell types to extract + + VTKViewer_ExtractUnstructuredGrid* aFilter = myBaseActor->GetExtractUnstructuredGrid(); + VTKViewer_ExtractUnstructuredGrid* aHltFilter = myHighlitableActor->GetExtractUnstructuredGrid(); + aFilter->ClearRegisteredCellsWithType(); + aHltFilter->ClearRegisteredCellsWithType(); - if (myEntityMode & eBallElem) { - aFilter->RegisterCellsWithType(VTK_POLY_VERTEX); + bool isPassAll = ( myEntityMode == anObjectEntities && myEntityMode ); + if ( isPassAll ) + { + aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll); + aHltFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll); } + else + { + aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding); + aHltFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding); - if (myEntityMode & eEdges) { - aFilter->RegisterCellsWithType(VTK_LINE); - aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE); + if (myEntityMode & e0DElements) { + aFilter->RegisterCellsWithType(VTK_VERTEX); + aHltFilter->RegisterCellsWithType(VTK_VERTEX); + } - aHightFilter->RegisterCellsWithType(VTK_LINE); - aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE); - } + if (myEntityMode & eBallElem) { + aFilter->RegisterCellsWithType(VTK_POLY_VERTEX); + } - if (myEntityMode & eFaces) { - aFilter->RegisterCellsWithType(VTK_TRIANGLE); - aFilter->RegisterCellsWithType(VTK_QUAD); - aFilter->RegisterCellsWithType(VTK_POLYGON); - aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE); - aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD); - aFilter->RegisterCellsWithType(VTK_QUADRATIC_POLYGON); - aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD); - aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_TRIANGLE); - - aHightFilter->RegisterCellsWithType(VTK_TRIANGLE); - aHightFilter->RegisterCellsWithType(VTK_QUAD); - aHightFilter->RegisterCellsWithType(VTK_POLYGON); - aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE); - aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD); - aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_POLYGON); - aHightFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD); - aHightFilter->RegisterCellsWithType(VTK_BIQUADRATIC_TRIANGLE); - } + if (myEntityMode & eEdges) { + aFilter->RegisterCellsWithType(VTK_LINE); + aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE); + + aHltFilter->RegisterCellsWithType(VTK_LINE); + aHltFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE); + } - if (myEntityMode & eVolumes) { - aFilter->RegisterCellsWithType(VTK_TETRA); - aFilter->RegisterCellsWithType(VTK_VOXEL); - aFilter->RegisterCellsWithType(VTK_HEXAHEDRON); - aFilter->RegisterCellsWithType(VTK_WEDGE); - aFilter->RegisterCellsWithType(VTK_PYRAMID); - aFilter->RegisterCellsWithType(VTK_HEXAGONAL_PRISM); - aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA); - aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON); - aFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_HEXAHEDRON); - aFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID); - aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE); - aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET); - aFilter->RegisterCellsWithType(VTK_POLYHEDRON); - - aHightFilter->RegisterCellsWithType(VTK_TETRA); - aHightFilter->RegisterCellsWithType(VTK_VOXEL); - aHightFilter->RegisterCellsWithType(VTK_HEXAHEDRON); - aHightFilter->RegisterCellsWithType(VTK_WEDGE); - aHightFilter->RegisterCellsWithType(VTK_PYRAMID); - aHightFilter->RegisterCellsWithType(VTK_HEXAGONAL_PRISM); - aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA); - aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON); - aHightFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_HEXAHEDRON); - aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE); - aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID); - aHightFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET); - aHightFilter->RegisterCellsWithType(VTK_POLYHEDRON); + if (myEntityMode & eFaces) { + aFilter->RegisterCellsWithType(VTK_TRIANGLE); + aFilter->RegisterCellsWithType(VTK_QUAD); + aFilter->RegisterCellsWithType(VTK_POLYGON); + aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE); + aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD); + aFilter->RegisterCellsWithType(VTK_QUADRATIC_POLYGON); + aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD); + aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_TRIANGLE); + + aHltFilter->RegisterCellsWithType(VTK_TRIANGLE); + aHltFilter->RegisterCellsWithType(VTK_QUAD); + aHltFilter->RegisterCellsWithType(VTK_POLYGON); + aHltFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE); + aHltFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD); + aHltFilter->RegisterCellsWithType(VTK_QUADRATIC_POLYGON); + aHltFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD); + aHltFilter->RegisterCellsWithType(VTK_BIQUADRATIC_TRIANGLE); + } + + if (myEntityMode & eVolumes) { + aFilter->RegisterCellsWithType(VTK_TETRA); + aFilter->RegisterCellsWithType(VTK_VOXEL); + aFilter->RegisterCellsWithType(VTK_HEXAHEDRON); + aFilter->RegisterCellsWithType(VTK_WEDGE); + aFilter->RegisterCellsWithType(VTK_PYRAMID); + aFilter->RegisterCellsWithType(VTK_HEXAGONAL_PRISM); + aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA); + aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON); + aFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_HEXAHEDRON); + aFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID); + aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE); + aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET); + aFilter->RegisterCellsWithType(VTK_POLYHEDRON); + + aHltFilter->RegisterCellsWithType(VTK_TETRA); + aHltFilter->RegisterCellsWithType(VTK_VOXEL); + aHltFilter->RegisterCellsWithType(VTK_HEXAHEDRON); + aHltFilter->RegisterCellsWithType(VTK_WEDGE); + aHltFilter->RegisterCellsWithType(VTK_PYRAMID); + aHltFilter->RegisterCellsWithType(VTK_HEXAGONAL_PRISM); + aHltFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA); + aHltFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON); + aHltFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_HEXAHEDRON); + aHltFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE); + aHltFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID); + aHltFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET); + aHltFilter->RegisterCellsWithType(VTK_POLYHEDRON); + } } + if ( GetVisibility() ) + aFilter->Update(); + if (MYDEBUG) MESSAGE(aFilter->GetOutput()->GetNumberOfCells()); } - if ( GetVisibility() ) - aFilter->Update(); - if (MYDEBUG) MESSAGE(aFilter->GetOutput()->GetNumberOfCells()); - SetVisibility(GetVisibility(),false); + + SetVisibility( GetVisibility(), myRepresentationCache != 0 ); } void SMESH_ActorDef::SetRepresentation (int theMode) @@ -1709,6 +1717,15 @@ void SMESH_ActorDef::SetRepresentation (int theMode) int aNb0Ds = myVisualObj->GetNbEntities(SMDSAbs_0DElement); int aNbBalls = myVisualObj->GetNbEntities(SMDSAbs_Ball); + if ( myRepresentationCache && aNbEdges + aNbFaces + aNbVolumes + aNb0Ds + aNbBalls ) + { + theMode = myRepresentationCache; + if ( theMode == eSurface && aNbFaces + aNbVolumes == 0 ) + theMode = eEdge; + else + myRepresentationCache = 0; + } + if (theMode < 0) { myRepresentation = eSurface; if (!aNbFaces && !aNbVolumes && !aNbBalls && aNbEdges) { @@ -1789,7 +1806,7 @@ void SMESH_ActorDef::SetRepresentation (int theMode) case eLength: case eMultiConnection: aProp = aBackProp = my1DProp; - if(myRepresentation != ePoint) + if ( myRepresentation != ePoint ) aReperesent = SMESH_DeviceActor::eInsideframe; break; default:; diff --git a/src/OBJECT/SMESH_ActorDef.h b/src/OBJECT/SMESH_ActorDef.h index 4366a98a6..dd8879ec6 100644 --- a/src/OBJECT/SMESH_ActorDef.h +++ b/src/OBJECT/SMESH_ActorDef.h @@ -295,8 +295,8 @@ class SMESH_ActorDef : public SMESH_Actor SMESH_DeviceActor* my0DExtActor; unsigned int myEntityMode; - unsigned int myEntityState; unsigned int myEntityModeCache; + int myRepresentationCache; bool myIsEntityModeCache; bool myIsPointsVisible; diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx index ff127dece..04d047611 100644 --- a/src/SMESH/SMESH_Mesh.cxx +++ b/src/SMESH/SMESH_Mesh.cxx @@ -714,6 +714,7 @@ SMESH_Mesh::AddHypothesis(const TopoDS_Shape & aSubShape, } } HasModificationsToDiscard(); // to reset _isModified flag if a mesh becomes empty + GetMeshDS()->Modified(); if(MYDEBUG) subMesh->DumpAlgoState(true); if(MYDEBUG) SCRUTE(ret); @@ -784,6 +785,7 @@ SMESH_Mesh::RemoveHypothesis(const TopoDS_Shape & aSubShape, } HasModificationsToDiscard(); // to reset _isModified flag if mesh become empty + GetMeshDS()->Modified(); if(MYDEBUG) subMesh->DumpAlgoState(true); if(MYDEBUG) SCRUTE(ret); diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 1803c634d..441d71f47 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -4493,7 +4493,7 @@ void SMESHGUI::initialize( CAM_Application* app ) popupMgr()->setRule( action( SMESHOp::OpDMShading ), "displayMode = 'eSurface'", QtxPopupMgr::ToggleRule ); popupMgr()->insert( action( SMESHOp::OpDMNodes ), anId, -1 ); - popupMgr()->setRule( action( SMESHOp::OpDMNodes ), aMeshInVTK + "&&" + hasNodes, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( SMESHOp::OpDMNodes ), aMeshInVTK + "&&" + hasNodes + "&&" + hasElems, QtxPopupMgr::VisibleRule ); popupMgr()->setRule( action( SMESHOp::OpDMNodes ), "displayMode = 'ePoint'", QtxPopupMgr::ToggleRule ); popupMgr()->insert( separator(), anId, -1 ); @@ -4532,7 +4532,7 @@ void SMESHGUI::initialize( CAM_Application* app ) popupMgr()->insert( separator(), anId, -1 ); popupMgr()->insert( action( SMESHOp::OpDEChoose ), anId, -1 ); - popupMgr()->setRule( action( SMESHOp::OpDEChoose ), aClient + "&& $type in {" + mesh + "} &&" + isNotEmpty, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( SMESHOp::OpDEChoose ), aClient + "&& $type in {" + mesh + "} &&" + hasDifferentElems, QtxPopupMgr::VisibleRule ); popupMgr()->insert( separator(), anId, -1 );