Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
mitkAnnotationProperty.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 "mitkAnnotationProperty.h"
18 
20 {
21 }
22 
23 mitk::AnnotationProperty::AnnotationProperty(const char *label, const Point3D &position)
24  : m_Label(""), m_Position(position)
25 {
26  if (label != nullptr)
27  {
28  m_Label = label;
29  }
30 }
31 
32 mitk::AnnotationProperty::AnnotationProperty(const std::string &label, const Point3D &position)
33  : m_Label(label), m_Position(position)
34 {
35 }
36 
38 {
39  if (label != nullptr)
40  {
41  m_Label = label;
42  }
43 
44  m_Position[0] = x;
45  m_Position[1] = y;
46  m_Position[2] = z;
47 }
48 
50  : m_Label(label)
51 {
52  m_Position[0] = x;
53  m_Position[1] = y;
54  m_Position[2] = z;
55 }
56 
58  : BaseProperty(other), m_Label(other.m_Label), m_Position(other.m_Position)
59 {
60 }
61 
63 {
64  return m_Position;
65 }
66 
68 {
69  if (m_Position != position)
70  {
71  m_Position = position;
72  this->Modified();
73  }
74 }
75 
76 bool mitk::AnnotationProperty::IsEqual(const BaseProperty &property) const
77 {
78  return ((this->m_Label == static_cast<const Self &>(property).m_Label) &&
79  (this->m_Position == static_cast<const Self &>(property).m_Position));
80 }
81 
82 bool mitk::AnnotationProperty::Assign(const BaseProperty &property)
83 {
84  this->m_Label = static_cast<const Self &>(property).m_Label;
85  this->m_Position = static_cast<const Self &>(property).m_Position;
86  return true;
87 }
88 
90 {
91  std::stringstream myStr;
92 
93  myStr << this->GetLabel() << this->GetPosition();
94  return myStr.str();
95 }
96 
97 itk::LightObject::Pointer mitk::AnnotationProperty::InternalClone() const
98 {
99  itk::LightObject::Pointer result(new Self(*this));
100  result->UnRegister();
101  return result;
102 }
itk::SmartPointer< Self > Pointer
double ScalarType
const Point3D & GetPosition() const
virtual std::string GetValueAsString() const override
Abstract base class for properties.
Property for annotations.
void SetPosition(const Point3D &position)