[vtk-developers] new vtkTextActor class and slight mapper changes
Will Schroeder
will.schroeder at kitware.com
Tue Jun 4 15:15:50 EDT 2002
Hi John-
The class does not compile on MSVC 6.0. Please fix before tonights dashboard.
vtkTextActor.cxx
C:\D\VTK\VTK\Rendering\vtkTextActor.h(60) : error C2555:
'vtkTextActor::GetMapper' : overriding virtual function differs from
'vtkActor2D::GetMapper' only by return type or calling convention
C:\D\VTK\VTK\Common\vtkActor2D.h(37) : see declaration of 'vtkActor2D'
Will
At 05:38 PM 6/4/2002 +0100, John Biddiscombe wrote:
>A new class vtkTextActor has been added. It basically performs the same
>function as
>
>vtkActor2D + vtkTextMapper
>and
>vtkScaledTextActor + vtkTextMapper
>
>It is a scaled - or not scaled - text actor. No mapper is required as it
>will create one internally (but you can supply one if you wish). This means
>that existing code that uses either a vtkActor2D or a vtkScaledTextActor
>can be switch to the new vtkTextActor class with zero fuss.
>
>All the vtkTextMapper functions are pushed through or "promoted" into the
>vtkTextActor class, so that where you once said
>
>myTextMapper->setInput("Hello World");
>myTextMapper->setJustificationTo(...);
>myActor->SetMapper(myMapper);
>etc
>
>you now say
>myTextActor->setInput("Hello World");
>myTextActor->setJustificationTo(...);
>
>and skip the mapper altogether. You can continue to use vtkTextMapper and
>vtkActor2D together if you wish.
>
>New Options are
>
>vtkTextActor->ScaledText
> if false you have an old style textmapper/actor combo
> if true you have an old style ScaledTextActor/textmapper combo
>
>vtkTextActor->SetAlignmentPoint
>// Description:
>// Set/Get the Alignment point for unscaled (fixed fontsize) text
>// if zero (default), the text aligns itself to the bottom left corner
>// (which is defined by the PositionCoordinate)
>// otherwise the text aligns itself to corner/midpoint or centre
>// 6 7 8 of the box defined by the position 1 & 2 coordinates
>// 3 4 5 according to the diagram on the left.
>// 0 1 2
>
>Developers Note : * * * Change to Mappers * * *
>vtkScaledTextActor created another vtkActor2D inside it and passed the
>render calls through to it. This was necessary to allow vtkScaledTextActor
>to alter the position coordinate of the internal actor and make the text
>appear at some shifted position other than the nominal position of the
>ScaledTextActor. (ScaledTextActor would adjust its position and size and
>move itself around to fit the correct box, but if it altered its own
>position, it'd get into a kind of feedback loop and problems would occur,
>so a seperate actor was held inside). This is somewhat wasteful and so
>the solution I've implemented is that the (Text)mappers used to call
>actor->GetPositionCoordinate()...
>but now they call
>actor->GetActualPositionCoordinate()...
>and by default vtkActor2D return PositionCoordinate, but vtkTextActor
>overrides the GetActualPositionCoordinate call and instead returns a
>vtkCoordinate object called AdjustedPositionCoordinate. The textactor can
>compute the correct position of the text and place it in its
>AdjustedPositionCoordinate which is then used by the mappers.
>
>I suspect other vtkActor2D subclasses can also benefit from this fix and
>should anyone find themselves altering any Actor2D classes - Please make a
>mental note of the changes - (also note I've added in
>GetActualPosition2Coordinate() just in case it can be used at a later date).
>
>NB. I've changed
>vtkCarbonTextMapper
>vtkCocoaTextMapper
>vtkWin32OpenGlTextMapper
>vtkXMesaTextMapper
>vtkXOpenGLTextMapper
>if I've missed any please inform me ASAP as I cannot test on all platforms.
>
>
>ttfn
>
>John B
>Any Queries/Problems with this, please let me know. I'll post this message
>to the Users' list in a few days if I get no adverse feedback. I'll also add
>a note to the faq.
>
>
>
>_______________________________________________
>vtk-developers mailing list
>vtk-developers at public.kitware.com
>http://public.kitware.com/mailman/listinfo/vtk-developers
More information about the vtk-developers
mailing list