From d38c026725b2a7d1f7818e4c2fb68a6c2451a589 Mon Sep 17 00:00:00 2001 From: apo Date: Thu, 13 Apr 2006 14:24:35 +0000 Subject: [PATCH] Fix on Bug12171 Picking functionality is not work --- src/OBJECT/VISU_GaussPtsAct.cxx | 54 +++++++++++++++---------- src/OBJECT/VISU_GaussPtsDeviceActor.cxx | 2 +- 2 files changed, 34 insertions(+), 22 deletions(-) diff --git a/src/OBJECT/VISU_GaussPtsAct.cxx b/src/OBJECT/VISU_GaussPtsAct.cxx index 0568b2f5..026be68a 100644 --- a/src/OBJECT/VISU_GaussPtsAct.cxx +++ b/src/OBJECT/VISU_GaussPtsAct.cxx @@ -621,7 +621,16 @@ int VISU_GaussPtsAct ::GetPickable() { - return myDeviceActor->GetPickable(); + if(Superclass::GetPickable()){ + if(vtkMapper* aMapper = GetMapper()){ + if(vtkDataSet* aDataSet= aMapper->GetInput()){ + aDataSet->Update(); + return aDataSet->GetNumberOfCells() > 0; + } + } + } + + return false; } //---------------------------------------------------------------------------- @@ -631,12 +640,15 @@ VISU_GaussPtsAct SVTK_SelectionEvent* theSelectionEvent, bool theIsHighlight) { + if ( !GetPickable() ) + return false; + myPreHighlightActor->SetVisibility(false); myCursorPyramid->SetVisibility(false); - if (!myBarVisibility) { + if (!myBarVisibility) return false; - } + if(!theIsHighlight) myLastObjPointID = -1; @@ -710,17 +722,15 @@ void ChangeZoom(VISU_PickingSettings *thePickingSettings, vtkInteractorStyle* theInteractorStyle, int theInitialHasIndex, - SVTK_Selector* theSelector, + int theCurrentHasIndex, const Handle(SALOME_InteractiveObject)& theIO) { - int aCurrentHasIndex = theSelector->HasIndex(theIO); - - if(theInitialHasIndex + aCurrentHasIndex == 1){ + if(theInitialHasIndex + theCurrentHasIndex == 1){ vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer(); vtkCamera *aCamera = aRenderer->GetActiveCamera(); vtkFloatingPointType aZoomFactor = thePickingSettings->GetZoomFactor(); double aScale = aCamera->GetParallelScale(); - if (!theInitialHasIndex && aCurrentHasIndex) { + if (!theInitialHasIndex && theCurrentHasIndex) { aCamera->SetParallelScale(aScale/aZoomFactor); } else { @@ -736,34 +746,36 @@ VISU_GaussPtsAct SVTK_SelectionEvent* theSelectionEvent, bool theIsHighlight) { - myIsHighlighted = false; + if ( !GetPickable() ) + return false; + + int anInitialHasIndex = myIsHighlighted && mySelectionMode == GaussPointSelection; Handle(SALOME_InteractiveObject) anIO = getIO(); - int anInitialHasIndex = mySelector->HasIndex(anIO); + myIsHighlighted = false; Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode; - // + if(!theIsHighlight && aSelectionMode == GaussPointSelection){ mySelector->RemoveIObject(anIO); ChangeZoom(myPickingSettings, theInteractorStyle, anInitialHasIndex, - mySelector.GetPointer(), + false, anIO); return true; } - if (!myBarVisibility) { + if (!myBarVisibility) return false; - } - // - if(aSelectionMode == ActorSelection){ + + + if(aSelectionMode == ActorSelection) return Superclass::Highlight(theInteractorStyle, theSelectionEvent, theIsHighlight); - } - // + if(aSelectionMode == GaussPointSelection && !theSelectionEvent->myIsRectangle){ vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer(); @@ -778,7 +790,7 @@ VISU_GaussPtsAct ChangeZoom(myPickingSettings, theInteractorStyle, anInitialHasIndex, - mySelector.GetPointer(), + false, anIO); return true; @@ -819,7 +831,7 @@ VISU_GaussPtsAct ChangeZoom(myPickingSettings, theInteractorStyle, anInitialHasIndex, - mySelector.GetPointer(), + true, anIO); return true; @@ -831,7 +843,7 @@ VISU_GaussPtsAct ChangeZoom(myPickingSettings, theInteractorStyle, anInitialHasIndex, - mySelector.GetPointer(), + false, anIO); return false; diff --git a/src/OBJECT/VISU_GaussPtsDeviceActor.cxx b/src/OBJECT/VISU_GaussPtsDeviceActor.cxx index 912c2e0a..0b72f021 100644 --- a/src/OBJECT/VISU_GaussPtsDeviceActor.cxx +++ b/src/OBJECT/VISU_GaussPtsDeviceActor.cxx @@ -157,7 +157,7 @@ VISU_GaussPtsDeviceActor ::GetPickable() { if(Superclass::GetPickable()){ - if(vtkMapper* aMapper = GetPSMapper()){ + if(vtkMapper* aMapper = GetMapper()){ if(vtkDataSet* aDataSet= aMapper->GetInput()){ aDataSet->Update(); return aDataSet->GetNumberOfCells() > 0; -- 2.39.2