Commit 25ff6d81 authored by David Thompson's avatar David Thompson Committed by Kitware Robot

Merge topic 'selection-interaction-mode'

de16a2ca Make ParaView's "interaction mode" available to SMTK...
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: T.J. Corona's avatarT.J. Corona <tj.corona@kitware.com>
Merge-request: !2269
parents b2164d0d de16a2ca
......@@ -31,6 +31,7 @@
#include "pqView.h"
#include "vtkSMPropertyHelper.h"
#include "vtkSMRenderViewProxy.h"
#include "vtkInformation.h"
#include "vtkMultiBlockDataSet.h"
......@@ -163,7 +164,7 @@ void vtkSMTKEncodeSelection::ProcessRawSelection(
bool vtkSMTKEncodeSelection::ProcessResource(pqSMTKWrapper* wrapper,
const smtk::resource::ResourcePtr& resource, const smtk::view::SelectionPtr& smtkSelection,
vtkSMTKResourceRepresentation* resourceRep, vtkSelection* rawSelection,
vtkSMRenderViewProxy* vtkNotUsed(viewProxy) /*unused*/, int modifier, bool selectBlocks)
vtkSMRenderViewProxy* viewProxy, int modifier, bool selectBlocks)
{
(void)resource;
(void)rawSelection;
......@@ -187,6 +188,8 @@ bool vtkSMTKEncodeSelection::ProcessResource(pqSMTKWrapper* wrapper,
{
continue;
}
int mode = vtkSMPropertyHelper(viewProxy, "InteractionMode").GetAsInt();
operation->setInteractionMode(mode);
operation->setSMTKSelection(smtkSelection);
operation->setVTKSelection(rawSelection);
operation->setVTKData(mbds);
......
......@@ -20,6 +20,8 @@
#include "smtk/io/Logger.h"
#include "vtkPVRenderView.h"
#include "vtkCompositeDataIterator.h"
#include "vtkIdTypeArray.h"
#include "vtkInformation.h"
......@@ -73,6 +75,29 @@ RespondToVTKSelection::~RespondToVTKSelection()
}
}
bool RespondToVTKSelection::setInteractionMode(int mode)
{
if (mode == m_interactionMode)
{
return false;
}
switch (mode)
{
case vtkPVRenderView::INTERACTION_MODE_UNINTIALIZED: // fall through
case vtkPVRenderView::INTERACTION_MODE_3D: // fall through
case vtkPVRenderView::INTERACTION_MODE_2D: // fall through
case vtkPVRenderView::INTERACTION_MODE_SELECTION: // fall through
case vtkPVRenderView::INTERACTION_MODE_ZOOM: // fall through
case vtkPVRenderView::INTERACTION_MODE_POLYGON: // fall through
m_interactionMode = mode;
return true;
default:
vtkGenericWarningMacro("Unknown interaction mode (" << mode << ") during selection.");
break;
}
return false;
}
bool RespondToVTKSelection::setVTKData(vtkMultiBlockDataSet* mbds)
{
if (m_vtkData == mbds)
......
......@@ -45,6 +45,27 @@ public:
smtkSuperclassMacro(smtk::operation::XMLOperation);
virtual ~RespondToVTKSelection();
/**\brief Set/get the interaction mode.
*
* The interaction mode values correspond to the
* vtkPVRenderView::InteractionModes enum:
*
* + INTERACTION_MODE_3D = 0,
* + INTERACTION_MODE_2D,
* + INTERACTION_MODE_SELECTION,
* + INTERACTION_MODE_ZOOM,
* + INTERACTION_MODE_POLYGON
*
* Generally speaking, primitive selections should not be created
* when the interaction mode is INTERACTION_MODE_3D, INTERACTION_MODE_2D,
* or INTERACTION_MODE_ZOOM (as these modes are for camera manipulation
* and whole-object picking).
*
* This is set by the vtkSMTKWrapper before the operation is invoked.
*/
bool setInteractionMode(int mode);
int interactionMode() const { return m_interactionMode; }
/**\brief Set/get the multiblock data holding per-component tessellation info.
*
* This is set by the vtkSMTKWrapper before the operation is invoked.
......@@ -127,6 +148,7 @@ protected:
/// Fail or succeed quietly.
void generateSummary(Operation::Result&) override{};
int m_interactionMode;
::vtkSelection* m_vtkSelection;
vtkMultiBlockDataSet* m_vtkData;
smtk::view::WeakSelectionPtr m_smtkSelection;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment