I have a usecase which is very similar to ArraySelectionDomain.
A vtk class define a few named entities. Each of these can be enabled or disabled.
If these were arrays, I could use ArraySelectionDomain and it will be perfect.
However, they are not arrays, but parameters to the way the data will be generated.
According to vtkSIArraySelectionProperty:70 and 89, there is no choice but to name my methods in the vtk class GetNumberOfEntityArrays
and GetEntityArrayName
vtkObjectBase* reader = this->GetVTKObject();
if (reader != NULL)
{
std::ostringstream aname;
aname << "GetNumberOf" << this->Command << "Arrays" << ends;
// Get the number of arrays.
vtkClientServerStream stream;
stream << vtkClientServerStream::Invoke << reader << aname.str().c_str()
<< vtkClientServerStream::End;
this->ProcessMessage(stream);
stream.Reset();
int numArrays = 0;
if (!this->GetLastResult().GetArgument(0, 0, &numArrays))
{
vtkErrorMacro("Error getting number of arrays from reader.");
}
// For each array, get its name and status.
for (int i = 0; i < numArrays; ++i)
{
std::ostringstream naname;
naname << "Get" << this->Command << "ArrayName" << ends;
// Get the array name.
stream << vtkClientServerStream::Invoke << reader << naname.str().c_str() << i
<< vtkClientServerStream::End;
This is not right at all, we can’t put these method in the VTK class, it would not means anything for the average VTK user for these “entities” to be postfixed by “arrays”.
There is a few possibilities :
- add incorectly named methods in VTK
- add a vtkPVMyClass in that will redirect the calls to the correctly named method
- deprecate ArraySelection* and rename it StringSelection*, change the generated calls accordingly.
- Actually support repeat_command and get_number_command in information_property
I would appreciate any inputs on that