Commit b083de63 authored by Dan Lipsa's avatar Dan Lipsa Committed by Utkarsh Ayachit

ENH: Add interactive selection.

This feature allows you to inspect cells' attributes and interactively select them.
Bug: 15309
parent ad932ba7
......@@ -213,6 +213,7 @@ list(APPEND TESTS_WITH_BASELINES
${CMAKE_CURRENT_SOURCE_DIR}/Fractal2D.xml
${CMAKE_CURRENT_SOURCE_DIR}/FunctionalBagPlots.xml
${CMAKE_CURRENT_SOURCE_DIR}/ImageVolumeRendering.xml
${CMAKE_CURRENT_SOURCE_DIR}/InteractiveSelection.xml
${CMAKE_CURRENT_SOURCE_DIR}/LoadPartiallyUpdatedStateFiles.xml
${CMAKE_CURRENT_SOURCE_DIR}/LoadSaveStateAnimation.xml
${CMAKE_CURRENT_SOURCE_DIR}/LoadState.xml
......@@ -409,6 +410,8 @@ set(MultiSliceMultiBlock_DISABLE_CRS TRUE)
set(PolygonCellSelection_DISABLE_CRS TRUE)
set(PolygonPointSelection_DISABLE_CRS TRUE)
set(NonlinearSubdivisionDisplay_DISABLE_CRS TRUE)
set(InteractiveSelection_DISABLE_CRS TRUE)
# These tests cannot be run using ctest -j since they are affected by focus
# changed events.
......
......@@ -8,7 +8,7 @@
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/cameraToolbar/actionPositiveY" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar/menuTools" command="activate" arguments="actionTesting_Window_Size" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/actionSelectionMode" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/actionSelectSurfaceCells" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport" command="mousePress" arguments="(0.433333,0.666667,1,1,0)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport" command="mouseMove" arguments="(0.433333,0.666667,1,0,0)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport" command="mouseRelease" arguments="(0.433333,0.666667,1,0,0)" />
......
......@@ -87,7 +87,7 @@
<pqevent object="pqClientMainWindow/FindDataDialog/selectionDisplayFrame/pointLabelsButton" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/FindDataDialog/selectionDisplayFrame/PointLabelsMenu" command="activate" arguments="Pres" />
<pqevent object="pqClientMainWindow/FindDataDialog/selectionDisplayFrame/showLabelPropertiesButton" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/FindDataDialog/selectionDisplayFrame/labelPropertiesSelection" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/FindDataDialog/selectionDisplayFrame/ProxyWidgetDialog/scrollArea/qt_scrollarea_viewport/Container/ProxyWidget/FontEditor/FontFamily" command="set_string" arguments="Courier" />
<pqevent object="pqClientMainWindow/FindDataDialog/selectionDisplayFrame/ProxyWidgetDialog/scrollArea/qt_scrollarea_viewport/Container/ProxyWidget/FontEditor/FontFamily" command="set_string" arguments="Courier" />
<pqevent object="pqClientMainWindow/FindDataDialog/selectionDisplayFrame/ProxyWidgetDialog/widget/OKButton" command="activate" arguments="" />
......
......@@ -50,7 +50,7 @@
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Splitter.0/Frame.2/Minimize" command="activate" arguments="" />
<!-- Now, if we make a selection in the Render View, the Histogram selection should get cleared -->
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Splitter.0/Frame.1/actionSelectionMode" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Splitter.0/Frame.1/actionSelectSurfaceCells" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Splitter.0/Frame.1/Viewport" command="mousePress" arguments="(0.553333,0.054902,1,1,0)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Splitter.0/Frame.1/Viewport" command="mouseMove" arguments="(0.733333,0.262745,1,0,0)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Splitter.0/Frame.1/Viewport" command="mouseRelease" arguments="(0.733333,0.262745,1,0,0)" />
......
<?xml version="1.0" ?>
<pqevents>
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuTools" />
<pqevent object="pqClientMainWindow/menubar/menuTools" command="activate" arguments="actionTesting_Window_Size_Custom" />
<pqevent object="pqClientMainWindow/pqLockViewSizeCustomDialog/Width" command="key" arguments="16777219" />
<pqevent object="pqClientMainWindow/pqLockViewSizeCustomDialog/Width" command="set_string" arguments="400" />
<pqevent object="pqClientMainWindow/pqLockViewSizeCustomDialog/Height" command="key" arguments="16777219" />
<pqevent object="pqClientMainWindow/pqLockViewSizeCustomDialog/Height" command="set_string" arguments="400" />
<pqevent object="pqClientMainWindow/pqLockViewSizeCustomDialog/ButtonBox/1QPushButton0" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuSources" />
<pqevent object="pqClientMainWindow/menubar/menuSources" command="activate" arguments="SphereSource" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/actionInteractiveSelectSurfaceCells" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport" command="mousePress" arguments="(0.2675,0.395,1,1,0)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport" command="mouseMove" arguments="(0.2675,0.395,1,0,0)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport" command="mouseRelease" arguments="(0.2675,0.395,1,0,0)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport" command="mousePress" arguments="(0.2675,0.435,1,1,0)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport" command="mouseMove" arguments="(0.2675,0.435,1,0,0)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport" command="mouseRelease" arguments="(0.2675,0.435,1,0,0)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport" command="mousePress" arguments="(0.2975,0.4175,1,1,0)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport" command="mouseMove" arguments="(0.2975,0.4175,1,0,0)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport" command="mouseRelease" arguments="(0.2975,0.4175,1,0,0)" />
</pqevents>
......@@ -19,7 +19,7 @@
<!-- Start cell selection -->
<pqevent object="pqClientMainWindow/cameraToolbar/actionNegativeX" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/actionSelectionMode" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/actionSelectSurfaceCells" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport/1pqQVTKWidget0" command="mousePress" arguments="(0.342688,0.0460251,1,1,0)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport/1pqQVTKWidget0" command="mouseMove" arguments="(0.672083,0.426778,1,0,0)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport/1pqQVTKWidget0" command="mouseRelease" arguments="(0.672083,0.426778,1,0,0)" />
......
......@@ -16,7 +16,7 @@
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<!-- Start cell selection -->
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/actionSelectionMode" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/actionSelectSurfaceCells" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport/1pqQVTKWidget0" command="mousePress" arguments="(0.353028,0.288703,1,1,0)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport/1pqQVTKWidget0" command="mouseMove" arguments="(0.463811,0.405858,1,0,0)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport/1pqQVTKWidget0" command="mouseRelease" arguments="(0.463811,0.405858,1,0,0)" />
......
......@@ -9,7 +9,7 @@
<pqevent object="pqClientMainWindow/cameraToolbar/actionPositiveY" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuTools" />
<pqevent object="pqClientMainWindow/menubar/menuTools" command="activate" arguments="actionTesting_Window_Size" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/actionSelectionMode" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/actionSelectSurfaceCells" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport" command="mousePress" arguments="(0.393333,0.426667,1,1,0)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport" command="mouseMove" arguments="(0.393333,0.43,1,0,0)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport" command="mouseRelease" arguments="(0.393333,0.43,1,0,0)" />
......
......@@ -7,7 +7,7 @@
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuTools" />
<pqevent object="pqClientMainWindow/menubar/menuTools" command="activate" arguments="actionTesting_Window_Size" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/actionSelectionMode" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/actionSelectSurfaceCells" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport" command="mousePress" arguments="(0.293333,0.47,1,1,0)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport" command="mouseMove" arguments="(0.293333,0.47,1,0,0)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport" command="mouseRelease" arguments="(0.293333,0.47,1,0,0)" />
......@@ -20,7 +20,7 @@
<pqevent object="pqClientMainWindow/FindDataDialog/buttonBox/1QPushButton0" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/VCRToolbar/actionVCRFirstFrame" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/cameraToolbar/actionNegativeX" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/actionSelectionMode" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/actionSelectSurfaceCells" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport" command="mousePress" arguments="(0.434238,0.441989,1,1,0)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport" command="mouseMove" arguments="(0.434238,0.441989,1,0,0)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport" command="mouseRelease" arguments="(0.434238,0.441989,1,0,0)" />
......
......@@ -9,7 +9,7 @@
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuTools" />
<pqevent object="pqClientMainWindow/menubar/menuTools" command="activate" arguments="actionTesting_Window_Size" />
<pqevent object="pqClientMainWindow/cameraToolbar/actionNegativeY" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/actionSelectionMode" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/actionSelectSurfaceCells" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport" command="mousePress" arguments="(0.5,0.466667,1,1,0)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport" command="mouseMove" arguments="(0.52,0.573333,1,0,0)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Frame.0/Viewport" command="mouseRelease" arguments="(0.52,0.573333,1,0,0)" />
......
......@@ -22,6 +22,7 @@
#include "vtkSMEnumerationDomain.h"
#include "vtkSMInputProperty.h"
#include "vtkSMIntVectorProperty.h"
#include "vtkSMNamedPropertyIterator.h"
#include "vtkSMProperty.h"
#include "vtkSMPropertyIterator.h"
#include "vtkSMProxy.h"
......@@ -622,7 +623,7 @@ public:
// Description:
// Set proxy settings to the highest-priority collection.
bool SetProxySettings(vtkSMProxy* proxy,
const std::vector<std::string>* properties)
vtkSMNamedPropertyIterator* propertyIt)
{
if (!proxy)
{
......@@ -632,7 +633,7 @@ public:
std::string jsonPrefix(".");
jsonPrefix.append(proxy->GetXMLGroup());
return this->SetProxySettings(jsonPrefix.c_str(), proxy, properties);
return this->SetProxySettings(jsonPrefix.c_str(), proxy, propertyIt);
}
//----------------------------------------------------------------------------
......@@ -640,7 +641,7 @@ public:
// Set proxy settings in the highest-priority collection under
// the setting prefix.
bool SetProxySettings(const char* settingPrefix, vtkSMProxy* proxy,
const std::vector<std::string>* properties)
vtkSMNamedPropertyIterator* propertyIt)
{
if (!proxy)
{
......@@ -669,11 +670,21 @@ public:
vtkSMProperty* property = iter->GetProperty();
if (!property) continue;
// save defaults only for properties listed
if (properties && properties->size () > 0 &&
std::find(properties->begin(), properties->end(),
property->GetXMLName()) == properties->end())
if (propertyIt)
{
continue;
bool found = false;
for (propertyIt->Begin(); ! propertyIt->IsAtEnd(); propertyIt->Next())
{
if (! strcmp(property->GetXMLName(), propertyIt->GetKey()))
{
found = true;
break;
}
}
if (! found)
{
continue;
}
}
// Check to see if we save only to QSettings or to both QSettings
......@@ -1224,16 +1235,16 @@ void vtkSMSettings::SetSetting(const char* settingName, unsigned int index, cons
//----------------------------------------------------------------------------
void vtkSMSettings::SetProxySettings(vtkSMProxy* proxy,
const std::vector<std::string>* properties)
vtkSMNamedPropertyIterator* propertyIt)
{
this->Internal->SetProxySettings(proxy, properties);
this->Internal->SetProxySettings(proxy, propertyIt);
}
//----------------------------------------------------------------------------
void vtkSMSettings::SetProxySettings(const char* prefix, vtkSMProxy* proxy,
const std::vector<std::string>* properties)
vtkSMNamedPropertyIterator* propertyIt)
{
this->Internal->SetProxySettings(prefix, proxy, properties);
this->Internal->SetProxySettings(prefix, proxy, propertyIt);
}
//----------------------------------------------------------------------------
......
......@@ -80,6 +80,7 @@
#include <vector> // needed for vector.
class vtkSMProxy;
class vtkSMNamedPropertyIterator;
class VTKPVSERVERMANAGERCORE_EXPORT vtkSMSettings : public vtkObject
......@@ -176,17 +177,15 @@ public:
// Description:
// Save non-default settings in the current user settings.
// If 'properties' is not NULL and not empty, only the listed
// properties are saved
// If 'propertyIt' is not NULL, only the listed properties are saved
void SetProxySettings(vtkSMProxy* proxy,
const std::vector<std::string>* properties = NULL);
vtkSMNamedPropertyIterator* propertyIt = NULL);
// Description:
// Save non-default settings in the current user settings under the given prefix.
// If 'properties' is not NULL and not empty, only the listed
// properties are saved
// If 'propertyIt' is not NULL, only the listed properties are saved
void SetProxySettings(const char* prefix, vtkSMProxy* proxy,
const std::vector<std::string>* properties = NULL);
vtkSMNamedPropertyIterator* propertyIt = NULL);
// Description:
// Set the description of a setting.
......
......@@ -37,6 +37,7 @@ set (Module_SRCS
vtkSMDirectoryProxy.cxx
vtkSMExporterProxy.cxx
vtkSMInteractionUndoStackBuilder.cxx
vtkSMInteractiveSelectionPipeline.cxx
vtkSMMultiServerSourceProxy.cxx
vtkSMPropertyModificationUndoElement.cxx
vtkSMProxyConfigurationReader.cxx
......
/*=========================================================================
Program: ParaView
Module: $RCSfile$
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkSMInteractiveSelectionPipeline.h"
#include "vtkCallbackCommand.h"
#include "vtkCommand.h"
#include "vtkNew.h"
#include "vtkObjectFactory.h"
#include "vtkProcessModule.h"
#include "vtkSMInputProperty.h"
#include "vtkSMPropertyHelper.h"
#include "vtkSMProxy.h"
#include "vtkSMProxyManager.h"
#include "vtkSMRenderViewProxy.h"
#include "vtkSMSettings.h"
#include "vtkSMSessionProxyManager.h"
#include "vtkSMSourceProxy.h"
vtkStandardNewMacro(vtkSMInteractiveSelectionPipeline);
//----------------------------------------------------------------------------
vtkSMInteractiveSelectionPipeline::vtkSMInteractiveSelectionPipeline() :
ExtractInteractiveSelection(NULL),
SelectionRepresentation(NULL),
PreviousView(NULL),
ColorObserver(NULL),
ConnectionObserver(NULL)
{
this->ConnectionObserver = vtkCallbackCommand::New();
this->ConnectionObserver->SetCallback(
&vtkSMInteractiveSelectionPipeline::OnConnectionClosed);
this->ConnectionObserver->SetClientData(this);
vtkProcessModule* pm = vtkProcessModule::GetProcessModule();
pm->AddObserver(vtkCommand::ConnectionClosedEvent, this->ConnectionObserver);
}
//----------------------------------------------------------------------------
vtkSMInteractiveSelectionPipeline::~vtkSMInteractiveSelectionPipeline()
{
this->OnConnectionClosed();
if (this->ConnectionObserver)
{
this->ConnectionObserver->Delete();
}
}
//----------------------------------------------------------------------------
void vtkSMInteractiveSelectionPipeline::OnConnectionClosed(
vtkObject*, unsigned long, void* clientdata, void *)
{
vtkSMInteractiveSelectionPipeline* This =
static_cast<vtkSMInteractiveSelectionPipeline*>(clientdata);
This->OnConnectionClosed();
}
//----------------------------------------------------------------------------
void vtkSMInteractiveSelectionPipeline::OnConnectionClosed()
{
if (this->ExtractInteractiveSelection)
{
this->ExtractInteractiveSelection->Delete();
this->ExtractInteractiveSelection = NULL;
}
if (this->SelectionRepresentation)
{
this->SelectionRepresentation->Delete();
this->SelectionRepresentation = NULL;
}
this->PreviousView = NULL;
if (this->ColorObserver)
{
this->ColorObserver->Delete();
this->ColorObserver = NULL;
}
}
//----------------------------------------------------------------------------
vtkSMSourceProxy* vtkSMInteractiveSelectionPipeline::ConnectPVExtractSelection(
vtkSMSourceProxy* source, unsigned int sourceOutputPort,
vtkSMSourceProxy* selection)
{
vtkSMSessionProxyManager* proxyManager =
vtkSMProxyManager::GetProxyManager()->GetActiveSessionProxyManager();
vtkSMSourceProxy* extract = NULL;
if (! this->ExtractInteractiveSelection)
{
extract = vtkSMSourceProxy::SafeDownCast(
proxyManager->NewProxy("filters", "PVExtractSelection"));
}
else
{
extract = this->ExtractInteractiveSelection;
}
// set the selection
vtkSMInputProperty* inputProperty = vtkSMInputProperty::SafeDownCast(
extract->GetProperty("Selection"));
inputProperty->RemoveAllProxies();
inputProperty->AddInputConnection(selection, 0);
// set the source
inputProperty = vtkSMInputProperty::SafeDownCast(
extract->GetProperty("Input"));
inputProperty->RemoveAllProxies();
inputProperty->AddInputConnection(source, sourceOutputPort);
extract->UpdateVTKObjects();
if (! this->ExtractInteractiveSelection)
{
this->ExtractInteractiveSelection = extract;
}
return extract;
}
//----------------------------------------------------------------------------
bool vtkSMInteractiveSelectionPipeline::CreateSelectionRepresentation(
vtkSMSourceProxy* extract)
{
if (! this->SelectionRepresentation)
{
vtkSMSessionProxyManager* proxyManager =
vtkSMProxyManager::GetProxyManager()->GetActiveSessionProxyManager();
vtkSMProxy* representation =
proxyManager->NewProxy("representations", "SelectionRepresentation");
vtkSMSettings * settings = vtkSMSettings::GetInstance();
settings->GetProxySettings(representation);
vtkSMPropertyHelper(representation, "Input").Set(
extract);
vtkSMPropertyHelper(representation, "Visibility").Set(1);
double color[] = {0.5, 0, 1};
vtkSMProxy* colorPalette =
proxyManager->GetProxy("global_properties", "ColorPalette");
if (! this->ColorObserver)
{
// setup a callback to set the interactive selection color
this->ColorObserver = vtkCallbackCommand::New();
this->ColorObserver->SetCallback(
&vtkSMInteractiveSelectionPipeline::OnColorModified);
this->ColorObserver->SetClientData(this);
}
if (colorPalette)
{
vtkSMProperty* colorProperty =
colorPalette->GetProperty("InteractiveSelectionColor");
colorProperty->AddObserver(
vtkCommand::ModifiedEvent, this->ColorObserver);
vtkSMPropertyHelper(colorPalette,
"InteractiveSelectionColor").Get(color, 3);
}
vtkSMPropertyHelper(representation, "Color").Set(color, 3);
representation->UpdateVTKObjects();
this->SelectionRepresentation = representation;
return true;
}
else
{
vtkSMPropertyHelper(this->SelectionRepresentation,
"Visibility").Set(true);
this->SelectionRepresentation->UpdateVTKObjects();
return false;
}
}
//----------------------------------------------------------------------------
void vtkSMInteractiveSelectionPipeline::OnColorModified(
vtkObject* source, unsigned long, void* clientdata, void *)
{
vtkSMInteractiveSelectionPipeline* This =
static_cast<vtkSMInteractiveSelectionPipeline*>(clientdata);
vtkSMProperty* property = vtkSMProperty::SafeDownCast(source);
double color[] = {0, 0, 0};
vtkSMPropertyHelper(property).Get(color, 3);
vtkSMPropertyHelper(
This->SelectionRepresentation, "Color").Set(color, 3);
This->SelectionRepresentation->UpdateVTKObjects();
}
//----------------------------------------------------------------------------
void vtkSMInteractiveSelectionPipeline::Hide(vtkSMRenderViewProxy* view)
{
if (this->SelectionRepresentation)
{
vtkSMPropertyHelper(this->SelectionRepresentation, "Visibility").Set(0);
this->SelectionRepresentation->UpdateVTKObjects();
view->StillRender();
}
}
//----------------------------------------------------------------------------
void vtkSMInteractiveSelectionPipeline::Show(
vtkSMSourceProxy* sourceRepresentation,
vtkSMSourceProxy* selection, vtkSMRenderViewProxy* view)
{
if (sourceRepresentation)
{
vtkSMPropertyHelper helper(sourceRepresentation, "Input", true);
vtkSMSourceProxy* source = vtkSMSourceProxy::SafeDownCast(
helper.GetAsProxy());
unsigned int sourceOutputPort = helper.GetOutputPort();
vtkSMSourceProxy* extract =
this->ConnectPVExtractSelection(source, sourceOutputPort, selection);
this->CreateSelectionRepresentation(extract);
if (this->PreviousView)
{
vtkSMPropertyHelper(this->PreviousView, "Representations").Remove(
this->SelectionRepresentation);
this->PreviousView->UpdateVTKObjects();
}
vtkSMPropertyHelper(view, "Representations").Add(
this->SelectionRepresentation);
view->UpdateVTKObjects();
view->StillRender();
this->PreviousView = view;
}
else
{
this->Hide(view);
}
}
//----------------------------------------------------------------------------
vtkSMInteractiveSelectionPipeline* vtkSMInteractiveSelectionPipeline::GetInstance()
{
static vtkSmartPointer<vtkSMInteractiveSelectionPipeline> Instance;
if (Instance.GetPointer() == NULL)
{
vtkSMInteractiveSelectionPipeline* pipeline =
vtkSMInteractiveSelectionPipeline::New();
Instance = pipeline;
pipeline->FastDelete();
}
return Instance;
}
//----------------------------------------------------------------------------
void vtkSMInteractiveSelectionPipeline::PrintSelf(ostream& os, vtkIndent indent )
{
(void)os;
(void)indent;
}
//----------------------------------------------------------------------------
vtkSMProxy* vtkSMInteractiveSelectionPipeline::GetSelectionRepresentation() const
{
return this->SelectionRepresentation;
}
/*=========================================================================
Program: Visualization Toolkit
Module: vtkSMInteractiveSelectionPipeline.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkSMInteractiveSelectionPipeline -- Pipeline for interactive selection
//
// .SECTION Description
// Interactive selection enables the user to inspect cells/points before he
// decides to select them. The user moves the mouse cursor over a cell, can
// inspect attributes of the cell and can select the cell by clicking on it.
// This is a global object that holds the pipeline for showing the interactive
// selection.
#ifndef __vtkSMInteractiveSelectionPipeline_h
#define __vtkSMInteractiveSelectionPipeline_h
#include "vtkPVServerManagerDefaultModule.h" //needed for exports
#include "vtkObject.h"
// Forward declarations
class vtkCallbackCommand;
class vtkSMProxy;
class vtkSMRenderViewProxy;
class vtkSMSourceProxy;
class VTKPVSERVERMANAGERDEFAULT_EXPORT vtkSMInteractiveSelectionPipeline : public vtkObject
{
public:
static vtkSMInteractiveSelectionPipeline* New();
vtkTypeMacro(vtkSMInteractiveSelectionPipeline,vtkObject);
void PrintSelf(ostream& os, vtkIndent indent );
static vtkSMInteractiveSelectionPipeline* GetInstance();
vtkSMProxy* GetSelectionRepresentation() const;
// Description:
// Shows the interactive selection for 'selection' and 'sourceRepresentation'.
// If either sourceRepresentation or selection are null it hides the
// interactive selection.
void Show(vtkSMSourceProxy* sourceRepresentation,
vtkSMSourceProxy* selection, vtkSMRenderViewProxy* view);
// Description:
// Hides the interactive selection
void Hide(vtkSMRenderViewProxy* view);
protected:
vtkSMInteractiveSelectionPipeline();
~vtkSMInteractiveSelectionPipeline();
static void OnColorModified(
vtkObject* source, unsigned long eid, void* clientdata, void *calldata);
static void OnConnectionClosed(
vtkObject* source, unsigned long eid, void* clientdata, void *calldata);
void OnConnectionClosed();
vtkSMSourceProxy* ConnectPVExtractSelection(
vtkSMSourceProxy* source, unsigned int sourceOutputPort,
vtkSMSourceProxy* selection);
bool CreateSelectionRepresentation(vtkSMSourceProxy* extract);
private:
// Not implemented
vtkSMInteractiveSelectionPipeline(
const vtkSMInteractiveSelectionPipeline&); // Not implemented
void operator=(const vtkSMInteractiveSelectionPipeline&); // Not implemented
protected:
vtkSMSourceProxy* ExtractInteractiveSelection;
vtkSMProxy* SelectionRepresentation;
vtkSMRenderViewProxy* PreviousView;
vtkCallbackCommand* ColorObserver;
vtkCallbackCommand* ConnectionObserver;
};
#endif
......@@ -2262,6 +2262,16 @@
<Documentation>Color used for showing selected
cells/points.</Documentation>
</DoubleVectorProperty>
<DoubleVectorProperty default_values="0.5 0.0 1.0"
label="Interactive Selection"
name="InteractiveSelectionColor"
number_of_elements="3"
panel_widget="color_selector">
<DoubleRangeDomain max="1 1 1"
min="0 0 0"
name="range" />
<Documentation>Color used for showing interactive selection.</Documentation>
</DoubleVectorProperty>
<Property name="LoadPalette"
panel_widget="color_palette_selector">
<Documentation>
......
......@@ -5145,17 +5145,6 @@
proxygroup="representations"
proxyname="DataLabelRepresentation" />
<ExposedProperties>
<Property name="PointFieldDataArrayName" />
<Property name="PointLabelBold" />
<Property name="PointLabelColor" />
<Property name="PointLabelFontFamily" />
<Property name="PointLabelFontSize" />
<Property name="PointLabelFormat" />
<Property name="PointLabelItalic" />
<Property name="PointLabelJustification" />
<Property name="PointLabelOpacity" />
<Property name="PointLabelShadow" />
<Property name="PointLabelVisibility" />
<Property name="CellFieldDataArrayName" />
<Property name="CellLabelBold" />
<Property name="CellLabelColor" />
......@@ -5167,8 +5156,42 @@
<Property name="CellLabelOpacity" />
<Property name="CellLabelShadow" />
<Property name="CellLabelVisibility" />
<Property name="PointFieldDataArrayName" />
<Property name="PointLabelBold" />
<Property name="PointLabelColor" />
<Property name="PointLabelFontFamily" />
<Property name="PointLabelFontSize" />
<Property name="PointLabelFormat" />
<Property name="PointLabelItalic" />
<Property name="PointLabelJustification" />
<Property name="PointLabelOpacity" />
<Property name="PointLabelShadow" />
<Property name="PointLabelVisibility" />
</ExposedProperties>
</SubProxy>
<PropertyGroup label="Cell Label Font" panel_visibility="never" panel_widget="FontEditor">
<Property name="CellLabelBold" function="Bold"/>
<Property name="CellLabelColor" function="Color"/>
<Property name="CellLabelFontFamily" function="Family"/>
<Property name="CellLabelFontSize" function="Size"/>
<Property name="CellLabelItalic" function="Italics"/>
<Property name="CellLabelJustification" function="Justification"/>
<Property name="CellLabelOpacity" function="Opacity"/>
<Property name="CellLabelShadow" function="Shadow"/>
</PropertyGroup>
<PropertyGroup label="Point Label Font" panel_visibility="never" panel_widget="FontEditor">
<Property name="PointLabelBold" function="Bold"/>
<Property name="PointLabelColor" function="Color"/>
<Property name="PointLabelFontFamily" function="Family"/>
<Property name="PointLabelFontSize" function="Size"/>
<Property name="PointLabelItalic" function="Italics"/>
<Property name="PointLabelJustification" function="Justification"/>