]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Added flags to handle mouse events
authorouv <ouv@opencascade.com>
Mon, 10 Oct 2005 12:44:52 +0000 (12:44 +0000)
committerouv <ouv@opencascade.com>
Mon, 10 Oct 2005 12:44:52 +0000 (12:44 +0000)
src/PIPELINE/VISU_ImplicitFunctionWidget.cxx
src/PIPELINE/VISU_ImplicitFunctionWidget.h
src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx

index 4d714767b73cb9888b28d812270b0a3a278cd88a..fb8f407fcee48e26b256f8426274b772d235d1e2 100644 (file)
@@ -76,6 +76,11 @@ VISU_ImplicitFunctionWidget::VISU_ImplicitFunctionWidget()
   this->NormalToYAxis = 0;
   this->NormalToZAxis = 0;
 
+  this->HandleMoveEvent = true;
+  this->HandleLeftButtonEvent = true;
+  this->HandleMiddleButtonEvent = false;
+  this->HandleRightButtonEvent = false;
+
   // Build the representation of the widget
   // 
   this->Plane = vtkPlane::New();
@@ -335,21 +340,32 @@ void VISU_ImplicitFunctionWidget::SetEnabled(int enabling)
 
     // listen for the following events
     vtkRenderWindowInteractor *i = this->Interactor;
-    i->AddObserver(vtkCommand::MouseMoveEvent, this->EventCallbackCommand, 
-                   this->Priority);
-    i->AddObserver(vtkCommand::LeftButtonPressEvent, 
-                   this->EventCallbackCommand, this->Priority);
-    i->AddObserver(vtkCommand::LeftButtonReleaseEvent, 
-                   this->EventCallbackCommand, this->Priority);
-    i->AddObserver(vtkCommand::MiddleButtonPressEvent, 
-                   this->EventCallbackCommand, this->Priority);
-    i->AddObserver(vtkCommand::MiddleButtonReleaseEvent, 
-                   this->EventCallbackCommand, this->Priority);
-    i->AddObserver(vtkCommand::RightButtonPressEvent, 
-                   this->EventCallbackCommand, this->Priority);
-    i->AddObserver(vtkCommand::RightButtonReleaseEvent, 
-                   this->EventCallbackCommand, this->Priority);
-
+    if( this->HandleMoveEvent )
+    {
+      i->AddObserver(vtkCommand::MouseMoveEvent, this->EventCallbackCommand, 
+                    this->Priority);
+    }
+    if( this->HandleLeftButtonEvent )
+    {
+      i->AddObserver(vtkCommand::LeftButtonPressEvent, 
+                    this->EventCallbackCommand, this->Priority);
+      i->AddObserver(vtkCommand::LeftButtonReleaseEvent, 
+                    this->EventCallbackCommand, this->Priority);
+    }
+    if( this->HandleMiddleButtonEvent )
+    {
+      i->AddObserver(vtkCommand::MiddleButtonPressEvent, 
+                    this->EventCallbackCommand, this->Priority);
+      i->AddObserver(vtkCommand::MiddleButtonReleaseEvent, 
+                    this->EventCallbackCommand, this->Priority);
+    }
+    if( this->HandleRightButtonEvent )
+    {
+      i->AddObserver(vtkCommand::RightButtonPressEvent, 
+                    this->EventCallbackCommand, this->Priority);
+      i->AddObserver(vtkCommand::RightButtonReleaseEvent, 
+                    this->EventCallbackCommand, this->Priority);
+    }
     // add the outline
     this->CurrentRenderer->AddActor(this->OutlineActor);
     this->OutlineActor->SetProperty(this->OutlineProperty);
index ad3237c626ec8dffeeb6314d8b5e44f8e0485528..304664b29a2b8b45892f99b87dec7f7c71ba8495 100644 (file)
@@ -206,6 +206,12 @@ protected:
   int NormalToZAxis;
   void UpdateRepresentation();
 
+  // Flags to handle mouse events
+  bool HandleMoveEvent;
+  bool HandleLeftButtonEvent;
+  bool HandleMiddleButtonEvent;
+  bool HandleRightButtonEvent;
+
   // The actual plane which is being manipulated
   vtkPlane *Plane;
   vtkPlane *myPlane2;
index e8b92496bea7d0ac2c816fb3d67da3985ceba8aa..0d20a0e9cce4ad1687146c91681944d2ba20c6a3 100755 (executable)
@@ -762,6 +762,11 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(int idx,
 
   TVertex* aVertex = new TVertex[ this->TotalCells ];
 
+  float* aPropertyColor      = act->GetProperty()->GetColor();
+  float  aPropertyColorRed   = aPropertyColor[0];
+  float  aPropertyColorGreen = aPropertyColor[1];
+  float  aPropertyColorBlue  = aPropertyColor[2];
+
   vtkIdType *pts = 0;
   vtkIdType npts = 0;
   unsigned long i = 0;
@@ -780,10 +785,9 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(int idx,
     }
     else
     {
-      float* col = act->GetProperty()->GetColor();
-      aVertex[i].r = col[0];
-      aVertex[i].g = col[1];
-      aVertex[i].b = col[2];
+      aVertex[i].r = aPropertyColorRed;
+      aVertex[i].g = aPropertyColorGreen;
+      aVertex[i].b = aPropertyColorBlue;
     }
   }