35 #include <QApplication>
36 #include <QDesktopWidget>
37 #include "vtkRenderer.h"
60 if (
similar(factor, mZoomFactor))
71 QSize parentSize = mParent->size();
72 double xMin = r.left()/(double)parentSize.width();
73 double xMax = (r.right() + 1)/(
double)parentSize.width();
74 double yMin = (parentSize.height() - r.bottom() - 1) / (
double)parentSize.height();
75 double yMax = (parentSize.height() - r.top()) / (
double)parentSize.height();
76 this->
getView()->getRenderer()->SetViewport(xMin, yMin, xMax, yMax);
88 double scale = mZoomFactor / this->mmPerPix();
102 double ViewItem::mmPerPix()
const
106 QDesktopWidget* desktop =
dynamic_cast<QApplication*
>(QApplication::instance())->desktop();
107 QWidget* screen = desktop->screen(desktop->screenNumber(mParent));
108 double r_h = (double) screen->heightMM() / (double) screen->geometry().height();
109 double r_w = (double) screen->widthMM() / (double) screen->geometry().width();
110 double retval = (r_h + r_w) / 2.0;
DoubleBoundingBox3D transform(const Transform3D &m, const DoubleBoundingBox3D &bb)
virtual DoubleBoundingBox3D getViewport_s() const
Transform3D createTransformScale(const Vector3D &scale_)
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
virtual void setGeometry(const QRect &r)
vtkSmartPointer< class vtkRenderWindow > vtkRenderWindowPtr
virtual void setZoomFactor(double factor)
static ViewRepCollectionPtr create(ViewItem *base, vtkRenderWindowPtr renderWindow)
bool similar(const DoubleBoundingBox3D &a, const DoubleBoundingBox3D &b, double tol)
ViewItem(QString uid, QString name, QWidget *parent, vtkRenderWindowPtr renderWindow, QRect rect)
Transform3D createTransformTranslate(const Vector3D &translation)
virtual DoubleBoundingBox3D getViewport() const
virtual Transform3D get_vpMs() const
Representation of a floating-point bounding box in 3D. The data are stored as {xmin,xmax,ymin,ymax,zmin,zmax}, in order to simplify communication with vtk.
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
ViewRepCollectionPtr getView()
virtual QSize size() const