[Paraview] How to pass array from Server to Client with as 'Information Helper"
Michael Jackson
mike.jackson at bluequartz.net
Fri Mar 26 15:23:39 EDT 2010
I have a custom reader. Part of the reader is getting a "NeighborList"
which is an vtkIntArray object although I have declared the following
methods in my "reader" class:
int* GetNeighborList();
void GetNeighborList(int* list);
vtkIdType GetNumberOfNeighbors();
And in my ServerManagerXML file I have the following:
<IntVectorProperty name="NeighborList"
command="GetNeighborList"
argument_is_array="1"
number_of_elements="0"
repeat_command="0"
number_of_elements_per_command="1"
use_index="0" >
<SimpleIntInformationHelper />
<Documentation>
This property lists the neighbors of the grain
</Documentation>
</IntVectorProperty>
On the Client side I have the following bit of code to populate a
QListWidget:
void pqH5TiDataReaderPanel::updateNeighborList(QListWidget*
qListWidget, QString property)
{
vtkSMProperty* smProperty = this->proxy()-
>GetProperty(property.toAscii());
if (NULL == smProperty)
{
std::string msg = "SMProperty [int] was NULL for ";
msg.append(property.toAscii() );
DebugTrace(<< msg.c_str() );
return;
}
vtkSMIntVectorProperty* intProperty
= vtkSMIntVectorProperty::SafeDownCast(smProperty);
if (NULL == intProperty)
{
std::string msg = "Could not SafeDownCase to
vtkSMIntVectorProperty for property ";
msg.append(property.toAscii() );
DebugTrace(<< msg.c_str() );
return;
}
//intProperty->GetArgumentIsArray();
int* elements = intProperty->GetElements();
int nElements = intProperty->GetNumberOfElements(); //<== ALWAYS 0
qListWidget->clear(); // Remove all the content
for (int i = 0; i < nElements; ++i)
{
qListWidget->addItem(QString::number(elements[i])); //<==== NEVER
GETS HERE
}
}
So, what am I doing wrong? I have tried reading through the relevant
sections of the "ParaView Guide" but nothing is really jumping out.
Also went looking for examples somewhere in the ParaView source code
but came up empty. The ContourWidget is close but it "sends" its
array, it never receives one from the server.
Any pointers would be great and much appreciated.
___________________________________________________________
Mike Jackson www.bluequartz.net
Principal Software Engineer mike.jackson at bluequartz.net
BlueQuartz Software Dayton, Ohio
More information about the ParaView
mailing list