[vtkusers] Problems with vtkVectorText and vtkFollower in Java
Carlos Martínez Burgos
cmarbur at iti.upv.es
Tue Dec 10 13:43:51 EST 2002
OK. I send a simple code fragment to show what I want. Is part of a class
with more code wich I think not affect the result.
...
vtkPlaneSource plane = new vtkPlaneSource();
plane.SetOrigin(x, y, z);
plane.SetPoint1(x + width, y, z);
plane.SetPoint2(x, y + height, z);
vtkPolyDataMapper mapper = new vtkPolyDataMapper();
mapper.SetInput(plane.GetOutput());
vtkActor actor = new vtkActor();
actor.SetMapper(mapper);
vtkVectorText text = new vtkVectorText();
text.SetText("Sample text");
vtkPolyDataMapper textMapper = new vtkPolyDataMapper();
textMapper.SetInput(text.GetOutput());
vtkFollower textActor = new vtkFollower();
textActor.SetMapper(textMapper);
textActor.SetPosition(x - 1, y - 1, z);
textActor.GetProperty().SetColor(0, 0, 0);
textActor.SetCamera(renderer.GetActiveCamera());
renderer.AddActor(actor);
renderer.AddActor(textActor);
...
It seems simple. I'm inspired on the examples. At this moment I only want
to solve the problem showing text. After that I will try to do the square
labels with text. If you don't understand the problem, tomorrow I will
send a simple program with code that doesn't work (I have to write it).
What do you think?
Thanks in advance.
On Tue, 10 Dec 2002, Jeff Lee wrote:
> perhaps you could post some sample code so we can see what you are
> trying to do?
> -Jeff
>
> Carlos Martínez Burgos wrote:
>
> >Hi all.
> >
> >I try to do a grid plane using vtkPlaneSource. I have to put some legend.
> >At first I had tried to include a vtkCubeAxisActor2D but its behaviour is
> >not as I want. I want to assign a number/leter to each axis of the grid.
> >This shows it:
> >
> > A B C
> > +-+-+-+
> >1 | | | |
> > +-+-+-+
> >2 | | | |
> > +-+-+-+
> >3 | | | |
> > +-+-+-+
> >
> >I have tried to use vtkVectorText and vtkFollower but nothing is showed.
> >I'm using the Java wrapper. If I run the Tcl sample programs the text is
> >showed. Even then when I do a "zoom extent" to show all the objects on the
> >renderer, it seems that the actor is there because the extent is bigger
> >that when I don't add the actor.
> >
> >I have tried not using vtkFollower and I have got the same result.
> >
> >I have tried other text objects (vtkTextActor) and nothing changes.
> >
> >This seems there is a problem with texts in Java. Perhaps is because I use
> >Linux. Have you got good results in Windows?
> >
> >I wish to know if somebody is using java and has got good results showing
> >texts in Linux.
> >
> >Thanks.
> >
> >
> >
> >
>
--
----------------------------------------------------------------------
Carlos Martínez Burgos | Instituto Tecnológico de Informática
Ingeniero Informático | Universidad Politécnica de Valencia
Tlf: +34 963877237 | Camí de Vera, S/N
cmarbur at iti.upv.es | 46071 Valencia - Spain
www.iti.upv.es/~cmarbur | www.iti.upv.es
----------------------------------------------------------------------
More information about the vtkusers
mailing list