Commit b58cd95c authored by T.J. Corona's avatar T.J. Corona

Move ParaView selection conversion to server

parent 77cd868e
Pipeline #143942 failed with stage
## Move ParaView selection logic to the server
This update deals with the logic that converts ParaView selections to SMTK
selections. Originally, this selection logic occurred using a Qt
signal/slot that subsequently pierced client/server to access rendered
data. With this update, the logic has been moved to the server to
avoid additional client/server transgressions.
......@@ -61,15 +61,6 @@ pqSMTKResourceRepresentation::~pqSMTKResourceRepresentation()
}
}
void pqSMTKResourceRepresentation::initialize()
{
auto proxy = vtkSMSMTKResourceRepresentationProxy::SafeDownCast(this->getProxy());
if (proxy)
proxy->ConnectAdditionalPorts();
pqPipelineRepresentation::initialize();
}
void pqSMTKResourceRepresentation::handleSMTKSelectionChange(
const std::string& src, smtk::view::SelectionPtr seln)
{
......
......@@ -46,8 +46,6 @@ protected slots:
protected:
virtual void handleSMTKSelectionChange(const std::string& src, smtk::view::SelectionPtr seln);
void initialize() override;
smtk::view::WeakSelectionPtr m_seln;
smtk::view::SelectionObservers::Key m_selnObserver;
};
......
......@@ -16,10 +16,6 @@
#include "smtk/extension/paraview/server/vtkSMTKResourceSource.h"
#include "smtk/extension/paraview/server/vtkSMTKWrapper.h"
#include "smtk/extension/vtk/source/vtkModelMultiBlockSource.h" // TODO: remove need for me
#include "smtk/view/Selection.h"
#include "smtk/io/Logger.h"
#include "smtk/resource/Component.h"
......@@ -39,14 +35,6 @@
#include "vtkSMSourceProxy.h"
// Server side (TODO: Remove need for me)
#include "vtkCompositeDataIterator.h"
#include "vtkMultiBlockDataSet.h"
#include "vtkPVSelectionSource.h"
#include "vtkSelection.h"
#include "vtkSelectionNode.h"
#include "vtkUnsignedIntArray.h"
#include <iostream>
#define DEBUG_WRAPPER 0
......@@ -55,35 +43,14 @@ pqSMTKWrapper::pqSMTKWrapper(const QString& regGroup, const QString& regName, vt
pqServer* server, QObject* parent)
: Superclass(regGroup, regName, proxy, server, parent)
{
// I. Listen for PV selections and convert them to SMTK selections
#if !defined(NDEBUG) && DEBUG_WRAPPER
std::cout << "pqResourceManager ctor " << parent << "\n";
#endif
bool listening = false;
auto app = pqApplicationCore::instance();
if (app)
{
auto pvSelnMgr = qobject_cast<pqSelectionManager*>(app->manager("SelectionManager"));
if (pvSelnMgr)
{
if (QObject::connect(pvSelnMgr, SIGNAL(selectionChanged(pqOutputPort*)), this,
SLOT(paraviewSelectionChanged(pqOutputPort*))))
{
listening = true;
}
}
}
if (!listening)
{
smtkErrorMacro(smtk::io::Logger::instance(),
"Could not connect SMTK resource manager to ParaView selection manager.");
}
// II. Listen for operation events and signal them.
// Note that what we **should** be doing is listening for these
// events on a client-side operation manager used to forward
// operations to the server. What we in fact do only works for
// the built-in mode. TODO: Fix this. Remove the need for me.
// I. Listen for operation events and signal them.
// Note that what we **should** be doing is listening for these
// events on a client-side operation manager used to forward
// operations to the server. What we in fact do only works for
// the built-in mode. TODO: Fix this. Remove the need for me.
auto pxy = vtkSMSMTKWrapperProxy::SafeDownCast(this->getProxy());
auto wrapper = vtkSMTKWrapper::SafeDownCast(pxy->GetClientSideObject());
if (wrapper)
......@@ -205,125 +172,3 @@ void pqSMTKWrapper::removeResource(pqSMTKResource* rsrc)
pxy->RemoveResourceProxy(rsrc->getSourceProxy());
}
}
void pqSMTKWrapper::paraviewSelectionChanged(pqOutputPort* port)
{
/* TODO: This needs to be completed to work with separate server processes.
auto pxy = this->wrapperProxy();
(void)pxy;
if (!port)
{
pxy->modifySelection(seln, m_selectionSource, m_selectedValue);
std::cout << "FIXME: Reset selection when port is null\n";
return;
}
// I. Get vtkSelection source proxy ID
auto dataInput = port->getSourceProxy();
auto selnInput = port->getSelectionInput();
// II. Set it as an input on the vtkSMTKWrapper's SelectionPort
pxy->SetSelectedPortProxy(dataInput);
pxy->SetSelectionObjProxy(selnInput);
// III. Send a JSON request to the vtkSMTKWrapper telling it to grab the selection.
pxy->FetchHardwareSelection();
// IV. Update the client-side selection.
// TODO
*/
// TODO: This only works in built-in mode.
auto wrapper = vtkSMTKWrapper::SafeDownCast(this->getProxy()->GetClientSideObject());
auto selnMgr = wrapper ? wrapper->GetSelection() : nullptr;
if (!selnMgr)
{
smtkErrorMacro(smtk::io::Logger::instance(), "No selection manager!");
return;
}
std::string selnSrc = wrapper->GetSelectionSource();
int selnVal = wrapper->GetSelectedValue();
std::set<smtk::resource::ComponentPtr> seln;
if (!port)
{
//std::cout << "Selection empty\n";
selnMgr->modifySelection(seln, selnSrc, selnVal);
}
else
{
auto dataInput = port->getSourceProxy();
auto dataThing = dataInput->GetClientSideObject();
auto smtkThing = dynamic_cast<vtkSMTKResourceSource*>(dataThing);
auto mbdsThing = smtkThing ? smtkThing->GetOutput() : nullptr;
auto selnInput = port->getSelectionInput();
vtkPVSelectionSource* selnThing =
selnInput ? dynamic_cast<vtkPVSelectionSource*>(selnInput->GetClientSideObject()) : nullptr;
if (selnThing)
{
selnThing->Update();
}
auto selnBlock = selnThing ? selnThing->GetOutput() : nullptr;
unsigned nn = selnBlock ? selnBlock->GetNumberOfNodes() : 0;
/*
std::cout
<< "Selection input " << selnInput
<< " client side " << selnThing
<< " seln nodes " << nn
<< " data thing " << dataThing << " " << dataThing->GetClassName()
<< "\n";
*/
for (unsigned ii = 0; ii < nn; ++ii)
{
auto selnNode = selnBlock->GetNode(ii);
if (selnNode->GetContentType() == vtkSelectionNode::BLOCKS)
{
//vtkIndent indent;
//selnNode->PrintSelf(std::cout, indent);
/*
auto selnInfo = selnNode->GetProperties();
auto selnProp = selnInfo->Has(vtkSelectionNode::vtkSelectionNode::PROP_ID()) ?
selnInfo->Get(vtkSelectionNode::PROP_ID()) : -2;
auto selnHLvl = selnInfo->Has(vtkSelectionNode::HIERARCHICAL_LEVEL()) ?
selnInfo->Get(vtkSelectionNode::HIERARCHICAL_LEVEL()) : -2;
auto selnHier = selnInfo->Has(vtkSelectionNode::HIERARCHICAL_INDEX()) ?
selnInfo->Get(vtkSelectionNode::HIERARCHICAL_INDEX()) : -2;
auto selnComp = selnInfo->Has(vtkSelectionNode::COMPOSITE_INDEX()) ?
selnInfo->Get(vtkSelectionNode::COMPOSITE_INDEX()) : -2;
auto selnSrcI = selnInfo->Has(vtkSelectionNode::SOURCE_ID()) ?
selnInfo->Get(vtkSelectionNode::SOURCE_ID()) : -2;
auto selnDObj = selnInfo->Get(vtkSelectionNode::SOURCE());
std::cout << " seln prop id " << selnProp << " hier " << selnHLvl << " " << selnHier << " composite id " << selnComp << " src id " << selnSrcI << " data obj " << (selnDObj ? selnDObj->GetClassName() : "null") << "\n";
*/
auto selnList = dynamic_cast<vtkUnsignedIntArray*>(selnNode->GetSelectionList());
unsigned mm = selnList->GetNumberOfValues();
//std::cout << " seln list " << mm << " (";
std::set<unsigned> blockIds;
for (unsigned jj = 0; jj < mm; ++jj)
{
//std::cout << " " << selnList->GetValue(jj);
blockIds.insert(selnList->GetValue(jj));
}
//std::cout << " )\n";
if (mbdsThing)
{
smtk::resource::ResourcePtr resource = smtkThing->GetVTKResource()->GetResource();
if (resource)
{
//std::cout << " selected components:";
auto mit = mbdsThing->NewIterator();
for (mit->InitTraversal(); !mit->IsDoneWithTraversal(); mit->GoToNextItem())
{
if (blockIds.find(mit->GetCurrentFlatIndex()) != blockIds.end())
{
auto cmp = resource->find(
vtkModelMultiBlockSource::GetDataObjectUUID(mit->GetCurrentMetaData()));
if (cmp)
{
seln.insert(seln.end(), cmp);
}
//std::cout << ", " << cmp->name();
}
}
//std::cout << "\n";
selnMgr->modifySelection(seln, selnSrc, selnVal);
}
}
}
}
}
}
......@@ -91,9 +91,6 @@ signals:
void operationEvent(smtk::operation::Operation::Ptr op, smtk::operation::EventType event,
smtk::operation::Operation::Result result);
protected slots:
virtual void paraviewSelectionChanged(pqOutputPort* port);
protected:
std::set<QPointer<pqSMTKResource> > m_resources;
......
......@@ -16,12 +16,14 @@ set(serverXMLSrcs
set(serverWrappedSrcs
vtkPVModelSources.cxx
vtkSMTKCompositeRepresentation.cxx
vtkSMTKResource.cxx
vtkSMTKResourceCreator.cxx
vtkSMTKResourceGenerator.cxx
vtkSMTKResourceImporter.cxx
vtkSMTKResourceReader.cxx
vtkSMTKResourceSource.cxx
vtkSMTKSelectionRepresentation.cxx
vtkSMTKSettings.cxx
vtkSMSMTKWrapperProxy.cxx
vtkSMTKWrapper.cxx
......@@ -31,12 +33,14 @@ set(serverWrappedSrcs
set(serverWrappedHdrs
vtkPVModelSources.h
vtkSMTKCompositeRepresentation.h
vtkSMTKResource.h
vtkSMTKResourceCreator.h
vtkSMTKResourceGenerator.h
vtkSMTKResourceImporter.h
vtkSMTKResourceReader.h
vtkSMTKResourceSource.h
vtkSMTKSelectionRepresentation.h
vtkSMTKSettings.h
vtkSMSMTKWrapperProxy.h
vtkSMTKWrapper.h
......
......@@ -1558,13 +1558,61 @@
<!-- End of SMTKResourceRepresentation -->
</RepresentationProxy>
<!-- ================================================================== -->
<RepresentationProxy class="vtkSMTKSelectionRepresentation"
name="SMTKSelectionRepresentation"
processes="client|renderserver|dataserver"
si_class="vtkSIProxy">
<Documentation>Proxy to show a selection as geometry.</Documentation>
<InputProperty command="SetInputConnection"
name="Input">
<InputArrayDomain name="input_array_any"></InputArrayDomain>
</InputProperty>
<Hints>
<ConnectToPortIndex value="2" />
</Hints>
<IntVectorProperty command="SetVisibility"
default_values="1"
name="Visibility"
number_of_elements="1">
<BooleanDomain name="bool" />
<Documentation>Get/Set the visibility of the representation.</Documentation>
</IntVectorProperty>
<DoubleVectorProperty command="SetColor"
default_values="1.0 1.0 0.0"
name="Color"
number_of_elements="3">
<DoubleRangeDomain max="1 1 1"
min="0 0 0"
name="range" />
<Hints>
<GlobalPropertyLink type="ColorPalette" property="SelectionColor" />
</Hints>
</DoubleVectorProperty>
<DoubleVectorProperty command="SetLineWidth"
default_values="2.0"
name="LineWidth"
number_of_elements="1">
<DoubleRangeDomain min="0"
name="range" />
</DoubleVectorProperty>
<DoubleVectorProperty command="SetPointSize"
default_values="5.0"
name="PointSize"
number_of_elements="1">
<DoubleRangeDomain min="0"
name="range" />
</DoubleVectorProperty>
<!-- End of SMTKSelectionRepresentation -->
</RepresentationProxy>
<!-- ====================================================================== -->
<SMTKResourceRepresentationProxy name="SMTKResourceCompositeRepresentation"
class="vtkPVCompositeRepresentation"
class="vtkSMTKCompositeRepresentation"
processes="client|dataserver|renderserver">
<Documentation>SMTK's default representation. It is a stripped down
version of PVRepresentationBase (selection is handled by
SMTKResourceRepresentation).</Documentation>
version of PVRepresentationBase.</Documentation>
<InputProperty command="SetInputConnection"
name="Input">
......@@ -1616,6 +1664,14 @@
set. If ForcedCacheKey is true, it overrides UseCache and CacheKey.
Instead, ForcedCacheKey is used.</Documentation>
</DoubleVectorProperty>
<IntVectorProperty command="SetSelectionVisibility"
default_values="1"
name="SelectionVisibility"
number_of_elements="1"
panel_visibility="never">
<BooleanDomain name="bool" />
<Documentation>Set the visibility for the selection, if any.</Documentation>
</IntVectorProperty>
<RepresentationType subproxy="SMTKResourceRepresentation"
subtype="Surface"
text="Surface"/>
......@@ -1763,8 +1819,6 @@
panel_visibility="never" />
<Property name="HoverColor"
panel_visibility="never" />
<Property name="SelectionColor"
panel_visibility="never" />
<Property name="DefaultFaceColor"
panel_visibility="never" />
<Property name="DefaultEdgeColor"
......@@ -1781,6 +1835,16 @@
<Exception name="Visibility" />
</ShareProperties>
</SubProxy>
<SubProxy command="SetSelectionRepresentation">
<Proxy name="SelectionRepresentation"
proxygroup="representations"
proxyname="SMTKSelectionRepresentation" />
<ExposedProperties>
<Property exposed_name="SelectionColor" name="Color" panel_visibility="never" />
<Property exposed_name="SelectionPointSize" name="PointSize" panel_visibility="never" />
<Property exposed_name="SelectionLineWidth" name="LineWidth" panel_visibility="never" />
</ExposedProperties>
</SubProxy>
</SMTKResourceRepresentationProxy>
<!-- Widget representations -->
......
......@@ -30,38 +30,7 @@ void vtkSMSMTKResourceRepresentationProxy::PrintSelf(ostream& os, vtkIndent inde
this->Superclass::PrintSelf(os, indent);
}
void vtkSMSMTKResourceRepresentationProxy::ConnectAdditionalPorts()
{
vtkSMPropertyHelper helper(this, "Input");
vtkSMSourceProxy* input = vtkSMSourceProxy::SafeDownCast(helper.GetAsProxy(0));
if (input)
{
auto source = vtkSMSourceProxy::SafeDownCast(input->GetTrueParentProxy());
if (source)
{
vtkSMProxy* repProxy = this->GetSubProxy("SMTKResourceRepresentation");
if (repProxy)
{
vtkSMPropertyHelper(repProxy, "GlyphPrototypes", true).Set(source, 1);
vtkSMPropertyHelper(repProxy, "GlyphPoints", true).Set(source, 2);
this->InitializedInputs = true;
repProxy->UpdateVTKObjects();
}
}
}
}
vtkSMProxy* vtkSMSMTKResourceRepresentationProxy::GetResourceRepresentationSubProxy()
{
return this->GetSubProxy("SMTKResourceRepresentation");
}
void vtkSMSMTKResourceRepresentationProxy::SetPropertyModifiedFlag(const char* name, int flag)
{
if (!this->InitializedInputs && strcmp(name, "Input"))
{
this->ConnectAdditionalPorts();
}
this->Superclass::SetPropertyModifiedFlag(name, flag);
}
......@@ -12,9 +12,6 @@
*
* This is a proxy for a vtkPVCompositeRepresentation which parents a
* vtkSMTKResourceRepresentation.
*
* Updates additional input properties of the representation
* (GlyphPrototypes and GlyphPoints).
*/
#ifndef smtk_extension_paraview_representation_vtkSMSMTKResourceRepresentationProxy_h
#define smtk_extension_paraview_representation_vtkSMSMTKResourceRepresentationProxy_h
......@@ -40,21 +37,6 @@ protected:
friend class pqSMTKResourceRepresentation;
/**
* Connects additional input ports required by the representation (instance
* placement inputs).
*/
void ConnectAdditionalPorts();
/**
* Ensures that whenever the "Input" property changes, ConnectAdditionalPorts
* is called. This is critical in cases when pqSMTKResourceRepresentation has not
* been constructed (e.g. Python invocations of SMTKResourceRepresentation).
*/
void SetPropertyModifiedFlag(const char* name, int flag) override;
bool InitializedInputs = false;
private:
vtkSMSMTKResourceRepresentationProxy(const vtkSMSMTKResourceRepresentationProxy&) = delete;
void operator=(const vtkSMSMTKResourceRepresentationProxy&) = delete;
......
//=========================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt 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.
//=========================================================================
#ifndef smtk_extension_paraview_representation_vtkSMTKCompositeRepresentation_h
#define smtk_extension_paraview_representation_vtkSMTKCompositeRepresentation_h
/**
* @class vtkSMTKCompositeRepresentation
* @brief a data-representation used by SMTK.
*
* vtkSMTKCompositeRepresentation is nearly identical to
* vtkPVCompositeRepresentation, with one exception:
* vtkSMTKSelectionRepresentation is used in place of
* vtkSelectionRepresentation.
*/
#include "vtkCompositeRepresentation.h"
#include "smtk/extension/paraview/server/Exports.h"
class vtkPolarAxesRepresentation;
class vtkPVGridAxes3DRepresentation;
class vtkSMTKSelectionRepresentation;
class SMTKPVSERVEREXT_EXPORT vtkSMTKCompositeRepresentation
: public vtkCompositeRepresentation
{
public:
static vtkSMTKCompositeRepresentation* New();
vtkTypeMacro(vtkSMTKCompositeRepresentation, vtkCompositeRepresentation);
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
/**
* These must only be set during initialization before adding the
* representation to any views or calling Update().
*/
void SetSelectionRepresentation(vtkSMTKSelectionRepresentation*);
void SetGridAxesRepresentation(vtkPVGridAxes3DRepresentation*);
/**
* This must only be set during initialization before adding the
* representation to any views or calling Update().
*/
void SetPolarAxesRepresentation(vtkPolarAxesRepresentation*);
/**
* Propagate the modification to all internal representations.
*/
void MarkModified() VTK_OVERRIDE;
/**
* Set visibility of the representation.
* Overridden to update the cube-axes and selection visibilities.
*/
void SetVisibility(bool visible) VTK_OVERRIDE;
/**
* Set the selection visibility.
*/
virtual void SetSelectionVisibility(bool visible);
/**
* Set the polar axes visibility.
*/
virtual void SetPolarAxesVisibility(bool visible);
//@{
/**
* Passed on to internal representations as well.
*/
void SetUpdateTime(double time) VTK_OVERRIDE;
void SetForceUseCache(bool val) VTK_OVERRIDE;
void SetForcedCacheKey(double val) VTK_OVERRIDE;
void SetInputConnection(int port, vtkAlgorithmOutput* input) VTK_OVERRIDE;
void SetInputConnection(vtkAlgorithmOutput* input) VTK_OVERRIDE;
void AddInputConnection(int port, vtkAlgorithmOutput* input) VTK_OVERRIDE;
void AddInputConnection(vtkAlgorithmOutput* input) VTK_OVERRIDE;
void RemoveInputConnection(int port, vtkAlgorithmOutput* input) VTK_OVERRIDE;
void RemoveInputConnection(int port, int idx) VTK_OVERRIDE;
//@}
//@{
/**
* Forwarded to vtkSelectionRepresentation.
*/
virtual void SetPointFieldDataArrayName(const char*);
virtual void SetCellFieldDataArrayName(const char*);
//@}
/**
* Override because of internal composite representations that need to be
* initialized as well.
*/
unsigned int Initialize(unsigned int minIdAvailable, unsigned int maxIdAvailable) VTK_OVERRIDE;
protected:
vtkSMTKCompositeRepresentation();
~vtkSMTKCompositeRepresentation() override;
/**
* Adds the representation to the view. This is called from
* vtkView::AddRepresentation(). Subclasses should override this method.
* Returns true if the addition succeeds.
*/
bool AddToView(vtkView* view) VTK_OVERRIDE;
/**
* Removes the representation to the view. This is called from
* vtkView::RemoveRepresentation(). Subclasses should override this method.
* Returns true if the removal succeeds.
*/
bool RemoveFromView(vtkView* view) VTK_OVERRIDE;
vtkSMTKSelectionRepresentation* SelectionRepresentation;
vtkPVGridAxes3DRepresentation* GridAxesRepresentation;
vtkPolarAxesRepresentation* PolarAxesRepresentation;
bool SelectionVisibility;
private:
vtkSMTKCompositeRepresentation(const vtkSMTKCompositeRepresentation&) = delete;
void operator=(const vtkSMTKCompositeRepresentation&) = delete;
};
#endif
......@@ -892,6 +892,11 @@ void vtkSMTKResourceRepresentation::SetResource(const smtk::resource::ResourcePt
this->Resource = res;
}
smtk::resource::ResourcePtr vtkSMTKResourceRepresentation::GetResource() const
{
return this->Resource.lock();
}
void vtkSMTKResourceRepresentation::SetColorBy(const char* type)
{
if (vtksys::SystemTools::Strucmp(type, "Entity") == 0)
......
......@@ -269,6 +269,7 @@ public:
vtkGetObjectMacro(Wrapper, vtkSMTKWrapper);
void SetResource(const smtk::resource::ResourcePtr& res);
smtk::resource::ResourcePtr GetResource() const;
void GetEntityVisibilities(std::map<smtk::common::UUID, int>& visdata);
bool SetEntityVisibility(smtk::resource::PersistentObjectPtr ent, bool visible);
......
//=========================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt 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 "smtk/extension/paraview/server/vtkSMTKSelectionRepresentation.h"
#include "smtk/attribute/Attribute.h"
#include "smtk/attribute/ComponentItem.h"
#include "smtk/attribute/IntItem.h"
#include "smtk/extension/paraview/server/vtkSMTKCompositeRepresentation.h"
#include "smtk/extension/paraview/server/vtkSMTKResourceRepresentation.h"
#include "smtk/extension/paraview/server/vtkSMTKWrapper.h"
#include "smtk/extension/vtk/source/vtkModelMultiBlockSource.h"
#include "smtk/mesh/core/Resource.h"
#include "smtk/model/Resource.h"
#include "smtk/operation/Manager.h"
#include "smtk/operation/Operation.h"
#include "smtk/resource/Component.h"
#include "smtk/resource/Resource.h"
#include "smtk/view/Selection.h"
#include "vtkStreamingDemandDrivenPipeline.h"
#include "vtkAlgorithmOutput.h"
#include "vtkCellData.h"
#include "vtkCompositeDataIterator.h"
#include "vtkDataObject.h"
#include "vtkIdTypeArray.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkLabeledDataMapper.h"
#include "vtkMemberFunctionCommand.h"
#include "vtkMultiBlockDataSet.h"
#include "vtkObjectFactory.h"
#include "vtkPolyData.h"
#include "vtkSelection.h"
#include "vtkSelectionNode.h"
#include "vtkUnsignedIntArray.h"
#include "vtkView.h"
vtkStandardNewMacro(vtkSMTKSelectionRepresentation);
//----------------------------------------------------------------------------
vtkSMTKSelectionRepresentation::vtkSMTKSelectionRepresentation()
: CompositeRepresentation(nullptr)
{
}
//----------------------------------------------------------------------------
vtkSMTKSelectionRepresentation::~vtkSMTKSelectionRepresentation()
{
this->SetCompositeRepresentation(nullptr);
}
//----------------------------------------------------------------------------
void vtkSMTKSelectionRepresentation::SetCompositeRepresentation(
vtkSMTKCompositeRepresentation* compositeRepresentation)
{
this->CompositeRepresentation = compositeRepresentation;
}
//----------------------------------------------------------------------------
vtkSMTKResourceRepresentation* vtkSMTKSelectionRepresentation::GetResourceRepresentation() const
{
return this->CompositeRepresentation ? vtkSMTKResourceRepresentation::SafeDownCast(
this->CompositeRepresentation->GetActiveRepresentation()) : nullptr;
}
//----------------------------------------------------------------------------
int vtkSMTKSelectionRepresentation::FillInputPortInformation(int vtkNotUsed(port), vtkInformation* info)
{
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkDataObject");
info->Set(vtkAlgorithm::INPUT_IS_OPTIONAL(), 1);
return 1;
}
//----------------------------------------------------------------------------
void vtkSMTKSelectionRepresentation::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
}
//----------------------------------------------------------------------------
void vtkSMTKSelectionRepresentation::SetVisibility(bool val)
{
this->Superclass::SetVisibility(val);
}
//----------------------------------------------------------------------------
void vtkSMTKSelectionRepresentation::SetColor(double r, double g, double b)
{
if (auto resourceRepresentation = this->GetResourceRepresentation())
{
resourceRepresentation->SetSelectionColor(r, g, b);
}
}
//----------------------------------------------------------------------------
void vtkSMTKSelectionRepresentation::SetLineWidth(double val)
{