[vtkusers] hiding far labels

Jeff Baumes jeff.baumes at kitware.com
Tue Nov 10 08:58:53 EST 2009


2009/11/9 Murat Aydın <murat.aydin at netcad.com.tr>

>  Hi,
>
> I am trying this example :
>
> http://public.kitware.com/cgi-bin/viewcvs.cgi/*checkout*/Rendering/Testing/Cxx/TestLabelPlacerCoincidentPoints.cxx?root=VTK&content-type=text/plain
>
> How can i hide far labels ? There are many labels and its hard to
> understand which label belongs to which object.
>

You can hide labels that are behind other objects with UseDepthBufferOn().
There is no explicit way to turn off far labels, except that the labeler
should automatically try to place labels close to the camera first, so far
labels should be less frequent.


>
> Whats MaximumLabelFraction of vtkLabelPlacer?
>

Maximum amount of screen space labels can take up before placement stops.
I've checked in a documentation fix.


>
> Another question is how can i display labels vertical. i set LabelGravity<http://www.vtk.org/doc/release/5.4/html/a00946.html#600e4ccbee722ea6f9cef987f00ca8f2>
>  to    VerticalBottomBit<http://www.vtk.org/doc/release/5.4/html/a00946.html#600e4ccbee722ea6f9cef987f00ca8f2cfff75b45bba92e2b39cc53393286523>,
> VerticalBaselineBit<http://www.vtk.org/doc/release/5.4/html/a00946.html#600e4ccbee722ea6f9cef987f00ca8f2e25d04518fe567930c48b685522e6113>
> but labels are not displayed vertical.
>

These flags just adjust the where the text is vertically aligned, not the
rotation. The default text rendering strategy (freetype) does not support
nicely rotated text. To get rotated text labels, you would need:

1. Compile VTK with VTK_USE_QT.
2. Use vtkLabelPlacementMapper instead of vtkLabelPlacer (it has similar API
but a few more features).
3. Set the label rendering strategy to an instance of
vtkQtLabelRenderStrategy.
4. Set the orientation of the text property in vtkPointSetToLabelHierarchy
to the angle you desire (e.g. 90.0).

Most of this code to do this is in
Views/Testing/Cxx/TestQtLabelStrategy.cxx

Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091110/901494e9/attachment.htm>


More information about the vtkusers mailing list