[vtkusers] vtkScalarBarWidget resizes itself on being enabled (use vtkScalarBarRepresentation)
da
remywendy at gmail.com
Wed Sep 23 19:34:28 EDT 2009
This was an old problem from a year ago...
Original email from Sarah Macumber here:
http://markmail.org/message/43xy5lak7voswcoo
I had this problem recently, and could not figure out what was wrong with my
code. No matter how much I changed the vtkScalarActor's width, height,
position, the vtkScalarBarWidget would always display in the same area and
with the same size (incorrectly, of course!).
The solution was that the actual setting for the vtkScalarBarWidget was from
vtkScalarBarRepresentation. To change the position, I ended up doing
vtkScalarBarRepresentation *rep =
vtkScalarBarRepresentation::SafeDownCast(ScalarBarWidget->GetRepresentation());
rep->SetPosition(.85, .65);
rep->SetPosition2(.10, .35);
(the safedowncast might not be necessary). SetPosition2 sets the
height/width of the actual widget on the renderer relative to SetPosition.
Took me a while to figure it out, and wanted to put this out there in case
others were confused or end up googling this issue.
"Hi,
I have been having problems with the *vtkScalarBarWidget* which seems to
resize
itself when On( ) is called. Even though my scalarBarActor has a fixed
width,
height and posisiton none of that translates and my scalar bar shows up
looking
like a square at the bottom right of my screen. Any help would be
appreciated.
Thanks, Sarah
_scalarBarActor.SetPosition(.1, .1);
_scalarBarActor.SetOrientationToHorizontal();
_scalarBarActor.SetWidth(.8);
_scalarBarActor.SetHeight(0.17);
_scalarBarWidget.SetInteractor(ren.GetRenderWindow().GetInteractor());
_scalarBarWidget.SetCurrentRenderer(ren);
_scalarBarWidget.CreateDefaultRepresentation();
_scalarBarWidget.SetScalarBarActor(_scalarBarActor);
_scalarBarWidget.On();"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090923/48a4769c/attachment.htm>
More information about the vtkusers
mailing list