36 #include <QtConcurrent>
37 #include <QDesktopWidget>
38 #include <QApplication>
40 #include "boost/bind.hpp"
42 #include <QVBoxLayout>
46 #include "vtkRenderer.h"
47 #include "vtkWindowToImageFilter.h"
48 #include "vtkRenderWindow.h"
49 #include "vtkPNGWriter.h"
50 #include "vtkUnsignedCharArray.h"
59 mViewService(viewService),
62 this->setLayout(
new QVBoxLayout(
this));
63 this->layout()->setMargin(0);
64 this->setWindowTitle(
"View Layout");
69 QWidget* widget = mViewService->createLayoutWidget(
this, 1);
70 this->layout()->addWidget(widget);
72 mViewService->setActiveLayout(
"LAYOUT_OBLIQUE_3DAnyDual_x1", 1);
92 mWriter(services->patient())
100 mWriter.
save(image,
id);
107 buffer.open(QIODevice::WriteOnly);
108 image.save(&buffer,
"PNG");
114 return mWriter.
grab(screenid);
122 if (!mSecondaryViewLayoutWindow)
124 mSecondaryViewLayoutWindow->show();
126 this->setWidgetToNiceSizeInLowerRightCorner(size);
128 if (!layout.isEmpty())
129 mServices->view()->setActiveLayout(layout, mSecondaryViewLayoutWindow->mSecondaryLayoutId);
132 void ScreenVideoProvider::setWidgetToNiceSizeInLowerRightCorner(QSize size)
134 QDesktopWidget* desktop = qApp->desktop();
135 QList<QScreen*> screens = qApp->screens();
137 QWidget* screen = desktop->screen(desktop->screenNumber(mSecondaryViewLayoutWindow));
138 QRect geo = screen->geometry();
140 if (size.width()==0 || size.height()==0)
142 size = QSize(geo.width()/3, geo.height()/3);
145 QRect rect = QRect(QPoint(geo.width()-size.width(),geo.height()-size.height()), size);
146 mSecondaryViewLayoutWindow->setGeometry(rect);
147 rect = mSecondaryViewLayoutWindow->frameGeometry();
148 mSecondaryViewLayoutWindow->move(geo.width()-rect.width(),geo.height()-rect.height());
153 mSecondaryViewLayoutWindow->hide();
154 delete mSecondaryViewLayoutWindow;
169 if (!mSecondaryViewLayoutWindow)
171 QWidget* widget = mServices->view()->getLayoutWidget(mSecondaryViewLayoutWindow->mSecondaryLayoutId);
QPixmap grab(unsigned screenid)
ScreenVideoProvider(VisServicesPtr services)
boost::shared_ptr< class VisServices > VisServicesPtr
QByteArray generatePNGEncoding(QImage image)
virtual void closeEvent(QCloseEvent *event)
QImage grabSecondaryLayout()
static QImage vtkImageData2QImage(vtkImageDataPtr input)
void closeSecondaryLayout()
Experimental class for IPad usage.
void showSecondaryLayout(QSize size, QString layout)
void save(QImage image, QString id)
class ViewCollectionWidget * getSecondaryLayoutWidget()
cxLogicManager_EXPORT ViewServicePtr viewService()
SecondaryViewLayoutWindow(QWidget *parent)
void saveScreenShot(QImage image, QString id)
virtual void showEvent(QShowEvent *event)
QPixmap grabScreen(unsigned screenid)
virtual void hideEvent(QCloseEvent *event)