CustusX  16.12
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxViewService.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 #ifndef CXVIEWSERVICE_H_
34 #define CXVIEWSERVICE_H_
35 
36 #include "cxResourceVisualizationExport.h"
37 
38 #include <QObject>
39 #include <boost/shared_ptr.hpp>
40 #include <vector>
41 #include "cxData.h"
42 #include "cxLayoutData.h"
43 #include "cxEnumConverter.h"
44 class QActionGroup;
45 
46 #define ViewService_iid "cx::ViewService"
47 
48 namespace cx
49 {
50 
51 typedef boost::shared_ptr<class InteractiveCropper> InteractiveCropperPtr;
52 typedef boost::shared_ptr<class Clippers> ClippersPtr;
53 
54 typedef boost::shared_ptr<class CyclicActionLogger> CyclicActionLoggerPtr;
55 typedef boost::shared_ptr<class Navigation> NavigationPtr;
56 typedef boost::shared_ptr<class LayoutRepository> LayoutRepositoryPtr;
57 typedef boost::shared_ptr<class CameraControl> CameraControlPtr;
58 typedef boost::shared_ptr<class RepContainer> RepContainerPtr;
59 
60 enum cxResourceVisualization_EXPORT CAMERA_STYLE_TYPE
61 {
63 };
64 
65 } //cx
66 
67 SNW_DECLARE_ENUM_STRING_CONVERTERS(cxResourceVisualization_EXPORT, cx, CAMERA_STYLE_TYPE);
68 
69 namespace cx
70 {
71 
78 class cxResourceVisualization_EXPORT ViewService : public QObject
79 {
80  Q_OBJECT
81 public:
82  virtual ViewPtr get3DView(int group = 0, int index = 0) = 0;
83  RepContainerPtr get3DReps(int group = 0, int index = 0);
84 
85  //TODO: Remove direct access to this internal structure
86  virtual int getActiveGroupId() const = 0;
87  virtual ViewGroupDataPtr getGroup(int groupIdx) const = 0;
88  unsigned groupCount() const;
89 
90  //All above group access needs to be replaced with functions:
91  virtual void setRegistrationMode(REGISTRATION_STATUS mode) = 0;
92 
93  virtual void autoShowData(DataPtr data) = 0;
94  virtual void enableRender(bool val) = 0;
95  virtual bool renderingIsEnabled() const = 0;
96  virtual QWidget* createLayoutWidget(QWidget* parent, int index=0) = 0;
97  virtual QWidget* getLayoutWidget(int index) = 0;
98  virtual QString getActiveLayout(int widgetIndex=0) const = 0;
99  virtual void setActiveLayout(const QString& uid, int widgetIndex=0) = 0;
100  virtual void deactivateLayout();
101  virtual ClippersPtr getClippers() = 0;
102  virtual InteractiveCropperPtr getCropper() = 0;
103  virtual CyclicActionLoggerPtr getRenderTimer() = 0;
104  virtual NavigationPtr getNavigation() = 0;
105  virtual LayoutRepositoryPtr getLayoutRepository() = 0;
106  virtual CameraControlPtr getCameraControl() = 0;
107  virtual QActionGroup* getInteractorStyleActionGroup() = 0;
108  virtual void centerToImageCenterInActiveViewGroup() = 0;
109  virtual void setCameraStyle(CAMERA_STYLE_TYPE style, int groupIdx) = 0;
110  virtual void addDefaultLayout(LayoutData layoutData) = 0;
111  virtual void enableContextMenuForViews(bool enable=true) = 0;
112 
113  virtual bool isNull() = 0;
114  static ViewServicePtr getNullObject();
115 
116  // extended Data interface
117  ViewGroupDataPtr getActiveViewGroup();
118 signals:
119  void fps(int number);
120  void activeLayoutChanged();
121  void activeViewChanged();
122  void renderingEnabledChanged();
123  void pointSampled(Vector3D p_r);
124  void renderFinished();
125 
126 public slots:
127  virtual void aboutToStop() = 0;
128 
129 };
130 
131 } //cx
132 Q_DECLARE_INTERFACE(cx::ViewService, ViewService_iid)
133 
134 #endif // CXVIEWSERVICE_H_
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
Definition: cxViewGroup.h:50
Visualization services.
Definition: cxViewService.h:78
boost::shared_ptr< class LayoutRepository > LayoutRepositoryPtr
boost::shared_ptr< class ViewService > ViewServicePtr
boost::shared_ptr< class View > ViewPtr
cstTOOL_STYLE
Definition: cxViewService.h:62
boost::shared_ptr< class Navigation > NavigationPtr
Definition: cxViewGroup.h:54
cstDEFAULT_STYLE
Definition: cxViewService.h:62
boost::shared_ptr< class Data > DataPtr
boost::shared_ptr< class RepContainer > RepContainerPtr
boost::shared_ptr< class CyclicActionLogger > CyclicActionLoggerPtr
SNW_DECLARE_ENUM_STRING_CONVERTERS(cxResourceVisualization_EXPORT, cx, CAMERA_STYLE_TYPE)
cstANGLED_TOOL_STYLE
Definition: cxViewService.h:62
#define ViewService_iid
Definition: cxViewService.h:46
boost::shared_ptr< class InteractiveCropper > InteractiveCropperPtr
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:63
boost::shared_ptr< class CameraControl > CameraControlPtr
Definition: cxMainWindow.h:58
cstUNICAM_STYLE
Definition: cxViewService.h:62
boost::shared_ptr< class Clippers > ClippersPtr