diff --git a/Core/Code/DataManagement/mitkNodePredicateProperty.cpp b/Core/Code/DataManagement/mitkNodePredicateProperty.cpp index 555fd9fffb..6c32ddbd22 100644 --- a/Core/Code/DataManagement/mitkNodePredicateProperty.cpp +++ b/Core/Code/DataManagement/mitkNodePredicateProperty.cpp @@ -1,58 +1,53 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkNodePredicateProperty.h" #include "mitkDataNode.h" -mitk::NodePredicateProperty::NodePredicateProperty(const char* propertyName, mitk::BaseProperty* p) -: NodePredicateBase(), m_ValidProperty(p), m_ValidPropertyName(propertyName) -{ -} - -mitk::NodePredicateProperty::NodePredicateProperty(const char* propertyName) -: NodePredicateBase(), m_ValidProperty(NULL), m_ValidPropertyName(propertyName) +mitk::NodePredicateProperty::NodePredicateProperty(const char* propertyName, mitk::BaseProperty* p, const mitk::BaseRenderer *renderer) +: NodePredicateBase(), m_ValidProperty(p), m_ValidPropertyName(propertyName), m_Renderer(renderer) { } mitk::NodePredicateProperty::~NodePredicateProperty() { } bool mitk::NodePredicateProperty::CheckNode(const mitk::DataNode* node) const { if (node == NULL) throw std::invalid_argument("NodePredicateProperty: invalid node"); if (m_ValidPropertyName.empty()) throw std::invalid_argument("NodePredicateProperty: invalid property name"); // check, if any of the properties of node are equal to m_ValidProperty. if (m_ValidProperty.IsNull()) //if (m_ValidProperty==NULL) { - return (node->GetPropertyList()->GetProperty(m_ValidPropertyName.c_str()) != NULL); // search only for name + return (node->GetProperty(m_ValidPropertyName.c_str(), m_Renderer) != NULL); // search only for name } else { - mitk::BaseProperty::Pointer p = node->GetPropertyList()->GetProperty(m_ValidPropertyName.c_str()); + mitk::BaseProperty::Pointer p = node->GetProperty(m_ValidPropertyName.c_str(), m_Renderer); if (p.IsNull()) return false; return (*p == *m_ValidProperty); // search for name and property } } diff --git a/Core/Code/DataManagement/mitkNodePredicateProperty.h b/Core/Code/DataManagement/mitkNodePredicateProperty.h index 595d70d1f2..cd3837f19f 100644 --- a/Core/Code/DataManagement/mitkNodePredicateProperty.h +++ b/Core/Code/DataManagement/mitkNodePredicateProperty.h @@ -1,66 +1,67 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef MITKNODEPREDICATEPROPERTY_H_HEADER_INCLUDED_ #define MITKNODEPREDICATEPROPERTY_H_HEADER_INCLUDED_ #include "mitkNodePredicateBase.h" #include "mitkBaseProperty.h" #include "mitkWeakPointer.h" +#include "mitkBaseRenderer.h" namespace mitk { //##Documentation //## @brief Predicate that evaluates if the given DataNode has a specific property. //## If the second parameter is NULL, it will only be checked whether there is a property with the specified name. + //## If a renderer is specified in the third parameter the renderer-specific property will be checked. If this + //## parameter is NULL or not specified, then the non-renderer-specific property will be checked. //## //## //## //## @ingroup DataStorage class MITK_CORE_EXPORT NodePredicateProperty : public NodePredicateBase { public: mitkClassMacro(NodePredicateProperty, NodePredicateBase); mitkNewMacro1Param(NodePredicateProperty, const char*); mitkNewMacro2Param(NodePredicateProperty, const char*, mitk::BaseProperty*); + mitkNewMacro3Param(NodePredicateProperty, const char*, mitk::BaseProperty*, const mitk::BaseRenderer*); //##Documentation //## @brief Standard Destructor virtual ~NodePredicateProperty(); //##Documentation //## @brief Checks, if the nodes contains a property that is equal to m_ValidProperty virtual bool CheckNode(const mitk::DataNode* node) const; protected: //##Documentation //## @brief Constructor to check for a named property - NodePredicateProperty(const char* propertyName, mitk::BaseProperty* p); - - //##Documentation - //## @brief Constructor to check for the existence of a property with a given name - NodePredicateProperty(const char* propertyName); + NodePredicateProperty(const char* propertyName, mitk::BaseProperty* p=0, const mitk::BaseRenderer *renderer=0); //mitk::WeakPointer m_ValidProperty; mitk::BaseProperty::Pointer m_ValidProperty; //mitk::BaseProperty* m_ValidProperty; std::string m_ValidPropertyName; + const mitk::BaseRenderer *m_Renderer; }; } // namespace mitk #endif /* MITKNODEPREDICATEPROPERTY_H_HEADER_INCLUDED_ */