From: apo Date: Thu, 13 Apr 2006 14:24:35 +0000 (+0000) Subject: Fix on Bug12171 X-Git-Tag: T3_2_0b1_pre1~16 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d38c026725b2a7d1f7818e4c2fb68a6c2451a589;p=modules%2Fvisu.git Fix on Bug12171 Picking functionality is not work --- 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;