14 #include <QApplication>
15 #include <QDesktopWidget>
16 #include "vtkRenderer.h"
39 if (
similar(factor, mZoomFactor))
50 QSize parentSize = mParent->size();
51 double xMin = r.left()/(double)parentSize.width();
52 double xMax = (r.right() + 1)/(
double)parentSize.width();
53 double yMin = (parentSize.height() - r.bottom() - 1) / (
double)parentSize.height();
54 double yMax = (parentSize.height() - r.top()) / (
double)parentSize.height();
55 this->
getView()->getRenderer()->SetViewport(xMin, yMin, xMax, yMax);
67 double scale = mZoomFactor / this->mmPerPix();
81 double ViewItem::mmPerPix()
const
85 QDesktopWidget* desktop =
dynamic_cast<QApplication*
>(QApplication::instance())->desktop();
86 QWidget* screen = desktop->screen(desktop->screenNumber(mParent));
87 double r_h = (double) screen->heightMM() / (double) screen->geometry().height();
88 double r_w = (double) screen->widthMM() / (double) screen->geometry().width();
89 double retval = (r_h + r_w) / 2.0;