Commit 594f789b authored by Michael Migliore's avatar Michael Migliore

Add new VRPlugin interactor styles

parent 42c32a19
# VRPlugin new interactor styles
Two new interactor styles have been added to the VR plugin:
- `Stylus`: Use the position of the stylus to apply translation and rotation to the camera.
- `Move point`: Use a tracker to move intuitively a 3D point in camera space.
Both are well suited for some devices which take benefit from a stylus like the zSpace.
......@@ -41,10 +41,14 @@ set(sources
vtkVRInteractorStyle.h
vtkVRInteractorStyleFactory.cxx
vtkVRInteractorStyleFactory.h
vtkVRMovePointStyle.cxx
vtkVRMovePointStyle.h
vtkVRQueue.cxx
vtkVRQueue.h
vtkVRSpaceNavigatorGrabWorldStyle.cxx
vtkVRSpaceNavigatorGrabWorldStyle.h
vtkVRStylusStyle.cxx
vtkVRStylusStyle.h
vtkVRTrackStyle.cxx
vtkVRTrackStyle.h
vtkVRVirtualHandStyle.cxx
......
......@@ -460,9 +460,11 @@ void pqVRDockPanel::setActiveView(pqView* view)
this->Internals->Camera = NULL;
if (rview)
{
if (vtkSMRenderViewProxy* renPxy = rview->getRenderViewProxy())
vtkSMRenderViewProxy* renPxy = rview->getRenderViewProxy();
if (renPxy)
{
if (this->Internals->Camera = renPxy->GetActiveCamera())
this->Internals->Camera = renPxy->GetActiveCamera();
if (this->Internals->Camera)
{
pqCoreUtilities::connect(
this->Internals->Camera, vtkCommand::ModifiedEvent, this, SLOT(updateDebugLabel()));
......
......@@ -44,20 +44,20 @@ public:
vtkTypeMacro(vtkVRControlSliceOrientationStyle, vtkVRInteractorStyle);
void PrintSelf(ostream& os, vtkIndent indent) override;
virtual int GetControlledPropertySize() { return 3; }
int GetControlledPropertySize() override { return 3; }
/// called to update all the remote vtkObjects and perhaps even to render.
/// Typically processing intensive operations go here. The method should not
/// be called from within the handler and is reserved to be called from an
/// external interaction style manager.
virtual bool Update();
bool Update() override;
protected:
vtkVRControlSliceOrientationStyle();
~vtkVRControlSliceOrientationStyle();
~vtkVRControlSliceOrientationStyle() override;
void HandleButton(const vtkVREventData& data);
void HandleTracker(const vtkVREventData& data);
void HandleButton(const vtkVREventData& data) override;
void HandleTracker(const vtkVREventData& data) override;
bool Enabled;
bool InitialOrientationRecorded;
......
......@@ -42,23 +42,23 @@ class vtkVRControlSlicePositionStyle : public vtkVRInteractorStyle
{
public:
static vtkVRControlSlicePositionStyle* New();
vtkTypeMacro(vtkVRControlSlicePositionStyle, vtkVRInteractorStyle) void PrintSelf(
ostream& os, vtkIndent indent) override;
vtkTypeMacro(vtkVRControlSlicePositionStyle, vtkVRInteractorStyle);
void PrintSelf(ostream& os, vtkIndent indent) override;
virtual int GetControlledPropertySize() { return 3; }
int GetControlledPropertySize() override { return 3; }
/// called to update all the remote vtkObjects and perhaps even to render.
/// Typically processing intensive operations go here. The method should not
/// be called from within the handler and is reserved to be called from an
/// external interaction style manager.
virtual bool Update();
bool Update() override;
protected:
vtkVRControlSlicePositionStyle();
~vtkVRControlSlicePositionStyle();
~vtkVRControlSlicePositionStyle() override;
void HandleButton(const vtkVREventData& data);
void HandleTracker(const vtkVREventData& data);
void HandleButton(const vtkVREventData& data) override;
void HandleTracker(const vtkVREventData& data) override;
bool Enabled;
bool InitialPositionRecorded;
......
......@@ -51,10 +51,10 @@ public:
protected:
vtkVRGrabWorldStyle();
~vtkVRGrabWorldStyle();
~vtkVRGrabWorldStyle() override;
virtual void HandleButton(const vtkVREventData& data);
virtual void HandleTracker(const vtkVREventData& data);
void HandleButton(const vtkVREventData& data) override;
void HandleTracker(const vtkVREventData& data) override;
bool EnableTranslate;
bool EnableRotate;
......
......@@ -36,13 +36,15 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkVRControlSliceOrientationStyle.h"
#include "vtkVRControlSlicePositionStyle.h"
#include "vtkVRGrabWorldStyle.h"
#include "vtkVRMovePointStyle.h"
#include "vtkVRSpaceNavigatorGrabWorldStyle.h"
#include "vtkVRStylusStyle.h"
#include "vtkVRTrackStyle.h"
#include "vtkVRVirtualHandStyle.h"
//-----------------------------------------------------------------------------
vtkStandardNewMacro(vtkVRInteractorStyleFactory)
vtkVRInteractorStyleFactory* vtkVRInteractorStyleFactory::Instance = NULL;
vtkStandardNewMacro(vtkVRInteractorStyleFactory);
vtkVRInteractorStyleFactory* vtkVRInteractorStyleFactory::Instance = nullptr;
//-----------------------------------------------------------------------------
vtkVRInteractorStyleFactory::vtkVRInteractorStyleFactory()
......@@ -70,6 +72,14 @@ vtkVRInteractorStyleFactory::vtkVRInteractorStyleFactory()
// Add Virtual Hand - DJZ
this->InteractorStyleClassNames.push_back("vtkVRVirtualHandStyle");
this->InteractorStyleDescriptions.push_back("Virtual Hand");
// Add Stylus style
this->InteractorStyleClassNames.push_back("vtkVRStylusStyle");
this->InteractorStyleDescriptions.push_back("Stylus");
// Add Move Point style
this->InteractorStyleClassNames.push_back("vtkVRMovePointStyle");
this->InteractorStyleDescriptions.push_back("Move Point");
}
//-----------------------------------------------------------------------------
......@@ -82,12 +92,12 @@ void vtkVRInteractorStyleFactory::SetInstance(vtkVRInteractorStyleFactory* ins)
{
if (vtkVRInteractorStyleFactory::Instance)
{
vtkVRInteractorStyleFactory::Instance->UnRegister(NULL);
vtkVRInteractorStyleFactory::Instance->UnRegister(nullptr);
}
if (ins)
{
ins->Register(NULL);
ins->Register(nullptr);
}
vtkVRInteractorStyleFactory::Instance = ins;
......@@ -152,8 +162,16 @@ vtkVRInteractorStyle* vtkVRInteractorStyleFactory::NewInteractorStyleFromClassNa
{
return vtkVRVirtualHandStyle::New();
}
else if (name == "vtkVRStylusStyle")
{
return vtkVRStylusStyle::New();
}
else if (name == "vtkVRMovePointStyle")
{
return vtkVRMovePointStyle::New();
}
return NULL;
return nullptr;
}
//-----------------------------------------------------------------------------
......@@ -167,7 +185,7 @@ vtkVRInteractorStyle* vtkVRInteractorStyleFactory::NewInteractorStyleFromDescrip
return this->NewInteractorStyleFromClassName(this->InteractorStyleClassNames[i]);
}
}
return NULL;
return nullptr;
}
//-----------------------------------------------------------------------------
......
/*=========================================================================
Program: ParaView
Module: vtkVRMovePointStyle.cxx
Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
All rights reserved.
ParaView is a free software; you can redistribute it and/or modify it
under the terms of the ParaView license version 1.2.
See License_v1.2.txt for the full ParaView license.
A copy of this license can be obtained by contacting
Kitware Inc.
28 Corporate Drive
Clifton Park, NY 12065
USA
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
========================================================================*/
#include "vtkVRMovePointStyle.h"
#include "vtkCamera.h"
#include "vtkMatrix4x4.h"
#include "vtkNew.h"
#include "vtkObjectFactory.h"
#include "vtkSMPropertyHelper.h"
#include "vtkSMProxy.h"
#include "vtkSMRenderViewProxy.h"
#include "vtkTransform.h"
#include "vtkVRQueue.h"
#include "pqActiveObjects.h"
#include "pqRenderView.h"
#include <algorithm>
#include <sstream>
// -----------------------------------------------------------------------------
vtkStandardNewMacro(vtkVRMovePointStyle);
// -----------------------------------------------------------------------------
vtkVRMovePointStyle::vtkVRMovePointStyle()
: Superclass()
{
this->AddButtonRole("Move");
this->EnableMovePoint = false;
}
// ----------------------------------------------------------------------------
void vtkVRMovePointStyle::HandleButton(const vtkVREventData& data)
{
this->PositionRecorded = false;
vtkStdString role = this->GetButtonRole(data.name);
if (role == "Move")
{
this->EnableMovePoint = data.data.button.state;
}
}
// ----------------------------------------------------------------------------
void vtkVRMovePointStyle::HandleTracker(const vtkVREventData& data)
{
if (this->GetTrackerRole(data.name) != "Tracker")
{
return;
}
if (!this->PositionRecorded)
{
this->LastRecordedPosition[0] = data.data.tracker.matrix[3];
this->LastRecordedPosition[1] = data.data.tracker.matrix[7];
this->LastRecordedPosition[2] = data.data.tracker.matrix[11];
this->PositionRecorded = true;
return;
}
double diffPosition[3];
diffPosition[0] = data.data.tracker.matrix[3] - this->LastRecordedPosition[0];
diffPosition[1] = data.data.tracker.matrix[7] - this->LastRecordedPosition[1];
diffPosition[2] = data.data.tracker.matrix[11] - this->LastRecordedPosition[2];
this->LastRecordedPosition[0] = data.data.tracker.matrix[3];
this->LastRecordedPosition[1] = data.data.tracker.matrix[7];
this->LastRecordedPosition[2] = data.data.tracker.matrix[11];
if (this->EnableMovePoint)
{
vtkCamera* camera = nullptr;
pqActiveObjects& activeObjs = pqActiveObjects::instance();
pqView* view = activeObjs.activeView();
if (view)
{
pqRenderView* rview = qobject_cast<pqRenderView*>(view);
if (rview)
{
vtkSMRenderViewProxy* rProxy = vtkSMRenderViewProxy::SafeDownCast(rview->getProxy());
if (rProxy)
{
camera = rProxy->GetActiveCamera();
}
}
}
if (!camera)
{
vtkWarningMacro("Cannot get active camera.");
return;
}
double point[4];
vtkSMPropertyHelper(this->ControlledProxy, this->ControlledPropertyName).Get(point, 3);
point[3] = 1.0;
vtkNew<vtkMatrix4x4> modelViewMatrix;
vtkNew<vtkMatrix4x4> invModelViewMatrix;
modelViewMatrix->DeepCopy(camera->GetModelViewTransformMatrix());
vtkMatrix4x4::Invert(modelViewMatrix, invModelViewMatrix);
modelViewMatrix->MultiplyPoint(point, point);
// the translation is scaled by the depth distance
point[0] -= diffPosition[0] * point[2];
point[1] -= diffPosition[1] * point[2];
point[2] -= diffPosition[2] * point[2];
invModelViewMatrix->MultiplyPoint(point, point);
vtkSMPropertyHelper(this->ControlledProxy, this->ControlledPropertyName).Set(point, 3);
this->ControlledProxy->UpdateVTKObjects();
}
}
// ----------------------------------------------------------------------------
void vtkVRMovePointStyle::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
os << indent << "EnableMovePoint: " << this->EnableMovePoint << endl;
}
/*=========================================================================
Program: ParaView
Module: vtkVRMovePointStyle.h
Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
All rights reserved.
ParaView is a free software; you can redistribute it and/or modify it
under the terms of the ParaView license version 1.2.
See License_v1.2.txt for the full ParaView license.
A copy of this license can be obtained by contacting
Kitware Inc.
28 Corporate Drive
Clifton Park, NY 12065
USA
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
========================================================================*/
/**
* @class vtkVRMovePointStyle
* @brief an interaction style to control the position of a point with a stylus
*
* vtkVRMovePointStyle is an interaction style that uses the position of the
* tracker in screen space to modify the position of a 3D point.
*/
#ifndef vtkVRMovePointStyle_h_
#define vtkVRMovePointStyle_h_
#include "vtkVRTrackStyle.h"
struct vtkVREventData;
class vtkVRMovePointStyle : public vtkVRTrackStyle
{
public:
static vtkVRMovePointStyle* New();
vtkTypeMacro(vtkVRMovePointStyle, vtkVRTrackStyle);
void PrintSelf(ostream& os, vtkIndent indent) override;
int GetControlledPropertySize() override { return 3; }
protected:
vtkVRMovePointStyle();
~vtkVRMovePointStyle() override = default;
void HandleButton(const vtkVREventData& data) override;
void HandleTracker(const vtkVREventData& data) override;
bool EnableMovePoint;
private:
vtkVRMovePointStyle(const vtkVRMovePointStyle&) = delete;
void operator=(const vtkVRMovePointStyle&) = delete;
double LastRecordedPosition[3];
bool PositionRecorded;
};
#endif // vtkVRMovePointStyle.h_
......@@ -51,9 +51,9 @@ public:
protected:
vtkVRSpaceNavigatorGrabWorldStyle();
~vtkVRSpaceNavigatorGrabWorldStyle();
~vtkVRSpaceNavigatorGrabWorldStyle() override;
virtual void HandleAnalog(const vtkVREventData& data);
void HandleAnalog(const vtkVREventData& data) override;
private:
vtkVRSpaceNavigatorGrabWorldStyle(const vtkVRSpaceNavigatorGrabWorldStyle&) = delete;
......
/*=========================================================================
Program: ParaView
Module: vtkVRStylusStyle.cxx
Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
All rights reserved.
ParaView is a free software; you can redistribute it and/or modify it
under the terms of the ParaView license version 1.2.
See License_v1.2.txt for the full ParaView license.
A copy of this license can be obtained by contacting
Kitware Inc.
28 Corporate Drive
Clifton Park, NY 12065
USA
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
========================================================================*/
#include "vtkVRStylusStyle.h"
#include "vtkCamera.h"
#include "vtkMatrix4x4.h"
#include "vtkNew.h"
#include "vtkObjectFactory.h"
#include "vtkSMPropertyHelper.h"
#include "vtkSMProxy.h"
#include "vtkSMRenderViewProxy.h"
#include "vtkTransform.h"
#include "vtkVRQueue.h"
#include <algorithm>
#include <sstream>
// -----------------------------------------------------------------------------
vtkStandardNewMacro(vtkVRStylusStyle);
// -----------------------------------------------------------------------------
vtkVRStylusStyle::vtkVRStylusStyle()
: Superclass()
{
this->AddButtonRole("Rotate world");
this->AddButtonRole("Translate world");
this->EnableTranslate = false;
this->EnableRotate = false;
}
// ----------------------------------------------------------------------------
void vtkVRStylusStyle::HandleButton(const vtkVREventData& data)
{
this->PositionRecorded = false;
vtkStdString role = this->GetButtonRole(data.name);
if (role == "Translate world")
{
this->EnableTranslate = data.data.button.state;
}
else if (role == "Rotate world")
{
this->EnableRotate = data.data.button.state;
}
}
// ----------------------------------------------------------------------------
void vtkVRStylusStyle::HandleTracker(const vtkVREventData& data)
{
if (this->GetTrackerRole(data.name) == "Tracker")
{
if (!this->PositionRecorded)
{
this->LastRecordedPosition[0] = data.data.tracker.matrix[3];
this->LastRecordedPosition[1] = data.data.tracker.matrix[7];
this->LastRecordedPosition[2] = data.data.tracker.matrix[11];
this->PositionRecorded = true;
return;
}
double diffPosition[3];
diffPosition[0] = data.data.tracker.matrix[3] - this->LastRecordedPosition[0];
diffPosition[1] = data.data.tracker.matrix[7] - this->LastRecordedPosition[1];
diffPosition[2] = data.data.tracker.matrix[11] - this->LastRecordedPosition[2];
this->LastRecordedPosition[0] = data.data.tracker.matrix[3];
this->LastRecordedPosition[1] = data.data.tracker.matrix[7];
this->LastRecordedPosition[2] = data.data.tracker.matrix[11];
vtkSMRenderViewProxy* rvProxy = vtkSMRenderViewProxy::SafeDownCast(this->ControlledProxy);
if (rvProxy)
{
vtkCamera* camera = rvProxy->GetActiveCamera();
if (this->EnableTranslate)
{
vtkNew<vtkMatrix4x4> modelMatrix;
vtkNew<vtkMatrix4x4> modelViewMatrix;
vtkNew<vtkMatrix4x4> invViewMatrix;
vtkSMPropertyHelper(this->ControlledProxy, this->ControlledPropertyName)
.Get(*modelMatrix->Element, 16);
modelViewMatrix->DeepCopy(camera->GetModelViewTransformMatrix());
// compute inverse view matrix
vtkMatrix4x4::Invert(modelViewMatrix, invViewMatrix);
vtkMatrix4x4::Multiply4x4(modelMatrix, invViewMatrix, invViewMatrix);
double dist = camera->GetDistance();
modelMatrix->DeepCopy(modelViewMatrix);
modelMatrix->SetElement(0, 3, modelMatrix->GetElement(0, 3) + diffPosition[0] * dist);
modelMatrix->SetElement(1, 3, modelMatrix->GetElement(1, 3) + diffPosition[1] * dist);
modelMatrix->SetElement(2, 3, modelMatrix->GetElement(2, 3) + diffPosition[2] * dist);
vtkMatrix4x4::Multiply4x4(invViewMatrix, modelMatrix, modelMatrix);
vtkSMPropertyHelper(this->ControlledProxy, this->ControlledPropertyName)
.Set(*modelMatrix->Element, 16);
this->ControlledProxy->UpdateVTKObjects();
}
if (this->EnableRotate)
{
vtkNew<vtkMatrix4x4> modelMatrix;
vtkNew<vtkMatrix4x4> modelViewMatrix;
vtkNew<vtkMatrix4x4> invViewMatrix;
vtkSMPropertyHelper(this->ControlledProxy, this->ControlledPropertyName)
.Get(*modelMatrix->Element, 16);
modelViewMatrix->DeepCopy(camera->GetModelViewTransformMatrix());
// compute inverse view matrix and inverse model/view matrix
vtkMatrix4x4::Invert(modelViewMatrix, invViewMatrix);
vtkMatrix4x4::Multiply4x4(modelMatrix, invViewMatrix, invViewMatrix);
double center[4];
vtkSMPropertyHelper(this->ControlledProxy, "CenterOfRotation").Get(center, 3);
center[3] = 1.0;
modelViewMatrix->MultiplyPoint(center, center);
// compute the transformation to apply
vtkNew<vtkMatrix4x4> transfoMatrix;
transfoMatrix->SetElement(0, 3, -center[0]);
transfoMatrix->SetElement(1, 3, -center[1]);
transfoMatrix->SetElement(2, 3, -center[2]);
vtkNew<vtkTransform> transfo;
transfo->RotateX(-diffPosition[1] * 300.0);
transfo->RotateY(diffPosition[0] * 300.0);
vtkMatrix4x4::Multiply4x4(transfo->GetMatrix(), transfoMatrix, transfoMatrix);
transfoMatrix->SetElement(0, 3, transfoMatrix->GetElement(0, 3) + center[0]);
transfoMatrix->SetElement(1, 3, transfoMatrix->GetElement(1, 3) + center[1]);
transfoMatrix->SetElement(2, 3, transfoMatrix->GetElement(2, 3) + center[2]);
// apply the transformation
vtkMatrix4x4::Multiply4x4(transfoMatrix, modelViewMatrix, modelMatrix);
vtkMatrix4x4::Multiply4x4(invViewMatrix, modelMatrix, modelMatrix);
vtkSMPropertyHelper(this->ControlledProxy, this->ControlledPropertyName)
.Set(*modelMatrix->Element, 16);
}
}
else
{
vtkWarningMacro(
"This interactor style only works with render view proxy, ignoring interaction...");
}
}
}
// ----------------------------------------------------------------------------
void vtkVRStylusStyle::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
os << indent << "EnableTranslate: " << this->EnableTranslate << endl;
os << indent << "EnableRotate: " << this->EnableRotate << endl;
}
/*=========================================================================
Program: ParaView
Module: vtkVRStylusStyle.h
Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
All rights reserved.
ParaView is a free software; you can redistribute it and/or modify it
under the terms of the ParaView license version 1.2.
See License_v1.2.txt for the full ParaView license.
A copy of this license can be obtained by contacting
Kitware Inc.
28 Corporate Drive
Clifton Park, NY 12065
USA
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
========================================================================*/
/**
* @class vtkVRStylusStyle
* @brief an interaction style to control translation and rotation with a stylus
*
* vtkVRStylusStyle is an interaction style that uses the position of the
* stylus in screen space (for example the stylus of the zSpace) to modify a 4x4 matrix.
* Only the position of the stylus is used, the rotation has no effect.
* Only works with render view proxy.
*/
#ifndef vtkVRStylusStyle_h_
#define vtkVRStylusStyle_h_
#include "vtkVRTrackStyle.h"
struct vtkVREventData;
class vtkVRStylusStyle : public vtkVRTrackStyle
{
public:
static vtkVRStylusStyle* New();
vtkTypeMacro(vtkVRStylusStyle, vtkVRTrackStyle);
void PrintSelf(ostream& os, vtkIndent indent) override;
protected:
vtkVRStylusStyle();
~vtkVRStylusStyle() override = default;
void HandleButton(const vtkVREventData& data) override;
void HandleTracker(const vtkVREventData& data) override;
bool EnableTranslate;
bool EnableRotate;
private:
vtkVRStylusStyle(const vtkVRStylusStyle&) = delete;
void operator=(const vtkVRStylusStyle&) = delete;
double LastRecordedPosition[3];
bool PositionRecorded;
};
#endif // vtkVRStylusStyle.h_
......@@ -49,12 +49,12 @@ public:
vtkTypeMacro(vtkVRTrackStyle, vtkVRInteractorStyle);
void PrintSelf(ostream& os, vtkIndent indent) override;
virtual int GetControlledPropertySize() { return 16; }
int GetControlledPropertySize() override { return 16; }
protected:
vtkVRTrackStyle();
~vtkVRTrackStyle();
virtual void HandleTracker(const vtkVREventData& data);
~vtkVRTrackStyle() override;
void HandleTracker(const vtkVREventData& data) override;
private:
vtkVRTrackStyle(const vtkVRTrackStyle&) = delete;
......
......@@ -53,8 +53,8 @@ protected:
vtkVRVirtualHandStyle();
~vtkVRVirtualHandStyle();