MCPcopy Create free account
hub / github.com/MITK/MITK / Zoom

Method Zoom

Modules/Core/src/Controllers/mitkCameraController.cpp:213–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211}
212
213void mitk::CameraController::Zoom(ScalarType factor, const Point2D &zoomPointInMM)
214{
215 if (factor <= 0.0)
216 return;
217 if (this->GetRenderer()->GetMapperID() == BaseRenderer::Standard2D)
218 {
219 double parallelScale = this->GetRenderer()->GetVtkRenderer()->GetActiveCamera()->GetParallelScale() / factor;
220 if (this->GetRenderer()->GetConstrainZoomingAndPanning() && factor < 1.0)
221 {
222 double maxParallelScale = ComputeMaxParallelScale();
223 if (maxParallelScale - parallelScale * factor <
224 mitk::eps) // this is not the famous 05-bug... Return if already near max zooming
225 return;
226
227 if (parallelScale > maxParallelScale)
228 {
229 parallelScale = maxParallelScale;
230 }
231 }
232 this->GetRenderer()->GetVtkRenderer()->GetActiveCamera()->SetParallelScale(parallelScale);
233 // Move camera in a way that the clicked point stays visible on the display where it was.
234 Point2D planePoint = GetCameraPositionOnPlane();
235 MoveCameraToPoint(planePoint + ((zoomPointInMM - planePoint) * (factor - 1)));
236 }
237}
238
239mitk::Point2D mitk::CameraController::GetCameraPositionOnPlane()
240{

Callers

nothing calls this directly

Calls 2

GetRendererMethod · 0.45
GetVtkRendererMethod · 0.45

Tested by

no test coverage detected