Commit 9beba2ad authored by Mathieu Westphal's avatar Mathieu Westphal

Better Representation Hints Management

This ensure representation hints are taken into account
before trying prototypes
parent b565cb87
......@@ -457,6 +457,34 @@ const char* vtkSMRenderViewProxy::GetRepresentationType(vtkSMSourceProxy* produc
return reprName;
}
if (vtkPVXMLElement* hints = producer->GetHints())
{
// If the source has an hint as follows, then it's a text producer and must
// be display-able.
// <Hints>
// <OutputPort name="..." index="..." type="text" />
// </Hints>
for (unsigned int cc = 0, max = hints->GetNumberOfNestedElements(); cc < max; cc++)
{
int index;
vtkPVXMLElement* child = hints->GetNestedElement(cc);
const char* childName = child->GetName();
const char* childType = child->GetAttribute("type");
if (childName && strcmp(childName, "OutputPort") == 0 &&
child->GetScalarAttribute("index", &index) && index == outputPort && childType)
{
if (strcmp(childType, "text") == 0)
{
return "TextSourceRepresentation";
}
else if (strcmp(childType, "progress") == 0)
{
return "ProgressBarSourceRepresentation";
}
}
}
}
vtkSMSessionProxyManager* pxm = this->GetSessionProxyManager();
const char* representationsToTry[] = { "UnstructuredGridRepresentation",
"StructuredGridRepresentation", "UniformGridRepresentation", "AMRRepresentation",
......@@ -498,35 +526,6 @@ const char* vtkSMRenderViewProxy::GetRepresentationType(vtkSMSourceProxy* produc
}
}
}
if (vtkPVXMLElement* hints = producer->GetHints())
{
// If the source has an hint as follows, then it's a text producer and must
// be display-able.
// <Hints>
// <OutputPort name="..." index="..." type="text" />
// </Hints>
for (unsigned int cc = 0, max = hints->GetNumberOfNestedElements(); cc < max; cc++)
{
int index;
vtkPVXMLElement* child = hints->GetNestedElement(cc);
const char* childName = child->GetName();
if (childName && strcmp(childName, "OutputPort") == 0 &&
child->GetScalarAttribute("index", &index) && index == outputPort &&
child->GetAttribute("type"))
{
if (strcmp(child->GetAttribute("type"), "text") == 0)
{
return "TextSourceRepresentation";
}
else if (strcmp(child->GetAttribute("type"), "progress") == 0)
{
return "ProgressBarSourceRepresentation";
}
}
}
}
return NULL;
}
......
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