vtkScalarBarActor bug (fwd)

Ken Martin ken.martin at kitware.com
Thu Jul 1 14:09:14 EDT 1999


Hi Gala'Vi,

>I have located a bug in vtkScalarBarActor that prevents the scalar bar
>from being rescaled correctly. The problem is that when you set the
>viewport size for the bar, the text is set to be the optimal size, and the
>bar itself gets what's left. Very often that "what's left" is just plain
>big fat 0. The problems are in the IF statement that begins on line 367 in
>vtkScalarBarActor.cxx of vtk 2.3. One way to fix that is to restrain the
>text from taking over more than half of the allocated screen space. 
>
>Before I fix this annoying bug, I was wondering if it should be fixed in
>some specific way because there are several ways to fix the sucker.

Right now the logic for finding the best font size is based only on the
title string. I think the correct fix would be to extend the logic for finding
the best font size. After the first logic is complete I'd add two more
tests which can further shrink the font size

1) while the height of the title is > 40% of the height of the area
allocated for the scalar bar shrink the font.  This fixes a problem in wide
short windows where the bar disappears.

2) evaluate the size of all the labels (right now they are not considered
in the sizing process). Find the longest label (could be strlen or pixels,
I'm not sure which would be better/faster) then using that label, shrink
the font until the width of the label is < say 70% of the width.

That is my best guess

- Ken



-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------





More information about the vtkusers mailing list