Fraxinus  17.12
An IGT application
cxViewGroup.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 CXVIEWGROUP_H_
34 #define CXVIEWGROUP_H_
35 
36 #include "org_custusx_core_view_Export.h"
37 
38 #include <vector>
39 #include <QObject>
40 #include <QDomDocument>
41 #include "cxDefinitions.h"
42 #include "cxForwardDeclarations.h"
43 #include "cxVector3D.h"
44 
45 class QMenu;
46 class QPoint;
47 
48 namespace cx
49 {
50 typedef boost::shared_ptr<class ViewGroupData> ViewGroupDataPtr;
51 typedef boost::shared_ptr<class SyncedValue> SyncedValuePtr;
52 typedef boost::shared_ptr<class CameraStyle> CameraStylePtr;
53 typedef boost::shared_ptr<class CoreServices> CoreServicesPtr;
54 
68 class org_custusx_core_view_EXPORT ViewGroup: public QObject
69 {
70  Q_OBJECT
71 public:
72  explicit ViewGroup(CoreServicesPtr backend, QString uid);
73  virtual ~ViewGroup();
74 
75  void addView(ViewWrapperPtr wrapper, SharedOpenGLContextPtr sharedOpenGLContext);
76  void removeViews();
77  ViewWrapperPtr getViewWrapperFromViewUid(QString viewUid);
78  std::vector<ViewWrapperPtr> getWrappers() const { return mViewWrappers; }
79  std::vector<ViewPtr> getViews() const;
80  ViewGroupDataPtr getData() { return mViewGroupData; }
81  virtual void addXml(QDomNode& dataNode);
82  virtual void parseXml(QDomNode dataNode);
83  void clearPatientData();
84  CameraStylePtr getCameraStyle() { return mCameraStyle; }
85 
86  bool contains3DView() const;
87  void initializeActiveView(SyncedValuePtr val);
88 
89 protected slots:
90 // void activateManualToolSlot();
91  void mouseClickInViewGroupSlot();
92 
93 protected:
94  std::vector<ViewPtr> mViews;
95 
96  ViewGroupDataPtr mViewGroupData;
97  std::vector<ViewWrapperPtr> mViewWrappers;
98  CameraStylePtr mCameraStyle;
99  CoreServicesPtr mBackend;
100  SyncedValuePtr mActiveView;
101 
102 private:
103  template<class T>
104  bool shouldUpdateActiveData(T activeData, std::vector<T> datas) const;
105  void optionChangedSlot();
106 };
107 
108 bool isViewWrapper2D(ViewWrapperPtr wrapper);
109 
113 } // namespace cx
114 
115 #endif /* CXVIEWGROUP_H_ */
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
Definition: cxViewGroup.h:50
ViewGroupDataPtr mViewGroupData
Definition: cxViewGroup.h:96
CameraStylePtr mCameraStyle
Definition: cxViewGroup.h:98
CoreServicesPtr mBackend
Definition: cxViewGroup.h:99
boost::shared_ptr< class CameraStyle > CameraStylePtr
Definition: cxCameraStyle.h:57
std::vector< ViewPtr > mViews
Definition: cxViewGroup.h:94
boost::shared_ptr< class ViewWrapper > ViewWrapperPtr
bool isViewWrapper2D(ViewWrapperPtr wrapper)
ViewGroupDataPtr getData()
Definition: cxViewGroup.h:80
boost::shared_ptr< class SharedOpenGLContext > SharedOpenGLContextPtr
std::vector< ViewWrapperPtr > mViewWrappers
Definition: cxViewGroup.h:97
CameraStylePtr getCameraStyle()
Definition: cxViewGroup.h:84
SyncedValuePtr mActiveView
Definition: cxViewGroup.h:100
boost::shared_ptr< class CoreServices > CoreServicesPtr
Definition: cxCameraStyle.h:59
boost::shared_ptr< class SyncedValue > SyncedValuePtr
Definition: cxViewGroup.h:51
std::vector< ViewWrapperPtr > getWrappers() const
Definition: cxViewGroup.h:78
Namespace for all CustusX production code.