Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkNodePredicateProperty.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 
14 #include "mitkDataNode.h"
15 
18  const mitk::BaseRenderer *renderer)
19  : NodePredicateBase(), m_ValidProperty(p), m_ValidPropertyName(propertyName), m_Renderer(renderer)
20 {
21 }
22 
24 {
25 }
26 
28 {
29  if (node == nullptr)
30  throw std::invalid_argument("NodePredicateProperty: invalid node");
31 
32  if (m_ValidPropertyName.empty())
33  throw std::invalid_argument("NodePredicateProperty: invalid property name");
34 
35  // check, if any of the properties of node are equal to m_ValidProperty.
36  if (m_ValidProperty.IsNull())
37  // if (m_ValidProperty==nullptr)
38  {
39  return (node->GetProperty(m_ValidPropertyName.c_str(), m_Renderer) != nullptr); // search only for name
40  }
41  else
42  {
44  if (p.IsNull())
45  return false;
46  return (*p == *m_ValidProperty); // search for name and property
47  }
48 }
mitk::BaseProperty * GetProperty(const char *propertyKey, const mitk::BaseRenderer *renderer=nullptr, bool fallBackOnDataProperties=true) const
Get the property (instance of BaseProperty) with key propertyKey from the PropertyList of the rendere...
mitk::BaseProperty::Pointer m_ValidProperty
Organizes the rendering process.
const mitk::BaseRenderer * m_Renderer
Abstract base class for properties.
bool CheckNode(const mitk::DataNode *node) const override
Checks, if the nodes contains a property that is equal to m_ValidProperty.
Interface for evaluation conditions used in the DataStorage class GetSubset() method.
~NodePredicateProperty() override
Standard Destructor.
NodePredicateProperty(const char *propertyName, mitk::BaseProperty *p=nullptr, const mitk::BaseRenderer *renderer=nullptr)
Constructor to check for a named property.
Class for nodes of the DataTree.
Definition: mitkDataNode.h:57