CustusX  2023.01.05-dev+develop.0da12
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
void closeLayoutWidget()
Definition: cxRemoteAPI.cpp:41
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:40
QImage grabScreen()
Definition: cxRemoteAPI.cpp:60
QStringList getAvailableLayouts() const
Definition: cxRemoteAPI.cpp:29
QImage grabLayout()
Definition: cxRemoteAPI.cpp:53
LayoutVideoSourcePtr startStreaming()
stop streaming by destroying the returned object
Definition: cxRemoteAPI.cpp:46
void showSecondaryLayout(QSize size, QString layout)
boost::shared_ptr< class LayoutVideoSource > LayoutVideoSourcePtr
Definition: cxRemoteAPI.h:22
class ViewCollectionWidget * getSecondaryLayoutWidget()
void createLayoutWidget(QSize size, QString layout)
Definition: cxRemoteAPI.cpp:36
QPixmap grabScreen(unsigned screenid)
RemoteAPI(VisServicesPtr services)
Definition: cxRemoteAPI.cpp:24
Namespace for all CustusX production code.