[vtkusers] Displaying string as labels - how to?

luisc l.perez at iturribizia.com
Mon Sep 4 05:38:24 EDT 2006


I think this could help:

I've written a couple of classes based on the ideas of Eric F. Sorton
(see [vtkusers] PATCH: Updates vtkLabeledDataMapper to display strings
on mailing list). The classes are as follows:

- vtkShStrArray: Array which stores short strings (up to seven
characters + null in a 32 bit machine) using doubles to allocate space.
All vtk functions see this container as a vtkDoubleArray, only the class
vtkLabeledShStrMapper knows how to display the short strings.

- vtkLabeledShStrMapper: class derived from vtkMapper2D who manages the
rendering of the labels. I would prefer to write this class as a
subclass of vtkLabeledDataMapper but this class has some private members
like NumberOfLabels or NumberOfLabelsAllocated which I can't manage from
derived class.

The file vtk_short_strings.tar.gz attached to this mail contains c++
files for both classes and a test program  LabeledStates-0001.cxx to
verify that the code works.

I hope this can help.

Luis Claudio Pérez Tato
Iturribizia, S.L.


El sáb, 26-08-2006 a las 20:49 -1000, Roger Blum escribió:
> Hi vtk users,
> 
> I have a couple of points, a scalar value for each point and 1 to 4 strings 
> describing each point. How can I display the strings at the point location 
> (I am using vtk 5.0.0 with Tcl)?
> 
> I have tried to use vtkPolyData (with a vtkStringArray containing the Labels 
> in vtkPointData), but a vtkStringArray can not be added to vtkPointData.
> 
> Is the vtkLabeledDataMapper the right thing to use for what I want to do? Is 
> there a better way to do it?
> 
> Thanks in advance for your help,
> Roger
> 
> 
> 
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtk_short_strings.tar.gz
Type: application/x-compressed-tar
Size: 4531 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060904/18998ae3/attachment.bin>


More information about the vtkusers mailing list