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

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


Puh, finally found it myself, here's the solution:
(copied from vtkRibbonFilter.cxx, and filters.xml, section ribbonfilter)
Sorry for asking too early, but i really was desperate..

Rafael Küng


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"
					attribute_type="point"
					number_of_components="1"/>
				
				<InputArrayDomain
					name="input_array2"
					attribute_type="point"
					number_of_components="1"/>

			</InputProperty>
			
			<StringVectorProperty
				name="SelectFilterArray"
				command="SetInputArrayToProcess"
				label="Select all Tracks, where"
				number_of_elements="5"
				element_types="0 0 0 0 2">
				<ArrayListDomain name="array_list"
					attribute_type="Scalars"
					input_domain_name="input_array1">
					<RequiredProperties>
						<Property name="Input" function="Input"/>
					</RequiredProperties>
				</ArrayListDomain>
				<Documentation>
				This property indicates which array to filter for.
				</Documentation>
			</StringVectorProperty>	

			<StringVectorProperty
				name="SelectRestrictionArray"
				command="SetInputArrayToProcess"
				label="with restriction"
				number_of_elements="5"
				element_types="0 0 0 0 2"
				default_values="1">
				<ArrayListDomain name="array_list"
					attribute_type="Scalars"
					input_domain_name="input_array2">
					<RequiredProperties>
						<Property name="Input" function="Input"/>
					</RequiredProperties>
				</ArrayListDomain>
				<Documentation>
				This property indicates which array to filter for.
				</Documentation>
			</StringVectorProperty>	
.....

and c++ source:

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());

....



Am 20.02.2011 18:25, schrieb Rafael Küng:
> 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
> _______________________________________________
> Paraview-developers mailing list
> Paraview-developers at paraview.org
> http://public.kitware.com/mailman/listinfo/paraview-developers
>


More information about the Paraview-developers mailing list