<div dir="ltr">You can use a startevent on the renderer and check what the camera's settings are. The example below prints the camera's position before each render but you could instead have it check the camera and adjust as needed. There are probably other ways to do it as well. This was just the first that came to mind.<div><br></div><div>Thanks</div><div>Ken<br><div><br></div><div><br><div><br></div><div><div>/*=========================================================================</div><div><br></div><div> Program: Visualization Toolkit</div><div> Module: Cone2.cxx</div><div><br></div><div> Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen</div><div> All rights reserved.</div><div> See Copyright.txt or <a href="http://www.kitware.com/Copyright.htm">http://www.kitware.com/Copyright.htm</a> for details.</div><div><br></div><div> This software is distributed WITHOUT ANY WARRANTY; without even</div><div> the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR</div><div> PURPOSE. See the above copyright notice for more information.</div><div><br></div><div>=========================================================================*/</div><div>//</div><div>// This example shows how to add an observer to a C++ program. It extends</div><div>// the Step1/Cxx/Cone.cxx C++ example (see that example for information on</div><div>// the basic setup).</div><div>//</div><div>// VTK uses a command/observer design pattern. That is, observers watch for</div><div>// particular events that any vtkObject (or subclass) may invoke on</div><div>// itself. For example, the vtkRenderer invokes a "StartEvent" as it begins</div><div>// to render. Here we add an observer that invokes a command when this event</div><div>// is observed.</div><div>//</div><div><br></div><div>// first include the required header files for the vtk classes we are using</div><div>#include "vtkConeSource.h"</div><div>#include "vtkPolyDataMapper.h"</div><div>#include "vtkRenderWindow.h"</div><div>#include "vtkCommand.h"</div><div>#include "vtkCamera.h"</div><div>#include "vtkActor.h"</div><div>#include "vtkRenderer.h"</div><div><br></div><div>// Callback for the interaction</div><div>class vtkMyCallback : public vtkCommand</div><div>{</div><div>public:</div><div> static vtkMyCallback *New()</div><div> { return new vtkMyCallback; }</div><div> virtual void Execute(vtkObject *caller, unsigned long, void*)</div><div> {</div><div> vtkRenderer *renderer = reinterpret_cast<vtkRenderer*>(caller);</div><div> cout << renderer->GetActiveCamera()->GetPosition()[0] << " "</div><div> << renderer->GetActiveCamera()->GetPosition()[1] << " "</div><div> << renderer->GetActiveCamera()->GetPosition()[2] << "\n";</div><div> }</div><div>};</div><div><br></div><div>int main()</div><div>{</div><div> //</div><div> // The pipeline creation is documented in Step1</div><div> //</div><div> vtkConeSource *cone = vtkConeSource::New();</div><div> cone->SetHeight( 3.0 );</div><div> cone->SetRadius( 1.0 );</div><div> cone->SetResolution( 10 );</div><div><br></div><div> vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();</div><div> coneMapper->SetInputConnection( cone->GetOutputPort() );</div><div> vtkActor *coneActor = vtkActor::New();</div><div> coneActor->SetMapper( coneMapper );</div><div><br></div><div> vtkRenderer *ren1= vtkRenderer::New();</div><div> ren1->AddActor( coneActor );</div><div> ren1->SetBackground( 0.1, 0.2, 0.4 );</div><div> ren1->ResetCamera();</div><div><br></div><div> vtkRenderWindow *renWin = vtkRenderWindow::New();</div><div> renWin->AddRenderer( ren1 );</div><div> renWin->SetSize( 300, 300 );</div><div><br></div><div> // Here is where we setup the observer, we do a new and ren1 will</div><div> // eventually free the observer</div><div> vtkMyCallback *mo1 = vtkMyCallback::New();</div><div> ren1->AddObserver(vtkCommand::StartEvent,mo1);</div><div> mo1->Delete();</div><div><br></div><div> //</div><div> // now we loop over 360 degrees and render the cone each time</div><div> //</div><div> int i;</div><div> for (i = 0; i < 360; ++i)</div><div> {</div><div> // render the image</div><div> renWin->Render();</div><div> // rotate the active camera by one degree</div><div> ren1->GetActiveCamera()->Azimuth( 1 );</div><div> }</div><div><br></div><div> //</div><div> // Free up any objects we created</div><div> //</div><div> cone->Delete();</div><div> coneMapper->Delete();</div><div> coneActor->Delete();</div><div> ren1->Delete();</div><div> renWin->Delete();</div><div><br></div><div> return 0;</div><div>}</div><div><br></div><div><br></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 28, 2016 at 2:32 AM, Rakesh Patil <span dir="ltr"><<a href="mailto:rakesh.p@tataelxsi.co.in" target="_blank">rakesh.p@tataelxsi.co.in</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hello users,</p>
<p><br>
</p>
<p>Is there any way to control zoom limits? Like I need to restrict zooming, in the range of say 5 miles to 10 miles. How can this be done? Kindly suggest some ideas/techniques.</p>
<p><br>
</p>
<div>
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Warm Regards</p><span class="HOEnZb"><font color="#888888">
<p><br>
</p>
<p>Rakesh Patil</p>
<p></p>
</font></span></div>
</div>
</div>
</div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Ken Martin PhD<div>Chairman & CFO<br>Kitware Inc.<br>28 Corporate Drive<br>Clifton Park NY 12065<br>518 371 3971<div><br></div><div><span style="font-size:10pt;font-family:Tahoma,sans-serif">This communication,
including all attachments, contains confidential and legally privileged
information, and it is intended only for the use of the addressee. Access to this email by anyone else is
unauthorized. If you are not the intended recipient, any disclosure, copying,
distribution or any action taken in reliance on it is prohibited and may be
unlawful. If you received this communication in error please notify us
immediately and destroy the original message.
Thank you.</span></div></div></div>
</div>