]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix on Bug12171
authorapo <apo@opencascade.com>
Thu, 13 Apr 2006 14:24:35 +0000 (14:24 +0000)
committerapo <apo@opencascade.com>
Thu, 13 Apr 2006 14:24:35 +0000 (14:24 +0000)
   Picking functionality is not work

src/OBJECT/VISU_GaussPtsAct.cxx
src/OBJECT/VISU_GaussPtsDeviceActor.cxx

index 0568b2f508d21412f4461fd04670ddba19ecbb62..026be68aa8dda01015639b974248f99bf1719f9b 100644 (file)
@@ -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;
index 912c2e0aa0642504739ed3a915f20e77a076c025..0b72f0212f4b4675fd1f2fdf7afed2183559227a 100644 (file)
@@ -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;