[vtkusers] Re: using generic datasets with VTK
Scott J. Pearson
scottjp at CLEMSON.EDU
Thu Jun 2 18:39:45 EDT 2005
I do not specifically understand what you mean when you say "Adapter." It
sounds like you are referring to a specific product, a product about which I
However, were I in your shoes, I would write a reader that would produce the
type of data you wish (e.g., UnstructuredGrid) from your data source. For
example, at my Clemson Univ. lab, I have produced readers that read data
from xml files and translate these into points, cells (to provide order),
scalars (to provide color), and even vectors (to show directionality). If
you have an online database as your data-source, you could work from this,
Examples of readers are in the IO/ directory of the VCF source code.
vtkBYUReader is a good example. In general, you would create an output
(e.g,. UnstructuredGrid) by the following commands:
This would set your 0th output as a new UnstructuredGrid. Every time your
data is updated (via a manual call of the Update method on something further
down the pipeline or via a first-time read), the reader's Execute method
will be called. Here, you can read in your data, set your points, cells,
scalars, etc. You can have SetVariable (or SetFilename, SetScalarName, etc.)
methods to tell the methods what you want to read, instructing the Execute
method to act appropriately. You can have various levels of sophistication
of this Execute command to speed things up - like not creating new points if
their data-source remains unchanged.
I don't see any way for you to escape using VTK data structures for VTK to
render properly; however, a reader like this will do translations for you.
If you have further questions about this, I'd be willing to answer them.
Scott J. Pearson
Systems Programmer, Center for the Advanced Engineering of Fibers and Films
Clemson University 864.656.6389 scottjp at clemson.edu
10 Riggs Hall, Clemson, SC 29634
More information about the vtkusers