NorMIT-nav  22.09
An IGT application
cxRemoteAPI.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 #include "cxRemoteAPI.h"
12 
13 #include "cxViewService.h"
14 #include "cxLayoutRepository.h"
15 #include <QStringList>
16 #include "cxScreenVideoProvider.h"
17 #include "cxLayoutVideoSource.h"
18 #include "cxViewCollectionWidget.h"
19 #include "vtkRenderWindow.h"
20 
21 namespace cx
22 {
23 
24 RemoteAPI::RemoteAPI(VisServicesPtr services) : mServices(services)
25 {
26  mScreenVideo = new ScreenVideoProvider(mServices);
27 }
28 
29 QStringList RemoteAPI::getAvailableLayouts() const
30 {
31  std::vector<QString> val;
32  val = mServices->view()->getLayoutRepository()->getAvailable();
33  return QStringList::fromVector(QVector<QString>::fromStdVector(val));
34 }
35 
36 void RemoteAPI::createLayoutWidget(QSize size, QString layout)
37 {
38  mScreenVideo->showSecondaryLayout(size, layout);
39 }
40 
42 {
43  mScreenVideo->closeSecondaryLayout();
44 }
45 
47 {
48  ViewCollectionWidget* vcw = mScreenVideo->getSecondaryLayoutWidget();
49  LayoutVideoSourcePtr source(new LayoutVideoSource(vcw));
50  return source;
51 }
52 
54 {
55  QImage image = mScreenVideo->grabSecondaryLayout();
56 // mScreenVideo->saveScreenShot(image, "webimage_view");
57  return image;
58 }
59 
61 {
62  QImage image = mScreenVideo->grabScreen(0).toImage();
63  // mScreenVideo->saveScreenShot(pm, "webimage");
64  return image;
65 }
66 
67 
68 } // namespace cx
cxLayoutRepository.h
cx::RemoteAPI::startStreaming
LayoutVideoSourcePtr startStreaming()
stop streaming by destroying the returned object
Definition: cxRemoteAPI.cpp:46
cx::ScreenVideoProvider
Definition: cxScreenVideoProvider.h:51
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::VisServicesPtr
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:40
cxScreenVideoProvider.h
cx::ScreenVideoProvider::getSecondaryLayoutWidget
class ViewCollectionWidget * getSecondaryLayoutWidget()
Definition: cxScreenVideoProvider.cpp:179
cxViewCollectionWidget.h
cx::RemoteAPI::grabScreen
QImage grabScreen()
Definition: cxRemoteAPI.cpp:60
cxLayoutVideoSource.h
cxViewService.h
cx::RemoteAPI::grabLayout
QImage grabLayout()
Definition: cxRemoteAPI.cpp:53
cx::ScreenVideoProvider::grabSecondaryLayout
QImage grabSecondaryLayout()
Definition: cxScreenVideoProvider.cpp:169
cx::RemoteAPI::getAvailableLayouts
QStringList getAvailableLayouts() const
Definition: cxRemoteAPI.cpp:29
cx::ScreenVideoProvider::closeSecondaryLayout
void closeSecondaryLayout()
Definition: cxScreenVideoProvider.cpp:163
cx::ScreenVideoProvider::grabScreen
QPixmap grabScreen(unsigned screenid)
Definition: cxScreenVideoProvider.cpp:91
cx::ScreenVideoProvider::showSecondaryLayout
void showSecondaryLayout(QSize size, QString layout)
Definition: cxScreenVideoProvider.cpp:98
cx::RemoteAPI::closeLayoutWidget
void closeLayoutWidget()
Definition: cxRemoteAPI.cpp:41
cx::LayoutVideoSourcePtr
boost::shared_ptr< class LayoutVideoSource > LayoutVideoSourcePtr
Definition: cxRemoteAPI.h:22
cx::RemoteAPI::createLayoutWidget
void createLayoutWidget(QSize size, QString layout)
Definition: cxRemoteAPI.cpp:36
cx::RemoteAPI::RemoteAPI
RemoteAPI(VisServicesPtr services)
Definition: cxRemoteAPI.cpp:24
cxRemoteAPI.h
cx::LayoutVideoSource
Definition: cxLayoutVideoSource.h:25
cx::ViewCollectionWidget
Definition: cxViewCollectionWidget.h:39