00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 00019 #include "mitkPropertyManager.h" 00020 #include "mitkProperties.h" 00021 #include <limits> 00022 00023 mitk::PropertyManager::PropertyManager() 00024 { 00025 m_DefaultPropertyNameSet.insert(std::string("visible")); 00026 m_PropertyLimits.insert(std::make_pair("opacity",std::make_pair(0.0f,1.0f))); 00027 } 00028 mitk::PropertyManager* mitk::PropertyManager::GetInstance() 00029 { 00030 static mitk::PropertyManager propManager; 00031 return &propManager; 00032 } 00033 const mitk::PropertyManager::PropertyNameSet& mitk::PropertyManager::GetDefaultPropertyNames() 00034 { 00035 return m_DefaultPropertyNameSet; 00036 }; 00037 mitk::BaseProperty::Pointer mitk::PropertyManager::CreateDefaultProperty(std::string name) 00038 { 00039 mitk::BaseProperty::Pointer newProperty(NULL); 00040 if ( name == "visible" ) 00041 { 00042 newProperty = mitk::BoolProperty::New(true); 00043 } 00044 else 00045 { 00046 //MITK_INFO << "Warning: non-existing default property requested: " << name << std::endl; 00047 } 00048 return newProperty; 00049 } 00050 bool mitk::PropertyManager::GetDefaultLimits(const std::string &name,std::pair<float,float> &minMax) 00051 { 00052 PropertyLimitsMap::iterator it = m_PropertyLimits.find(name.c_str()); 00053 if (it != m_PropertyLimits.end()) 00054 { 00055 minMax = it->second; 00056 return true; 00057 } 00058 else 00059 { 00060 minMax = std::make_pair(std::numeric_limits<float>::min(),std::numeric_limits<float>::max()); 00061 return false; 00062 } 00063 }