[vtkusers] how to create a new mapper from vtkMapper2D

David Doria daviddoria+vtk at gmail.com
Fri Feb 5 07:49:00 EST 2010


On Fri, Feb 5, 2010 at 1:56 AM, Rakesh Patil <rakeshthp at in.com> wrote:

> Hello friends,
>
> First of all, I want to know, whether there is any class which works
> exactly same as that of vtkLabeledDataMapper,
> but instead of displaying Text/Label at each point of the dataset, i need a
> shape (sphere, cone, arrow etc, to be displayed.)
>
> The thing I want to emphasize here is that the pixel or size of the
> lebel/text when we zoom in and out remains constant when
> we use vtkLabeledDataMapper. I want to implement similar functionality but
> replacing texts/labels with any shape.
>
> I tried my best to search for any such class, but i couldn't find any. So,
> I planned to write a new one. So I made of copy of vtkLabeledDataMapper,
> named as myShapeMapper2D and did few changes.
>
> In header file I replace vtkTextMapper with vtkPolyDataMapper2D
>
> In source file, the following changes were done, in BuildLabelsInternal()
> function
>
> Lines from 284 to 458 and 474 to 537 were commented.
>
> And just before the for loop starts, i wro te this code,
>
> vtkSphereSource *sphere = vtkSphereSource::New();
>
> and in side loop,
>
> this->textMapper[i+this->NumberOfLabel]->SetInput(sphere->GetOutput());
>
> also in AllocateLabels() function, I replaced, vtkTextMapper with
> vtkPolyDataMapper2D.
>
> The code compiles without any problem. But no output is produced. Can
> anyone sketch out what may be the problem? Please help me to
> solve this problem.
>
> Thanks in advance
>
>
I think you may be simply looking for a glyph filter?

http://www.vtk.org/Wiki/VTK/Examples/vtkGlyph3D

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100205/f1bfabc1/attachment.htm>


More information about the vtkusers mailing list