<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
Unfortunately I'm using parallel projection, and
SetUseHorizontalViewAngle () only works with perspective displays.<div><br></div><div>Larry<br><br><div><div id="SkyDrivePlaceholder"></div>> From: clinton@elemtech.com<br>> To: vtkusers@vtk.org<br>> Date: Mon, 30 Jul 2012 12:40:55 -0600<br>> CC: lkellogg19@hotmail.com<br>> Subject: Re: [vtkusers] simple QVTKWidget resize issue<br>> <br>> On Sunday, July 29, 2012 12:55:28 AM Larry Kellogg wrote:<br>> > Hi Everyone,<br>> > I'm having a simple problem, but I can't find a solution.<br>> > In my application when I shrink the window vertically, vtk automatically<br>> > scales the view so that everything remains centered as it was. But when I<br>> > shrink the window horizontally, nothing is resized and the model which used<br>> > to be centered nicely is now cut off on the sides.<br>> > <br>> > Is there a way to get QVTKWidget or a render window to resize the display<br>> > when the window is resized in both the vertical and horizontal directions. <br>> > If VTK doesn't have a way to do this, does anybody have any good<br>> > suggestions on how I could implement this myself? Thanks,<br>> <br>> You can add a callback and register it <br>> StartRenderCallback = vtkCallbackCommand::New();<br>> StartRenderCallback->SetCallback(MyView::StartRender);<br>> RenderWindow->AddObserver(vtkCommand::StartEvent, StartRenderCallback);<br>> <br>> ...<br>> <br>> And in your callback, switch between using the horizonal view angle depending <br>> on the window size.<br>> <br>> void MyView::StartRender(vtkObject* caller, <br>> unsigned long, void* clientdata, void*)<br>> {<br>> vtkRenderWindow* win = vtkRenderWindow::SafeDownCast(caller);<br>> vtkRenderer* ren ....<br>> <br>> // update the view angle<br>> int horiz_view = win->GetSize()[0] < win->GetSize()[1];<br>> ren->GetActiveCamera()->SetUseHorizontalViewAngle(horiz_view);<br>> }<br>> <br>> But perhaps this kind of thing can be added to VTK, with a flag to switch <br>> beween vertical, horizontal or both.<br>> <br>> -- <br>> Clinton Stimpson<br>> Elemental Technologies, Inc<br>> Computational Simulation Software, LLC<br>> www.csimsoft.com<br>> _______________________________________________<br>> Powered by www.kitware.com<br>> <br>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html<br>> <br>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ<br>> <br>> Follow this link to subscribe/unsubscribe:<br>> http://www.vtk.org/mailman/listinfo/vtkusers<br></div></div>                                            </div></body>
</html>