| 30 | } |
| 31 | |
| 32 | mitk::ScalarType mitk::CameraController::ComputeMaxParallelScale() |
| 33 | { |
| 34 | double widthInMM = this->GetRenderer()->GetCurrentWorldPlaneGeometry()->GetExtentInMM(0); |
| 35 | double heightInMM = this->GetRenderer()->GetCurrentWorldPlaneGeometry()->GetExtentInMM(1); |
| 36 | |
| 37 | double dispHeight = this->GetRenderer()->GetViewportSize()[1]; // in pixel! |
| 38 | double dispWidth = this->GetRenderer()->GetViewportSize()[0]; |
| 39 | |
| 40 | // To get the right zooming factor, we need to set the (half) height to the vtk camera using SetParallelScale. |
| 41 | // However, it could be, that our picture is so wide or the display so small, that we cannot take the height of the |
| 42 | // picture. |
| 43 | // For a wide picture, we have to take the width and adapt the width so that our image fits to the screen. |
| 44 | // But we can only set the height. Therefore, if the width is the limiting factor, we need to get the ratio of scaling |
| 45 | // for the width and multiply it with the height, so that we have a modified height and set this one. Believe us, we |
| 46 | // figured it out... |
| 47 | if ((dispWidth / widthInMM) < (dispHeight / heightInMM)) |
| 48 | { |
| 49 | heightInMM = widthInMM / dispWidth * dispHeight; |
| 50 | } |
| 51 | |
| 52 | return heightInMM * 0.5; |
| 53 | } |
| 54 | |
| 55 | void mitk::CameraController::AdjustConstrainedCameraPosition(mitk::Point2D &planePoint) |
| 56 | { |
nothing calls this directly
no test coverage detected