Commit d3925380 authored by T.J. Corona's avatar T.J. Corona Committed by Kitware Robot

Merge topic 'move-selection-rep-setup-to-xml'

eb68317d vtkSMPVRepresentationProxy: add hint to change selection port
974fd526 vtkSIPVRepresentationProxy: move selection rep. construction to xml
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Utkarsh Ayachit's avatarUtkarsh Ayachit <utkarsh.ayachit@kitware.com>
Merge-request: !3487
parents 60454ee0 eb68317d
......@@ -59,17 +59,6 @@ vtkSIPVRepresentationProxy::~vtkSIPVRepresentationProxy()
//----------------------------------------------------------------------------
bool vtkSIPVRepresentationProxy::ReadXMLAttributes(vtkPVXMLElement* element)
{
vtkPVCompositeRepresentation* pvrepresentation =
vtkPVCompositeRepresentation::SafeDownCast(this->GetVTKObject());
// Pass on the selection-representation
if (vtkSIProxy* siProxy = this->GetSubSIProxy("SelectionRepresentation"))
{
vtkSelectionRepresentation* selection =
vtkSelectionRepresentation::SafeDownCast(siProxy->GetVTKObject());
pvrepresentation->SetSelectionRepresentation(selection);
}
// Update internal data-structures for the types of representations provided
// by this instance.
......@@ -98,8 +87,11 @@ bool vtkSIPVRepresentationProxy::ReadXMLAttributes(vtkPVXMLElement* element)
}
// Add each of the sub-representations to the composite representation.
pvrepresentation->AddRepresentation(
text, vtkPVDataRepresentation::SafeDownCast(subproxy->GetVTKObject()));
vtkClientServerStream stream;
stream << vtkClientServerStream::Invoke << this->GetVTKObject() << "AddRepresentation" << text
<< vtkPVDataRepresentation::SafeDownCast(subproxy->GetVTKObject())
<< vtkClientServerStream::End;
this->Interpreter->ProcessStream(stream);
//// read optional subtype.
const char* sub_text = child->GetAttribute("subtype");
......@@ -123,8 +115,14 @@ bool vtkSIPVRepresentationProxy::ReadXMLAttributes(vtkPVXMLElement* element)
//----------------------------------------------------------------------------
void vtkSIPVRepresentationProxy::OnVTKObjectModified()
{
vtkCompositeRepresentation* repr = vtkCompositeRepresentation::SafeDownCast(this->GetVTKObject());
const char* key = repr->GetActiveRepresentationKey();
const char* key;
{
vtkClientServerStream stream;
stream << vtkClientServerStream::Invoke << this->GetVTKObject() << "GetActiveRepresentationKey"
<< vtkClientServerStream::End;
this->Interpreter->ProcessStream(stream);
this->Interpreter->GetLastResult().GetArgument(0, 0, &key);
}
vtkInternals::RepresentationProxiesType::iterator iter = key
? this->Internals->RepresentationProxies.find(key)
: this->Internals->RepresentationProxies.end();
......
......@@ -122,7 +122,15 @@ void vtkSMPVRepresentationProxy::SetPropertyModifiedFlag(const char* name, int f
}
else
{
vtkSMPropertyHelper(selectionRepr, "Input").Set(esProxy);
int port = 0;
if (vtkPVXMLElement* hints = selectionRepr->GetHints()
? selectionRepr->GetHints()->FindNestedElementByName("ConnectToPortIndex")
: nullptr)
{
hints->GetScalarAttribute("value", &port);
}
vtkSMPropertyHelper(selectionRepr, "Input").Set(esProxy, port);
selectionRepr->UpdateVTKObjects();
}
}
......
......@@ -3988,7 +3988,7 @@
<ProxyEditorPropertyWidget property="GridAxesVisibility" />
</Hints>
</ProxyProperty>
<SubProxy>
<SubProxy command="SetSelectionRepresentation">
<Proxy name="SelectionRepresentation"
proxygroup="representations"
proxyname="SelectionRepresentation" />
......
......@@ -314,3 +314,19 @@ true if the algorithm needs update.
The `interval` attribute is optional (defaults to 100) and can be used to
provide a refresh rate in milliseconds.
ConnectToPortIndex
--------------------------
Connect to a specific port index.
This is used to connect a representation to an output port of a filter
other than the default (index = 0). Currently, this is only used to
modify the input port for the selection representation subproxy in
vtkSMPVRepresentationProxy.
<RepresentationProxy ...>
...
<Hints>
<ConnectToPortIndex value="2" />
</Hints>
</RepresentationProxy>
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