| 211 | } |
| 212 | |
| 213 | void 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 | |
| 239 | mitk::Point2D mitk::CameraController::GetCameraPositionOnPlane() |
| 240 | { |
nothing calls this directly
no test coverage detected