Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkGizmoObjectFactory.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include "mitkGizmoObjectFactory.h"
18 
19 // Project includes
20 #include "mitkGizmo.h"
21 #include "mitkGizmoMapper2D.h"
22 
23 // MITK includes
24 #include <mitkBaseRenderer.h>
25 #include <mitkDataNode.h>
26 #include <mitkProperties.h>
27 
29 {
30  mitk::Mapper::Pointer newMapper = NULL;
31 
32  if ((dynamic_cast<mitk::Gizmo *>(node->GetData()) != NULL))
33  {
35  {
36  newMapper = mitk::GizmoMapper2D::New();
37  newMapper->SetDataNode(node);
38  }
39  }
40 
41  return newMapper;
42 }
43 
45 {
46  if ((dynamic_cast<mitk::Gizmo *>(node->GetData()) != NULL))
47  {
49  }
50 }
51 
52 struct RegisterGizmoObjectFactory
53 {
54  RegisterGizmoObjectFactory() : m_Factory(mitk::GizmoObjectFactory::New())
55  {
56  mitk::CoreObjectFactory::GetInstance()->RegisterExtraFactory(m_Factory);
57  }
58  ~RegisterGizmoObjectFactory() { mitk::CoreObjectFactory::GetInstance()->UnRegisterExtraFactory(m_Factory); }
60 };
61 
62 static RegisterGizmoObjectFactory registerGizmoObjectFactory;
static void SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer=nullptr, bool overwrite=false)
static Pointer New()
DataCollection - Class to facilitate loading/accessing structured data.
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
static RegisterGizmoObjectFactory registerGizmoObjectFactory
virtual void SetDefaultProperties(mitk::DataNode *node) override
virtual mitk::Mapper::Pointer CreateMapper(mitk::DataNode *node, MapperSlotId slotId) override
unsigned int MapperSlotId
Definition: mitkCommon.h:37
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.