...
 
Commits (2)
......@@ -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();
}
}
......
......@@ -3948,7 +3948,7 @@
<ProxyEditorPropertyWidget property="GridAxesVisibility" />
</Hints>
</ProxyProperty>
<SubProxy>
<SubProxy command="SetSelectionRepresentation">
<Proxy name="SelectionRepresentation"
proxygroup="representations"
proxyname="SelectionRepresentation" />
......
......@@ -246,3 +246,22 @@ For that, one simply adds a hint to the proxy as follows:
The algorithm subclass must have `bool GetNeedsUpdate()` method that returns
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>