[vtkusers] simple QVTKWidget resize issue

Larry Kellogg lkellogg19 at hotmail.com
Mon Jul 30 15:42:34 EDT 2012


Unfortunately I'm using parallel projection, and 
SetUseHorizontalViewAngle () only works with perspective displays.
Larry

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


More information about the vtkusers mailing list