From: apo Date: Thu, 6 Oct 2005 11:13:21 +0000 (+0000) Subject: To customize SpaceMause interaction X-Git-Tag: BR-D5-38-2003_D2005-12-10~46 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1a9ac35ccdb38656a2c13922748d2e5ab85af5ed;p=modules%2Fvisu.git To customize SpaceMause interaction (introduce magnification functionality) --- diff --git a/src/OBJECT/Makefile.in b/src/OBJECT/Makefile.in index 963db782..e73a5816 100644 --- a/src/OBJECT/Makefile.in +++ b/src/OBJECT/Makefile.in @@ -36,6 +36,7 @@ EXPORT_HEADERS = \ VISU_ActorFactory.h \ VISU_GaussPtsSettings.h \ VISU_GaussPtsActorFactory.h \ + VISU_Event.h \ VISU_Actor.h \ VISU_MeshAct.h \ VISU_ScalarMapAct.h \ diff --git a/src/OBJECT/VISU_Event.h b/src/OBJECT/VISU_Event.h new file mode 100644 index 00000000..e9850df9 --- /dev/null +++ b/src/OBJECT/VISU_Event.h @@ -0,0 +1,44 @@ +// SALOME VTKViewer : build VTK viewer into Salome desktop +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : +// Author : +// Module : SALOME +// $Header$ + +#ifndef VISU_Event_h +#define VISU_Event_h + +#include "SVTK_Event.h" + +namespace VISU +{ + enum Event + { + SetSMDecreaseMagnificationEvent = SVTK::LastEvent + 100, + SetSMIncreaseMagnificationEvent, + LastEvent + }; +} + +#endif diff --git a/src/OBJECT/VISU_GaussPtsAct.cxx b/src/OBJECT/VISU_GaussPtsAct.cxx index 0a829cad..dcf909df 100644 --- a/src/OBJECT/VISU_GaussPtsAct.cxx +++ b/src/OBJECT/VISU_GaussPtsAct.cxx @@ -35,6 +35,7 @@ #include "VISU_ScalarBarCtrl.hxx" #include "VISU_ScalarBarActor.hxx" +#include "VISU_Event.h" #include "SVTK_Actor.h" #include @@ -427,11 +428,17 @@ VISU_GaussPtsAct if(myInteractor) myInteractor->RemoveObserver(myEventCallbackCommand.GetPointer()); - if(theInteractor) + if(theInteractor){ theInteractor->AddObserver(vtkCommand::CharEvent, myEventCallbackCommand.GetPointer(), myPriority); - + theInteractor->AddObserver(VISU::SetSMDecreaseMagnificationEvent, + myEventCallbackCommand.GetPointer(), + myPriority); + theInteractor->AddObserver(VISU::SetSMIncreaseMagnificationEvent, + myEventCallbackCommand.GetPointer(), + myPriority); + } Superclass::SetInteractor(theInteractor); Modified(); @@ -470,6 +477,11 @@ VISU_GaussPtsAct myUpdatePrs3dSignal(this); break; } + case VISU::SetSMDecreaseMagnificationEvent: + case VISU::SetSMIncreaseMagnificationEvent: + myChangeMagnification = theEvent == VISU::SetSMIncreaseMagnificationEvent; + myUpdatePrs3dSignal(this); + break; default: break; } diff --git a/src/VVTK/Makefile.in b/src/VVTK/Makefile.in index 331be56e..1516f7dc 100755 --- a/src/VVTK/Makefile.in +++ b/src/VVTK/Makefile.in @@ -14,7 +14,6 @@ VPATH=.:@srcdir@ # header files EXPORT_HEADERS = \ VVTK.h \ - VVTK_Event.h \ VVTK_ViewManager.h \ VVTK_ViewModel.h \ VVTK_InteractorStyle.h \ diff --git a/src/VVTK/VVTK_Event.h b/src/VVTK/VVTK_Event.h deleted file mode 100644 index 793f9b4c..00000000 --- a/src/VVTK/VVTK_Event.h +++ /dev/null @@ -1,44 +0,0 @@ -// SALOME VTKViewer : build VTK viewer into Salome desktop -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : -// Author : Alexander SLADKOV -// Module : SALOME -// $Header$ - -#ifndef VVTK_Event_h -#define VVTK_Event_h - -#include "SVTK_Event.h" - -namespace VVTK -{ - enum Event - { - SetSMDecreaseMagnificationEvent = SVTK::LastEvent + 100, - SetSMIncreaseMagnificationEvent, - LastEvent - }; -} - -#endif diff --git a/src/VVTK/VVTK_InteractorStyle.cxx b/src/VVTK/VVTK_InteractorStyle.cxx index 841b5f0d..c66ab7c2 100644 --- a/src/VVTK/VVTK_InteractorStyle.cxx +++ b/src/VVTK/VVTK_InteractorStyle.cxx @@ -30,7 +30,7 @@ #include "VVTK_InteractorStyle.h" #include "VISU_GaussPtsSettings.h" #include "SVTK_Selector.h" -#include "VVTK_Event.h" +#include "VISU_Event.h" #include #include @@ -228,8 +228,8 @@ VVTK_InteractorStyle Superclass::SetInteractor( theInteractor ); if(theInteractor){ - theInteractor->AddObserver( VVTK::SetSMDecreaseMagnificationEvent, EventCallbackCommand, Priority ); - theInteractor->AddObserver( VVTK::SetSMIncreaseMagnificationEvent, EventCallbackCommand, Priority ); + theInteractor->AddObserver( VISU::SetSMDecreaseMagnificationEvent, EventCallbackCommand, Priority ); + theInteractor->AddObserver( VISU::SetSMIncreaseMagnificationEvent, EventCallbackCommand, Priority ); } } @@ -256,10 +256,10 @@ VVTK_InteractorStyle VVTK_InteractorStyle* self = dynamic_cast( anObject ); if( self ){ switch ( event ) { - case VVTK::SetSMDecreaseMagnificationEvent: + case VISU::SetSMDecreaseMagnificationEvent: self->mySMDecreaseMagnificationBtn = *((int*)callData); return; - case VVTK::SetSMIncreaseMagnificationEvent: + case VISU::SetSMIncreaseMagnificationEvent: self->mySMIncreaseMagnificationBtn = *((int*)callData); return; } @@ -288,7 +288,7 @@ void VVTK_InteractorStyle ::DecreaseGaussPointMagnification() { - printf( "\n--DecreaseGaussPointMagnification() NOT IMPLEMENTED--\n" ); + Interactor->InvokeEvent(VISU::SetSMDecreaseMagnificationEvent,NULL); } //---------------------------------------------------------------------------- @@ -296,5 +296,5 @@ void VVTK_InteractorStyle ::IncreaseGaussPointMagnification() { - printf( "\n--IncreaseGaussPointMagnification() NOT IMPLEMENTED--\n" ); + Interactor->InvokeEvent(VISU::SetSMIncreaseMagnificationEvent,NULL); }