Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkClippingProperty.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 "mitkClippingProperty.h"
14 
15 namespace mitk
16 {
17  ClippingProperty::ClippingProperty() : m_ClippingEnabled(false), m_Origin(0.0), m_Normal(0.0) {}
19  : BaseProperty(other),
21  m_Origin(other.m_Origin),
22  m_Normal(other.m_Normal)
23  {
24  }
25 
26  ClippingProperty::ClippingProperty(const Point3D &origin, const Vector3D &normal)
27  : m_ClippingEnabled(true), m_Origin(origin), m_Normal(normal)
28  {
29  }
30 
33  {
34  if (m_ClippingEnabled != enabled)
35  {
36  m_ClippingEnabled = enabled;
37  this->Modified();
38  }
39  }
40 
41  const Point3D &ClippingProperty::GetOrigin() const { return m_Origin; }
43  {
44  if (m_Origin != origin)
45  {
46  m_Origin = origin;
47  this->Modified();
48  }
49  }
50 
51  const Vector3D &ClippingProperty::GetNormal() const { return m_Normal; }
53  {
54  if (m_Normal != normal)
55  {
56  m_Normal = normal;
57  this->Modified();
58  }
59  }
60 
61  bool ClippingProperty::IsEqual(const BaseProperty &property) const
62  {
63  return ((this->m_ClippingEnabled == static_cast<const Self &>(property).m_ClippingEnabled) &&
64  (this->m_Origin == static_cast<const Self &>(property).m_Origin) &&
65  (this->m_Normal == static_cast<const Self &>(property).m_Normal));
66  }
67 
68  bool ClippingProperty::Assign(const BaseProperty &property)
69  {
70  this->m_ClippingEnabled = static_cast<const Self &>(property).m_ClippingEnabled;
71  this->m_Origin = static_cast<const Self &>(property).m_Origin;
72  this->m_Normal = static_cast<const Self &>(property).m_Normal;
73  return true;
74  }
75 
77  {
78  std::stringstream myStr;
79 
80  myStr << this->GetClippingEnabled() << this->GetOrigin() << this->GetNormal();
81  return myStr.str();
82  }
83 
84  itk::LightObject::Pointer ClippingProperty::InternalClone() const
85  {
86  itk::LightObject::Pointer result(new Self(*this));
87  result->UnRegister();
88  return result;
89  }
90 
91 } // namespace
Property for clipping datasets; currently only clipping planes are possible.
DataCollection - Class to facilitate loading/accessing structured data.
const Point3D & GetOrigin() const
Abstract base class for properties.
void SetOrigin(const Point3D &origin)
void SetClippingEnabled(bool enabled)
void SetNormal(const Vector3D &normal)
std::string GetValueAsString() const override
const Vector3D & GetNormal() const