[Paraview-developers] one polydata input, two selectable arrays

Rafael Küng rafi.kueng at gmx.ch
Sun Feb 20 12:25:07 EST 2011


Hi

For some filtering i would like to be able to select two array in the 
gui (but i've only one polydata input). I've tried with the following:

xml:

<ServerManagerConfiguration>
	<ProxyGroup name="filters">
		<SourceProxy name="TrackFilter" class="vtkTrackFilter" 
label="TrackFilter">
			<Documentation
				long_help="Selects specific tracks"
				short_help="Filter Track">
				doku text here
			</Documentation>
	
			<InputProperty
				name="Input"
				command="SetInputConnection">
				<ProxyGroupDomain name="groups">
					<Group name="sources"/>
					<Group name="filters"/>
				</ProxyGroupDomain>
				<DataTypeDomain name="input_type">
					<DataType value="vtkPolyData"/>
				</DataTypeDomain>
				<InputArrayDomain name="input_array1">
					<RequiredProperties>
						<Property name="SelectInputArray1"
							function="FieldDataSelection"/>
						</RequiredProperties>
				</InputArrayDomain>
				<InputArrayDomain name="input_array2">
					<RequiredProperties>
						<Property name="SelectInputArray2"
							function="FieldDataSelection"/>
						</RequiredProperties>
				</InputArrayDomain>
			</InputProperty>
			
			<StringVectorProperty
				name="SelectInputArray1"
				command="SetInputArrayToProcess"
				label="Select all Tracks, where"
				number_of_elements="5"
				element_types="0 0 0 0 2"
				animateable="0">
				<ArrayListDomain name="array_list"
					attribute_type="Scalars">
					<RequiredProperties>
						<Property name="Input" function="Input"/>
					</RequiredProperties>
				</ArrayListDomain>
				<FieldDataDomain name="field_list">
					<RequiredProperties>
						<Property name="Input" function="Input"/>
					</RequiredProperties>
				</FieldDataDomain>
				<Documentation>
				This property indicates which array to filter for.
				</Documentation>
			</StringVectorProperty>	

			<StringVectorProperty
				name="SelectInputArray2"
				command="SetInputArrayToProcess"
				label="with restriction"
				number_of_elements="5"
				element_types="0 0 0 0 2"
				animateable="0">
				<ArrayListDomain name="array_list"
					attribute_type="Scalars">
					<RequiredProperties>
						<Property name="Input" function="Input"/>
					</RequiredProperties>
				</ArrayListDomain>
				<FieldDataDomain name="field_list">
					<RequiredProperties>
						<Property name="Input" function="Input"/>
					</RequiredProperties>
				</FieldDataDomain>
				<Documentation>
				Restriction array
				</Documentation>
			</StringVectorProperty>	
...

-------------------------
and the c++ code:


vtkTrackFilter::vtkTrackFilter()
{
	this->SetNumberOfInputPorts(1);
	this->SetNumberOfOutputPorts(1);

	this->LowPoint = 0;
	this->HighPoint = 0;

	this->SetInputArrayToProcess(
		0,
		0,
		0,
		vtkDataObject::FIELD_ASSOCIATION_POINTS_THEN_CELLS,
		vtkDataSetAttributes::SCALARS);
	
	this->SetInputArrayToProcess(
		1,
		0,
		0,
		vtkDataObject::FIELD_ASSOCIATION_POINTS_THEN_CELLS,
		vtkDataSetAttributes::SCALARS);
}

int vtkTrackFilter::RequestData(vtkInformation*, vtkInformationVector** 
inputVector, vtkInformationVector* outputVector)
{
	vtkInformation* outInfo = outputVector->GetInformationObject(0);
	vtkPolyData* output = vtkPolyData::GetData(outputVector);
	vtkPolyData* input = vtkPolyData::GetData(inputVector[0]);

	vtkDataArray* filterArray1 = this->GetInputArrayToProcess(0, inputVector);
	vtkDataArray* filterArray2 = this->GetInputArrayToProcess(1, inputVector);

	vtkErrorMacro(" array1: "<<filterArray1->GetName());
	vtkErrorMacro(" array2: "<<filterArray2->GetName());
...

but it doesn't run like this.. could anybody give me a hint or a link to 
an example?

Greetings
Rafael Kueng
University of Zurich


More information about the Paraview-developers mailing list