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
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,
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 
18 #include "mitkDataNode.h"
19 
22  const mitk::BaseRenderer *renderer)
23  : NodePredicateBase(), m_ValidProperty(p), m_ValidPropertyName(propertyName), m_Renderer(renderer)
24 {
25 }
26 
28 {
29 }
30 
32 {
33  if (node == NULL)
34  throw std::invalid_argument("NodePredicateProperty: invalid node");
35 
36  if (m_ValidPropertyName.empty())
37  throw std::invalid_argument("NodePredicateProperty: invalid property name");
38 
39  // check, if any of the properties of node are equal to m_ValidProperty.
40  if (m_ValidProperty.IsNull())
41  // if (m_ValidProperty==NULL)
42  {
43  return (node->GetProperty(m_ValidPropertyName.c_str(), m_Renderer) != NULL); // search only for name
44  }
45  else
46  {
47  mitk::BaseProperty::Pointer p = node->GetProperty(m_ValidPropertyName.c_str(), m_Renderer);
48  if (p.IsNull())
49  return false;
50  return (*p == *m_ValidProperty); // search for name and property
51  }
52 }
Organizes the rendering process.
mitk::BaseProperty * GetProperty(const char *propertyKey, const mitk::BaseRenderer *renderer=nullptr) const
Get the property (instance of BaseProperty) with key propertyKey from the PropertyList of the rendere...
virtual ~NodePredicateProperty()
Standard Destructor.
Abstract base class for properties.
virtual 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(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:66