<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Sarah,<br>
<br>
I'm new to VTK and there might be a better way to do it, but here's how
I did it in a small prototype program. This was with C# and vtkdotnet,
so you'll have to change it slightly for C++. In my case, it ensures
that my vtkOrientationMarkerWidget has a fixed minimum size and that
the square aspect ratio is preserved. I allowed it to grow however, to
properly support rendering to large images.<br>
<br>
Handle the window's OnSize() event (or whatever it's called for your
platform). In my case, this is called even if my marker isn't created
yet, so I have to check. I also call SetOrientationMarkerViewport() in
my form's constructor to set the initial size.<br>
<br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // To fix the viewport of the 3D orientation marker widget to
be square.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private void vtkControl1_Resize(object sender, EventArgs e)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (m_marker != null)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SetOrientationMarkerViewport();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
<br>
</tt><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // The marker's viewport is always 0.2 of the minimum
width/height of<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // the window. The other is scaled to give a "square" viewport.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // But regardless, it will always be at least min_dim X min_dim.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private void SetOrientationMarkerViewport()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const double min_dim= 75;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Size size= vtkControl1.Size;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double width= 0.2,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; height= 0.2;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (size.Width &lt; size.Height)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; height*= ((double) size.Width)/size.Height;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if (size.Width &gt; size.Height)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; width*= ((double) size.Height)/size.Width;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (width*size.Width &lt; min_dim)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; width= min_dim/size.Width;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (height*size.Height &lt; min_dim)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; height= min_dim/size.Height;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_marker.SetViewport(0, 0, width, height);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
</tt><br>
I hope that this helps.<br>
<br>
Sarah Macumber wrote:
<blockquote
 cite="mid:CD74BDC3C0CCBE46A88842384F38B093169488@ems03.ems-1.net"
 type="cite">
  <pre wrap="">Hi Gerrick,
 
The issue was "relative to the window" .  SetWidth and SetHeight set the position as a fraction of the viewport
and not as an absolute size so that when the window resizes so does the scalar bar.  Ideally I would just like
to set a minimum size so that the scalar bar never becomes illegible but that doesn't seem possible.
 
Currently I am trying to use the ScalarBarWidget to give the user control over resizing it when it becomes too 
small.  The problem with that is that when I use the Widget I loose control over setting its width, height and position
and it begins as a square in the bottom right corner no matter that the ScalarBarActor attached to the Widget is set 
correctly.
 
Thanks Gerrick,
Sarah

________________________________

From: <a class="moz-txt-link-abbreviated" href="mailto:vtkusers-bounces@vtk.org">vtkusers-bounces@vtk.org</a> on behalf of Gerrick Bivins
Sent: Wed 7/30/2008 9:05 AM
To: <a class="moz-txt-link-abbreviated" href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>
Subject: Re: [vtkusers] Turning Auto Rescaling Off on vtkActor2D




Hi Sarah,
How is your vtkScalarBarActor set up? At what point does it become
unreadable? Can you provide a screen cap of the problem. I'm using
vtkScalarBarActor w/o issues when resizing my window.

Here is my setup:
        scalarbar = new vtkScalarBarActor();
        scalarbar.SetOrientationToHorizontal();
      
scalarbar.GetPositionCoordinate().SetCoordinateSystemToNormalizedViewport();
        scalarbar.GetPositionCoordinate().SetValue(.2,.05);
       
        scalarbar.SetWidth( 0.7 );
        scalarbar.SetHeight( 0.1 );
        scalarbar.SetPosition( 0.1, 0.01 );
        scalarbar.SetLabelFormat("%-#6.3f");
        scalarbar.GetTitleTextProperty().SetFontFamilyToArial();
        scalarbar.GetTitleTextProperty().SetFontSize( 12 );
        scalarbar.GetLabelTextProperty().SetFontFamilyToArial();
        scalarbar.GetLabelTextProperty().SetFontSize(10);
        scalarbar.GetLabelTextProperty().SetJustificationToCentered();

This keeps it placed at the bottom of my window with all of it's properties
(width,height,position) relative to the window.
Gerrick


Sarah Macumber wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Is there any way to turn off the auto rescaling of the vtkActor2D which
happens when the window changes sizes? Specifically I am trying to keep a
vtkScalarBarActor from becoming illegible.  It would be nice if I could
set a minimum size &amp; font but a fixed size would do as well.  I looked at
the code for a vtkActor2D and I am not sure how one would turn the auto
scaling off.

Thanks Sarah
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>


    </pre>
  </blockquote>
  <pre wrap=""><!---->
--
View this message in context: <a class="moz-txt-link-freetext" href="http://www.nabble.com/Turning-Auto-Rescaling-Off-on-vtkActor2D-tp18715272p18734015.html">http://www.nabble.com/Turning-Auto-Rescaling-Off-on-vtkActor2D-tp18715272p18734015.html</a>
Sent from the VTK - Users mailing list archive at Nabble.com.

_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: <a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>


_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: <a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>

  </pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>Signature</title>
<a href="http:://www.infolytica.com">www.infolytica.com </a><br>
300 Leo Pariseau, Suite 2222, Montreal, QC, Canada, H2X 4B3<br>
(514) 849-8752 x236, Fax: (514) 849-4239
</div>
</body>
</html>