[vtkusers] how to query vtkInformation

Matthias Langer mlangc at gmx.at
Sat Dec 10 21:40:46 EST 2005


On Fri, 2005-12-09 at 21:58 +0100, Matthias Langer wrote:
> On Fri, 2005-12-09 at 20:59 +0100, Florian Drescher wrote:
> > > printInfo for vtkConeSource
> > >   input ports:
> > >     no input ports
> > >   output ports:
> > >     port 0 :
> > >       Debug: Off
> > >       Modified Time: 317
> > >       Reference Count: 1
> > >       Registered Events: (none)
> > >       DATA_TYPE_NAME: vtkPolyData
> > >       PORT_REQUIREMENTS_FILLED: 1
> > >
> > > Now i'm intersted in finding out how to get the DATA_TYPE_NAME filed
> > > directly by an apprpriate method call to vtkInformation.
> > 
> > Try the functions
> > virtual const char *GetClassName()
> > virtual int IsA (const char *type)
> > int IsTypeOf (const char *type)
> > 
> 
> I know these functions; what i want to do, is to obtain information from
> vtkAlgorithm via *vtkInformation. I'm not intersetd in knowing the
> concrete type of the *vtkAlgorithm, but i'm interested in the types the
> (input/output)-ports accept/generate.
> 
> In detail:
> Suppose i've got a vtkAlgorithm *p_algo from somewhere. Now i'm
> interested in:
> 
> 	- how many output ports has p_algo
> 		- what kind of data is produced by p_algo
> 	- how may input ports has p_algo
> 		- what kind of data is accepted by p_algo
> 
> If p_algo is for example a cone source i only need to know:
> 
> 	- we've got one output port 0
> 	- this port produces vtkPolyData
> 	- we have no input ports
> 
> I hope that it is now clearer what i mean.
> 
> Matthias
> 

Ok, because this may save someone some time, here is what i've found out
myself:

query the data type required for input (pAlogo is of type *vtkAlgorithm,
portNumber of type int):

vtkInformation *pInfo = pAlgo->GetInputPortInformation(portNumber);
const char *dataTypeName =
pInfo->Get(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE());

to query the type generated by pAlgo:

vtkInformation *pInfo = pAlgo->GetOutputPortInformation(portNumber);
const char *dataTypeName =
pInfo->Get(vtkDataObject::DATA_TYPE_NAME());

Matthias










More information about the vtkusers mailing list