Attached Files | vtkInteractorStyleTrackballCamera.cxx.patch [^] (2,997 bytes) 1969-12-31 19:00 [Show Content] [Hide Content]Index: Rendering/vtkInteractorStyleTrackballCamera.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Rendering/vtkInteractorStyleTrackballCamera.cxx,v
retrieving revision 1.32
diff -u -r1.32 vtkInteractorStyleTrackballCamera.cxx
--- a/Rendering/vtkInteractorStyleTrackballCamera.cxx 28 Jan 2004 21:38:00 -0000 1.32
+++ b/Rendering/vtkInteractorStyleTrackballCamera.cxx 12 Aug 2004 21:13:05 -0000
@@ -21,6 +21,7 @@
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkRenderer.h"
+#include "vtkAbstractPicker.h"
vtkCxxRevisionMacro(vtkInteractorStyleTrackballCamera, "$Revision: 1.32 $");
vtkStandardNewMacro(vtkInteractorStyleTrackballCamera);
@@ -29,6 +30,8 @@
vtkInteractorStyleTrackballCamera::vtkInteractorStyleTrackballCamera()
{
this->MotionFactor = 10.0;
+ this->MouseMotion = 0;
+ this->PickButton = VTK_LEFT_PICK;
}
//----------------------------------------------------------------------------
@@ -41,6 +44,8 @@
{
int x = this->Interactor->GetEventPosition()[0];
int y = this->Interactor->GetEventPosition()[1];
+
+ this->MouseMotion = 1;
switch (this->State)
{
@@ -79,6 +84,8 @@
{
return;
}
+
+ this->MouseMotion = 0;
if (this->Interactor->GetShiftKey())
{
@@ -122,6 +129,17 @@
break;
case VTKIS_ROTATE:
+ // if there's no mouse motion and mouse picking has been enabled then perform a pick
+ if (!this->MouseMotion && this->MousePicking)
+ {
+ vtkRenderWindowInteractor *rwi = this->Interactor;
+ this->PickButton = VTK_LEFT_PICK;
+ this->FindPokedRenderer(rwi->GetEventPosition()[0], rwi->GetEventPosition()[1]);
+ rwi->StartPickCallback();
+ rwi->GetPicker()->Pick(rwi->GetEventPosition()[0], rwi->GetEventPosition()[1],
+ 0.0, this->CurrentRenderer);
+ rwi->EndPickCallback();
+ }
this->EndRotate();
break;
}
@@ -160,6 +178,8 @@
{
return;
}
+
+ this->MouseMotion = 0;
this->StartDolly();
}
@@ -170,6 +190,17 @@
switch (this->State)
{
case VTKIS_DOLLY:
+ // if no mouse motion and mouse picking is enabled do a right pick
+ if (!this->MouseMotion)
+ {
+ vtkRenderWindowInteractor *rwi = this->Interactor;
+ this->PickButton = VTK_RIGHT_PICK;
+ this->FindPokedRenderer(rwi->GetEventPosition()[0], rwi->GetEventPosition()[1]);
+ rwi->StartPickCallback();
+ rwi->GetPicker()->Pick(rwi->GetEventPosition()[0], rwi->GetEventPosition()[1],
+ 0.0, this->CurrentRenderer);
+ rwi->EndPickCallback();
+ }
this->EndDolly();
break;
}
@@ -383,6 +414,6 @@
void vtkInteractorStyleTrackballCamera::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
-
+
}
vtkInteractorStyleTrackballCamera.h.patch [^] (1,942 bytes) 1969-12-31 19:00 [Show Content] [Hide Content]Index: Rendering/vtkInteractorStyleTrackballCamera.h
===================================================================
RCS file: /cvsroot/VTK/VTK/Rendering/vtkInteractorStyleTrackballCamera.h,v
retrieving revision 1.19
diff -u -r1.19 vtkInteractorStyleTrackballCamera.h
--- a/Rendering/vtkInteractorStyleTrackballCamera.h 28 Jan 2004 21:38:00 -0000 1.19
+++ b/Rendering/vtkInteractorStyleTrackballCamera.h 12 Aug 2004 21:25:19 -0000
@@ -24,6 +24,11 @@
// panning, and ctrl + left button for spinning. (With fewer mouse buttons,
// ctrl + shift + left button is for zooming, and shift + left button is for
// panning.)
+// Enabling MousePicking allows you to pick in the render window by pressing
+// and releasing either the left or right mouse button without moving the mouse
+// in between. Use GetPickButton() to find out which mouse button was used to
+// perform the last mouse button pick. 0 == left mouse button pick. 1 == right
+// mouse button pick.
// .SECTION See Also
// vtkInteractorStyleTrackballActor vtkInteractorStyleJoystickCamera
@@ -32,6 +37,9 @@
#ifndef __vtkInteractorStyleTrackballCamera_h
#define __vtkInteractorStyleTrackballCamera_h
+#define VTK_LEFT_PICK 0
+#define VTK_RIGHT_PICK 1
+
#include "vtkInteractorStyle.h"
class VTK_RENDERING_EXPORT vtkInteractorStyleTrackballCamera : public vtkInteractorStyle
@@ -63,11 +71,23 @@
virtual void Pan();
virtual void Dolly();
+ // Get the button that just picked
+ vtkGetMacro(PickButton, int );
+
+ //Description:
+ //Enable/Disable Mouse Picking
+ vtkSetMacro(MousePicking, int);
+ vtkGetMacro(MousePicking, int);
+ vtkBooleanMacro(MousePicking,int);
+
protected:
vtkInteractorStyleTrackballCamera();
~vtkInteractorStyleTrackballCamera();
double MotionFactor;
+ int MouseMotion;
+ int PickButton;
+ int MousePicking;
virtual void Dolly(double factor);
vtkInteractorStyleTrackballActor.cxx2.patch [^] (3,019 bytes) 1969-12-31 19:00 [Show Content] [Hide Content]Index: Rendering/vtkInteractorStyleTrackballCamera.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Rendering/vtkInteractorStyleTrackballCamera.cxx,v
retrieving revision 1.32
diff -u -r1.32 vtkInteractorStyleTrackballCamera.cxx
--- a/Rendering/vtkInteractorStyleTrackballCamera.cxx 28 Jan 2004 21:38:00 -0000 1.32
+++ b/Rendering/vtkInteractorStyleTrackballCamera.cxx 18 Aug 2004 20:13:23 -0000
@@ -21,6 +21,7 @@
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkRenderer.h"
+#include "vtkAbstractPicker.h"
vtkCxxRevisionMacro(vtkInteractorStyleTrackballCamera, "$Revision: 1.32 $");
vtkStandardNewMacro(vtkInteractorStyleTrackballCamera);
@@ -29,6 +30,8 @@
vtkInteractorStyleTrackballCamera::vtkInteractorStyleTrackballCamera()
{
this->MotionFactor = 10.0;
+ this->MouseMotion = 0;
+ this->PickButton = VTK_LEFT_PICK;
}
//----------------------------------------------------------------------------
@@ -41,6 +44,8 @@
{
int x = this->Interactor->GetEventPosition()[0];
int y = this->Interactor->GetEventPosition()[1];
+
+ this->MouseMotion = 1;
switch (this->State)
{
@@ -79,6 +84,8 @@
{
return;
}
+
+ this->MouseMotion = 0;
if (this->Interactor->GetShiftKey())
{
@@ -122,6 +129,17 @@
break;
case VTKIS_ROTATE:
+ // if there's no mouse motion and mouse picking has been enabled then perform a pick
+ if (!this->MouseMotion && this->MousePicking)
+ {
+ vtkRenderWindowInteractor *rwi = this->Interactor;
+ this->PickButton = VTK_LEFT_PICK;
+ this->FindPokedRenderer(rwi->GetEventPosition()[0], rwi->GetEventPosition()[1]);
+ rwi->StartPickCallback();
+ rwi->GetPicker()->Pick(rwi->GetEventPosition()[0], rwi->GetEventPosition()[1],
+ 0.0, this->CurrentRenderer);
+ rwi->EndPickCallback();
+ }
this->EndRotate();
break;
}
@@ -160,6 +178,8 @@
{
return;
}
+
+ this->MouseMotion = 0;
this->StartDolly();
}
@@ -170,6 +190,17 @@
switch (this->State)
{
case VTKIS_DOLLY:
+ // if no mouse motion and mouse picking is enabled do a right pick
+ if (!this->MouseMotion && this->MousePicking)
+ {
+ vtkRenderWindowInteractor *rwi = this->Interactor;
+ this->PickButton = VTK_RIGHT_PICK;
+ this->FindPokedRenderer(rwi->GetEventPosition()[0], rwi->GetEventPosition()[1]);
+ rwi->StartPickCallback();
+ rwi->GetPicker()->Pick(rwi->GetEventPosition()[0], rwi->GetEventPosition()[1],
+ 0.0, this->CurrentRenderer);
+ rwi->EndPickCallback();
+ }
this->EndDolly();
break;
}
@@ -383,6 +414,6 @@
void vtkInteractorStyleTrackballCamera::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
-
+
}
|