Fraxinus  2023.01.05-dev+develop.0da12
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 
virtual void setActiveLayout(const QString &uid, int widgetIndex=0)=0
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
Definition: cxViewGroup.h:29
virtual int getActiveGroupId() const =0
boost::shared_ptr< class ViewService > ViewServicePtr
boost::shared_ptr< class RepContainer > RepContainerPtr
boost::shared_ptr< class View > ViewPtr
ViewGroupDataPtr getActiveViewGroup()
DEFINE_ENUM_STRING_CONVERTERS_END(cx, ORIENTATION_TYPE, otCOUNT)
virtual ViewPtr get3DView(int group=0, int index=0)=0
static ViewServicePtr getNullObject()
virtual void deactivateLayout()
DEFINE_ENUM_STRING_CONVERTERS_BEGIN(cx, CAMERA_STYLE_TYPE, cstCOUNT)
RepContainerPtr get3DReps(int group=0, int index=0)
unsigned groupCount() const
Namespace for all CustusX production code.
virtual ViewGroupDataPtr getGroup(int groupIdx) const =0