From: ouv Date: Mon, 10 Oct 2005 12:44:52 +0000 (+0000) Subject: Added flags to handle mouse events X-Git-Tag: BR-D5-38-2003_D2005-12-10~20 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8875efe2b95f9b118c50d9d32462c0ba2956edb5;p=modules%2Fvisu.git Added flags to handle mouse events --- diff --git a/src/PIPELINE/VISU_ImplicitFunctionWidget.cxx b/src/PIPELINE/VISU_ImplicitFunctionWidget.cxx index 4d714767..fb8f407f 100644 --- a/src/PIPELINE/VISU_ImplicitFunctionWidget.cxx +++ b/src/PIPELINE/VISU_ImplicitFunctionWidget.cxx @@ -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); diff --git a/src/PIPELINE/VISU_ImplicitFunctionWidget.h b/src/PIPELINE/VISU_ImplicitFunctionWidget.h index ad3237c6..304664b2 100644 --- a/src/PIPELINE/VISU_ImplicitFunctionWidget.h +++ b/src/PIPELINE/VISU_ImplicitFunctionWidget.h @@ -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; diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx index e8b92496..0d20a0e9 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx @@ -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; } }