NorMIT-nav  22.09
An IGT application
cxViewService.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 
12 #include "cxViewService.h"
13 #include "cxViewServiceNull.h"
14 #include "cxNullDeleter.h"
15 
16 #include "cxRepContainer.h"
17 #include "cxView.h"
18 #include "cxEnumConverter.h"
19 
20 DEFINE_ENUM_STRING_CONVERTERS_BEGIN(cx, CAMERA_STYLE_TYPE, cstCOUNT)
21 {
22  "DEFAULT_STYLE",
23  "TOOL_STYLE",
24  "ANGLED_TOOL_STYLE",
25  "UNICAM_STYLE"
26 }
27 DEFINE_ENUM_STRING_CONVERTERS_END(cx, CAMERA_STYLE_TYPE, cstCOUNT)
28 
29 namespace cx
30 {
32 {
33  static ViewServicePtr mNull;
34  if (!mNull)
35  mNull.reset(new ViewServiceNull, null_deleter());
36  return mNull;
37 }
38 
39 
40 unsigned ViewService::groupCount() const
41 {
42  int count = 0;
43  while(this->getGroup(count))
44  ++count;
45  return count;
46 }
47 
49 {
50  this->setActiveLayout("", 0);
51  this->setActiveLayout("", 1);
52 }
53 
55 {
56  ViewPtr view = this->get3DView(group, index);
57 
58  if(view)
59  return RepContainerPtr(new RepContainer(view->getReps()));
60  else
61  return RepContainerPtr(new RepContainer(std::vector<RepPtr>()));
62 }
63 
65 {
66  int groupId = this->getActiveGroupId();
67  return this->getGroup(groupId);
68 }
69 
70 } //cx
71 
72 
cx::null_deleter
Definition: cxNullDeleter.h:8
cx::ViewService::deactivateLayout
virtual void deactivateLayout()
Definition: cxViewService.cpp:48
cx::ViewService::getGroup
virtual ViewGroupDataPtr getGroup(int groupIdx) const =0
cx::ViewGroupDataPtr
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
Definition: cxViewGroup.h:29
cx::ViewServiceNull
Definition: cxViewServiceNull.h:21
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::RepContainer
Definition: cxRepContainer.h:39
DEFINE_ENUM_STRING_CONVERTERS_BEGIN
DEFINE_ENUM_STRING_CONVERTERS_BEGIN(cx, CAMERA_STYLE_TYPE, cstCOUNT)
Definition: cxViewService.cpp:20
cx::ViewService::getActiveGroupId
virtual int getActiveGroupId() const =0
cxNullDeleter.h
cxViewService.h
cx::ViewService::get3DView
virtual ViewPtr get3DView(int group=0, int index=0)=0
cx::RepContainerPtr
boost::shared_ptr< class RepContainer > RepContainerPtr
Definition: cxForwardDeclarations.h:162
cxRepContainer.h
cx::ViewServicePtr
boost::shared_ptr< class ViewService > ViewServicePtr
Definition: cxLogicManager.h:28
cxView.h
cxEnumConverter.h
cx::ViewService::getNullObject
static ViewServicePtr getNullObject()
Definition: cxViewService.cpp:31
cx::ViewPtr
boost::shared_ptr< class View > ViewPtr
Definition: cxForwardDeclarations.h:110
cx::ViewService::get3DReps
RepContainerPtr get3DReps(int group=0, int index=0)
Definition: cxViewService.cpp:54
cx::ViewService::getActiveViewGroup
ViewGroupDataPtr getActiveViewGroup()
Definition: cxViewService.cpp:64
cxViewServiceNull.h
cx::ViewService::groupCount
unsigned groupCount() const
Definition: cxViewService.cpp:40
DEFINE_ENUM_STRING_CONVERTERS_END
DEFINE_ENUM_STRING_CONVERTERS_END(cx, ORIENTATION_TYPE, otCOUNT)
cx::ViewService::setActiveLayout
virtual void setActiveLayout(const QString &uid, int widgetIndex=0)=0