]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
fix for Bug GVIEW10327
authorpkv <pkv@opencascade.com>
Fri, 21 Oct 2005 06:25:44 +0000 (06:25 +0000)
committerpkv <pkv@opencascade.com>
Fri, 21 Oct 2005 06:25:44 +0000 (06:25 +0000)
src/OBJECT/VISU_GaussPtsAct.cxx
src/PIPELINE/SALOME_ExtractGeometry.cxx
src/PIPELINE/SALOME_ExtractGeometry.h

index 67eef5ef0d0d518185465b8c7f0a3c25e5fdfd1d..61be970fbe3c85dcd7ddfd571a8e4760e2012617 100644 (file)
@@ -301,7 +301,9 @@ VISU_GaussPtsAct
     theWidget->AddObserver(vtkCommand::DisableEvent, 
                           myEventCallbackCommand.GetPointer(), 
                           myPriority);
-    
+    theWidget->AddObserver(vtkCommand::EndInteractionEvent, 
+                          myEventCallbackCommand.GetPointer(), 
+                          myPriority);
   }
 
   myWidget = theWidget;
@@ -452,6 +454,12 @@ VISU_GaussPtsAct
   case VISU::UpdatePickingSettingsEvent:
     UpdatePickingSettings();
     break;
+  case vtkCommand::EndInteractionEvent:
+  case vtkCommand::EnableEvent:
+  case vtkCommand::DisableEvent: 
+    myCurrentPL->GetMapper()->Update();
+    Highlight(isHighlighted());
+    break;
   default:
     break;
   }
@@ -508,6 +516,7 @@ bool VISU_GaussPtsAct::PreHighlight(vtkInteractorStyle* theInteractorStyle,
        return false;
       
       vtkIdType aVtkId = myPointPicker->GetPointId();
+      
       if(aVtkId >= 0 && mySelector->IsValid(this,aVtkId,true) && hasIO()){
        vtkIdType anObjId = GetNodeObjId( aVtkId );
        if(myLastObjPointID != anObjId){
@@ -609,7 +618,7 @@ bool VISU_GaussPtsAct::Highlight(vtkInteractorStyle* theInteractorStyle,
 }
 
 //==================================================================
-// function : highlight
+// function : Highlight
 // purpose  :
 //==================================================================
 void
@@ -990,6 +999,7 @@ VISU_GaussPtsAct1
     break;
   }
 
+  
   switch(theEvent){
   case vtkCommand::EnableEvent: 
     myCurrentPL = myInsideDeviceActor->GetPipeLine();
@@ -997,8 +1007,10 @@ VISU_GaussPtsAct1
   case vtkCommand::DisableEvent:
     myCurrentPL = myDeviceActor->GetPipeLine();
     break;
+  default:
+    break;
   }
-
+  
   Superclass::OnInteractorEvent(theEvent);
 }
 
@@ -1070,9 +1082,6 @@ VISU_GaussPtsAct2
   }
 
   if(theWidget){
-    theWidget->AddObserver(vtkCommand::EndInteractionEvent, 
-                          myEventCallbackCommand.GetPointer(), 
-                          myPriority);
     myDeviceActor->GetPipeLine()->SetImplicitFunction(theWidget->ImplicitFunction());
     myDeviceActor->SetVisibility(Superclass::GetVisibility() && theWidget->IsEnabled());
   }
@@ -1113,7 +1122,7 @@ VISU_GaussPtsAct2
     }
     break;
   case vtkCommand::EndInteractionEvent:
-    //vtkLODActor::SetMapper(GetMapper());
+    Update();
     break;
   default:
     break;
index c962e6aa866816e661cd866583e76d3d72879dfa..5a1762e8d138179e767270bd068f784bcb806c91 100755 (executable)
@@ -48,7 +48,8 @@ vtkStandardNewMacro(SALOME_ExtractGeometry);
 //----------------------------------------------------------------------------
 SALOME_ExtractGeometry
 ::SALOME_ExtractGeometry():
-  myStoreMapping(false)
+  myStoreMapping(false),
+  myIsDoneShallowCopy(false)
 {}
 
 SALOME_ExtractGeometry
@@ -106,9 +107,9 @@ vtkIdType
 SALOME_ExtractGeometry
 ::GetElemVTKId(vtkIdType theID)
 {
-  if(myElemVTK2ObjIds.empty())
+  if(!myStoreMapping||myIsDoneShallowCopy){
     return theID;
-
+  }
   vtkIdType iEnd = myElemVTK2ObjIds.size();
   for(vtkIdType i = 0; i < iEnd; i++)
     if(myElemVTK2ObjIds[i] == theID)
@@ -121,9 +122,9 @@ vtkIdType
 SALOME_ExtractGeometry
 ::GetNodeVTKId(vtkIdType theID)
 {
-  if (myElemVTK2ObjIds.empty())
+  if (!myStoreMapping||myIsDoneShallowCopy){
     return theID;
-
+  }
   vtkIdType iEnd = myNodeVTK2ObjIds.size();
   for(vtkIdType i = 0; i < iEnd; i++)
     if(myNodeVTK2ObjIds[i] == theID)
@@ -138,14 +139,14 @@ vtkIdType
 SALOME_ExtractGeometry
 ::GetElemObjId(int theVtkID)
 {
-  if (myElemVTK2ObjIds.empty())
+  if (!myStoreMapping||myIsDoneShallowCopy){
     return theVtkID;
-
-#if defined __GNUC_2__
-  return myElemVTK2ObjIds[theVtkID];
-#else
-  return myElemVTK2ObjIds.at(theVtkID);
-#endif
+  }
+  //
+  if (theVtkID<myElemVTK2ObjIds.size()){
+    return myElemVTK2ObjIds[theVtkID];
+  }
+  return -1;
 }
 
 
@@ -153,14 +154,14 @@ vtkIdType
 SALOME_ExtractGeometry
 ::GetNodeObjId(int theVtkID)
 {
-  if (myNodeVTK2ObjIds.empty())
+  if (!myStoreMapping||myIsDoneShallowCopy){
     return theVtkID;
-
-#if defined __GNUC_2__
-  return myNodeVTK2ObjIds[theVtkID];
-#else
-  return myNodeVTK2ObjIds.at(theVtkID);
-#endif
+  }
+  //
+  if (theVtkID<myNodeVTK2ObjIds.size()){
+    return myNodeVTK2ObjIds[theVtkID];
+  }
+  return -1;
 }
 
 
@@ -171,16 +172,16 @@ SALOME_ExtractGeometry
 {
   myElemVTK2ObjIds.clear();
   myNodeVTK2ObjIds.clear();
+  //
+  myIsDoneShallowCopy = !this->ImplicitFunction;
 
-  bool anIsNothingToDo = !this->ImplicitFunction;
-
-  if(!anIsNothingToDo && myImplicitBoolean.GetPointer()){
+  if(!myIsDoneShallowCopy && myImplicitBoolean.GetPointer()){
     if(vtkImplicitFunctionCollection* aFunction = myImplicitBoolean->GetFunction()){
-      anIsNothingToDo = aFunction->GetNumberOfItems() == 0;
+      myIsDoneShallowCopy = aFunction->GetNumberOfItems() == 0;
     }
   }
 
-  if(anIsNothingToDo){
+  if(myIsDoneShallowCopy){
     GetOutput()->ShallowCopy(GetInput());
     Modified();
     return;
index d348fe602fab400b139e5c2cb8ec3b8bee57ca06..b225434f8bdd7772557c6953ba9264300e0ffabc 100755 (executable)
@@ -75,6 +75,7 @@ protected:
 
 private:
   bool myStoreMapping;
+  bool myIsDoneShallowCopy;
   typedef std::vector<vtkIdType> TVectorId;
   TVectorId myElemVTK2ObjIds;
   TVectorId myNodeVTK2ObjIds;