Medical Imaging Interaction Toolkit  2018.4.99-3e3f1a6e
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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #include "mitkGizmoObjectFactory.h"
14 
15 // Project includes
16 #include "mitkGizmo.h"
17 #include "mitkGizmoMapper2D.h"
18 
19 // MITK includes
20 #include <mitkBaseRenderer.h>
21 #include <mitkDataNode.h>
22 #include <mitkProperties.h>
23 
25 {
26  mitk::Mapper::Pointer newMapper = nullptr;
27 
28  if ((dynamic_cast<mitk::Gizmo *>(node->GetData()) != nullptr))
29  {
31  {
32  newMapper = mitk::GizmoMapper2D::New();
33  newMapper->SetDataNode(node);
34  }
35  }
36 
37  return newMapper;
38 }
39 
41 {
42  if ((dynamic_cast<mitk::Gizmo *>(node->GetData()) != nullptr))
43  {
45  }
46 }
47 
48 struct RegisterGizmoObjectFactory
49 {
50  RegisterGizmoObjectFactory() : m_Factory(mitk::GizmoObjectFactory::New())
51  {
52  mitk::CoreObjectFactory::GetInstance()->RegisterExtraFactory(m_Factory);
53  }
54  ~RegisterGizmoObjectFactory() { mitk::CoreObjectFactory::GetInstance()->UnRegisterExtraFactory(m_Factory); }
56 };
57 
58 static RegisterGizmoObjectFactory registerGizmoObjectFactory;
static void SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer=nullptr, bool overwrite=false)
static Pointer New()
static RegisterGizmoObjectFactory registerGizmoObjectFactory
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
void SetDefaultProperties(mitk::DataNode *node) override
static Pointer New()
mitk::Mapper::Pointer CreateMapper(mitk::DataNode *node, MapperSlotId slotId) override
unsigned int MapperSlotId
Definition: mitkCommon.h:33
Class for nodes of the DataTree.
Definition: mitkDataNode.h:57