X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FOBJECT%2FSMESH_Actor.cxx;h=5c2e918ab00908321c1b5a94d495cea394842f48;hb=6e5976193e493950361e18c6fbe4a9e926727ec7;hp=ada5f91b8ae2f1294fc7c0ce9475546573656549;hpb=1c1bbf6798782cb24bcab45d519817cff125ae5c;p=modules%2Fsmesh.git diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index ada5f91b8..5c2e918ab 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -323,6 +323,10 @@ SMESH_ActorDef::SMESH_ActorDef() myEdgeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); myEdgeProp->SetLineWidth(aLineWidth); + // my1DActor is used to + // - show numbers + // - show controls on all edges (eg Length) + // since edges are shown by myHighlitableActor my1DActor = SMESH_CellLabelActor::New(); my1DActor->SetStoreClippingMapping(true); my1DActor->SetUserMatrix(aMatrix); @@ -350,6 +354,7 @@ SMESH_ActorDef::SMESH_ActorDef() my1DExtProp->SetLineWidth(aLineWidth + aLineWidthInc); my1DExtProp->SetPointSize(aElem0DSize); + // my1DExtActor is used to show filtered edges or links between nodes my1DExtActor = SMESH_DeviceActor::New(); my1DExtActor->SetUserMatrix(aMatrix); my1DExtActor->PickableOff(); @@ -812,7 +817,8 @@ void SMESH_ActorDef::SetControlMode( eControl theMode, bool theCheckEntityMode ) if( !mgr ) return; - myControlMode = eNone; + //myControlMode = eNone; + myControlMode = theMode; theCheckEntityMode &= mgr->booleanValue( "SMESH", "display_entity", false ); my0DActor->GetMapper()->SetScalarVisibility(false); @@ -995,11 +1001,10 @@ void SMESH_ActorDef::SetControlMode( eControl theMode, bool theCheckEntityMode ) return; } - vtkUnstructuredGrid* aGrid = myControlActor->GetUnstructuredGrid(); - vtkIdType aNbCells = aGrid->GetNumberOfCells(); + int aNbCells = myFunctor ? myVisualObj->GetNbEntities( myFunctor->GetType() ) : 0; bool aShowOnlyScalarBarTitle = false; if(aNbCells) { - myControlMode = theMode; + //myControlMode = theMode; switch(myControlMode){ case eFreeNodes: case eCoincidentNodes: @@ -1055,25 +1060,13 @@ void SMESH_ActorDef::SetControlMode( eControl theMode, bool theCheckEntityMode ) SetEntityMode(eEdges); } else if(myControlActor == my2DActor) { - switch(myControlMode) { - case eLength2D: - case eFreeEdges: - case eFreeFaces: - case eMultiConnection2D: - if (!myIsEntityModeCache){ - myEntityModeCache = GetEntityMode(); - myIsEntityModeCache=true; - } - SetEntityMode(eFaces); - break; - default: - if (!myIsEntityModeCache){ - myEntityModeCache = GetEntityMode(); - myIsEntityModeCache=true; - } - SetEntityMode(eFaces); + if (!myIsEntityModeCache){ + myEntityModeCache = GetEntityMode(); + myIsEntityModeCache=true; } - }else if(myControlActor == my3DActor) { + SetEntityMode(eFaces); + } + else if(myControlActor == my3DActor) { if (!myIsEntityModeCache){ myEntityModeCache = GetEntityMode(); myIsEntityModeCache=true; @@ -1105,7 +1098,7 @@ void SMESH_ActorDef::SetControlMode( eControl theMode, bool theCheckEntityMode ) if (isLogarithmic && range[0] > 1e-07 && range[1] > 1e-07) lookupTable->SetScale(VTK_SCALE_LOG10); - Update(); + //Update(); } int SMESH_ActorDef::GetNumberControlEntities() @@ -1142,7 +1135,7 @@ void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer) if ( !mySelector || !mySelector->IsSelectionEnabled() ) { myBaseActor->SetUnstructuredGrid( NULL ); - myHighlitableActor->SetUnstructuredGrid( NULL ); + //myHighlitableActor->SetUnstructuredGrid( NULL ); } theRenderer->AddActor(myBaseActor); theRenderer->AddActor(myNodeExtActor); @@ -1487,9 +1480,15 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation) case eCoincidentNodes: myNodeExtActor->VisibilityOn(); break; + case eLength: + case eMultiConnection: + my1DActor->VisibilityOn(); + break; case eFreeEdges: case eFreeBorders: case eCoincidentElems1D: + case eLength2D: + case eMultiConnection2D: my1DExtActor->VisibilityOn(); break; case eFreeFaces: @@ -1503,45 +1502,37 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation) case eCoincidentElems3D: my3DExtActor->VisibilityOn(); break; - case eLength2D: - case eMultiConnection2D: - my1DExtActor->VisibilityOn(); - break; default:; } - if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells()) + if ( myFunctor && myVisualObj->GetNbEntities( myFunctor->GetType() )) myScalarBarActor->VisibilityOn(); } - if(myRepresentation != ePoint) - myPickableActor->VisibilityOn(); - else { - myNodeActor->VisibilityOn(); - } - - if(myEntityMode & e0DElements && GetRepresentation() != ePoint ){ - my0DActor->VisibilityOn(); - } - if(myEntityMode & eBallElem && GetRepresentation() != ePoint ){ - myBallActor->VisibilityOn(); - } - - if(myEntityMode & eEdges && GetRepresentation() != ePoint){ - my1DActor->VisibilityOn(); - } + myPickableActor->VisibilityOn(); - if(myEntityMode & eFaces && GetRepresentation() != ePoint){ - my2DActor->VisibilityOn(); - } - - if(myEntityMode & eVolumes && GetRepresentation() != ePoint){ - my3DActor->VisibilityOn(); + if ( GetRepresentation() != ePoint ) + { + if(myEntityMode & e0DElements ){ + my0DActor->VisibilityOn(); + } + if(myEntityMode & eBallElem ){ + myBallActor->VisibilityOn(); + } + if(myEntityMode & eEdges && GetCellsLabeled() ){ // my1DActor shows labels only + my1DActor->VisibilityOn(); + } + if(myEntityMode & eFaces ){ + my2DActor->VisibilityOn(); + } + if(myEntityMode & eVolumes ){ + my3DActor->VisibilityOn(); + } } - if(myNodeActor->GetPointsLabeled()){ + if(myNodeActor->GetPointsLabeled()) { + myNodeActor->UpdateLabels(); myNodeActor->VisibilityOn(); } - if(my0DActor) my0DActor->UpdateLabels(); @@ -1750,8 +1741,6 @@ void SMESH_ActorDef::SetRepresentation (int theMode) } myPickableActor = myBaseActor; - myNodeActor->SetVisibility(false); - myNodeExtActor->SetVisibility(false); vtkProperty *aProp = NULL, *aBackProp = NULL; vtkProperty *aPropVN = NULL, *aPropVR = NULL; SMESH_DeviceActor::EReperesent aReperesent = SMESH_DeviceActor::EReperesent(-1); @@ -1759,7 +1748,6 @@ void SMESH_ActorDef::SetRepresentation (int theMode) switch (myRepresentation) { case ePoint: myPickableActor = myNodeActor; - myNodeActor->SetVisibility(true); aQuadraticMode = SMESH_Actor::eLines; aProp = aBackProp = aPropVN = aPropVR = myNodeProp; aReperesent = SMESH_DeviceActor::ePoint; @@ -1777,54 +1765,50 @@ void SMESH_ActorDef::SetRepresentation (int theMode) break; } - my2DActor->SetProperty(aProp); - my2DActor->SetBackfaceProperty(aBackProp); - my2DActor->SetRepresentation(aReperesent); + if ( myRepresentation != ePoint ) + { + my2DActor->SetProperty(aProp); + my2DActor->SetBackfaceProperty(aBackProp); + my2DActor->SetRepresentation(aReperesent); - if(aQuadraticMode == SMESH_Actor::eLines) - my2DActor->SetQuadraticArcMode(false); - else if(aQuadraticMode == SMESH_Actor::eArcs) - my2DActor->SetQuadraticArcMode(true); + if(aQuadraticMode == SMESH_Actor::eLines) + my2DActor->SetQuadraticArcMode(false); + else if(aQuadraticMode == SMESH_Actor::eArcs) + my2DActor->SetQuadraticArcMode(true); - my2DExtActor->SetRepresentation(aReperesent); + my2DExtActor->SetRepresentation(aReperesent); - my3DActor->SetProperty(aPropVN); - my3DActor->SetBackfaceProperty(aPropVR); - my3DActor->SetRepresentation(aReperesent); + my3DActor->SetProperty(aPropVN); + my3DActor->SetBackfaceProperty(aPropVR); + my3DActor->SetRepresentation(aReperesent); + my0DActor->SetRepresentation(aReperesent); + myBallActor->SetRepresentation(aReperesent); - my1DExtActor->SetVisibility(false); - my2DExtActor->SetVisibility(false); - my3DExtActor->SetVisibility(false); - - my0DActor->SetRepresentation(aReperesent); - myBallActor->SetRepresentation(aReperesent); - - switch ( myControlMode ) { - case eLength: - case eMultiConnection: - aProp = aBackProp = my1DProp; - if(myRepresentation != ePoint) - aReperesent = SMESH_DeviceActor::eInsideframe; - break; - default:; - } + switch ( myControlMode ) { + case eLength: + case eMultiConnection: + aProp = aBackProp = my1DProp; + if(myRepresentation != ePoint) + aReperesent = SMESH_DeviceActor::eInsideframe; + break; + default:; + } - if(aQuadraticMode == SMESH_Actor::eLines) - my1DActor->SetQuadraticArcMode(false); - else if(aQuadraticMode == SMESH_Actor::eArcs) - my1DActor->SetQuadraticArcMode(true); + if(aQuadraticMode == SMESH_Actor::eLines) + my1DActor->SetQuadraticArcMode(false); + else if(aQuadraticMode == SMESH_Actor::eArcs) + my1DActor->SetQuadraticArcMode(true); - my1DActor->SetProperty(aProp); - my1DActor->SetBackfaceProperty(aBackProp); - my1DActor->SetRepresentation(aReperesent); + my1DActor->SetProperty(aProp); + my1DActor->SetBackfaceProperty(aBackProp); + my1DActor->SetRepresentation(aReperesent); - my1DExtActor->SetRepresentation(aReperesent); + my1DExtActor->SetRepresentation(aReperesent); + } if(myIsPointsVisible) myPickableActor = myNodeActor; - if(GetPointRepresentation()) - myNodeActor->SetVisibility(true); SetMapper(myPickableActor->GetMapper()); @@ -1858,11 +1842,6 @@ void SMESH_ActorDef::UpdateHighlight() case SMESH_DeviceActor::eSurface: case SMESH_DeviceActor::eWireframe: { - // if ( !mySelector || !mySelector->IsSelectionEnabled() ) - // myHighlitableActor->SetUnstructuredGrid( NULL ); - // else if ( !myHighlitableActor->myExtractUnstructuredGrid->GetInput() ) - // myHighlitableActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid()); - if(myIsHighlighted) { myHighlitableActor->SetProperty(myHighlightProp); }else if(myIsPreselected){ @@ -1891,6 +1870,7 @@ void SMESH_ActorDef::UpdateHighlight() } myNodeActor->SetRepresentation(SMESH_DeviceActor::ePoint); myNodeActor->GetExtractUnstructuredGrid()->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints); + myNodeActor->GetProperty()->Modified(); break; } } @@ -1902,16 +1882,16 @@ void SMESH_ActorDef::EnableSelection( bool enable ) if ( enable && ! myBaseActor->myExtractUnstructuredGrid->GetInput() ) { myBaseActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid()); - myHighlitableActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid()); + //myHighlitableActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid()); myBaseActor->myExtractUnstructuredGrid->Update(); - myHighlitableActor->myExtractUnstructuredGrid->Update(); + //myHighlitableActor->myExtractUnstructuredGrid->Update(); } if ( !enable && myBaseActor->myExtractUnstructuredGrid->GetInput() ) { myBaseActor->SetUnstructuredGrid( NULL ); - myHighlitableActor->SetUnstructuredGrid( NULL ); + //myHighlitableActor->SetUnstructuredGrid( NULL ); myBaseActor->myExtractUnstructuredGrid->Update(); - myHighlitableActor->myExtractUnstructuredGrid->Update(); + //myHighlitableActor->myExtractUnstructuredGrid->Update(); } } @@ -1937,11 +1917,11 @@ void SMESH_ActorDef::SetPreSelected(bool thePreselect) int SMESH_ActorDef::RenderOpaqueGeometry(vtkViewport *vp) { if (myPickableActor->GetIsOpaque()) - { + { vtkRenderer *ren = static_cast(vp); this->Render(ren); return 1; - } + } return 0; } @@ -1949,20 +1929,20 @@ int SMESH_ActorDef::RenderOpaqueGeometry(vtkViewport *vp) int SMESH_ActorDef::RenderTranslucentGeometry(vtkViewport *vp) { if (!myPickableActor->GetIsOpaque()) - { + { vtkRenderer *ren = static_cast(vp); this->Render(ren); return 1; - } + } return 0; } void SMESH_ActorDef::Render(vtkRenderer *ren) { - unsigned long aTime = myTimeStamp->GetMTime(); - unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime(); - unsigned long aClippingTime = myImplicitBoolean->GetMTime(); + vtkMTimeType aTime = myTimeStamp->GetMTime(); + vtkMTimeType anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime(); + vtkMTimeType aClippingTime = myImplicitBoolean->GetMTime(); if(anObjTime > aTime || aClippingTime > aTime) Update(); } @@ -2348,7 +2328,7 @@ void SMESH_ActorDef::SetOpenGLClippingPlane() if ( !mySelector || !mySelector->IsSelectionEnabled() ) { myBaseActor->SetUnstructuredGrid( NULL ); - myHighlitableActor->SetUnstructuredGrid( NULL ); + //myHighlitableActor->SetUnstructuredGrid( NULL ); } my1DActor->SetPlaneCollection( myPlaneCollection ); my1DActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());