00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date: 2007-12-11 14:46:19 +0100 (Di, 11 Dez 2007) $ 00006 Version: $Revision: 13129 $ 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 #include "mitkPlaneOrientationProperty.h" 00019 00020 00021 namespace mitk 00022 { 00023 00024 00025 PlaneOrientationProperty::PlaneOrientationProperty( ) 00026 { 00027 this->AddDecorationTypes(); 00028 this->SetValue( static_cast<IdType>( PLANE_DECORATION_NONE ) ); 00029 } 00030 00031 00032 PlaneOrientationProperty::PlaneOrientationProperty( const IdType& value ) 00033 { 00034 this->AddDecorationTypes(); 00035 if ( this->IsValidEnumerationValue( value ) ) 00036 { 00037 this->SetValue( value ) ; 00038 } 00039 else 00040 { 00041 this->SetValue( static_cast<IdType>( PLANE_DECORATION_NONE ) ); 00042 } 00043 } 00044 00045 PlaneOrientationProperty::PlaneOrientationProperty( const std::string& value ) 00046 { 00047 this->AddDecorationTypes(); 00048 if ( this->IsValidEnumerationValue( value ) ) 00049 { 00050 this->SetValue( value ); 00051 } 00052 else 00053 { 00054 this->SetValue( static_cast<IdType>( PLANE_DECORATION_NONE ) ); 00055 } 00056 } 00057 00058 00059 int PlaneOrientationProperty::GetPlaneDecoration() 00060 { 00061 return static_cast<int>( this->GetValueAsId() ); 00062 } 00063 00064 00065 void PlaneOrientationProperty::SetPlaneDecorationToNone() 00066 { 00067 this->SetValue( static_cast<IdType>( PLANE_DECORATION_NONE ) ); 00068 } 00069 00070 00071 void PlaneOrientationProperty::SetPlaneDecorationToPositiveOrientation() 00072 { 00073 this->SetValue( static_cast<IdType>( PLANE_DECORATION_POSITIVE_ORIENTATION ) ); 00074 } 00075 00076 00077 void PlaneOrientationProperty::SetPlaneDecorationToNegativeOrientation() 00078 { 00079 this->SetValue( static_cast<IdType>( PLANE_DECORATION_NEGATIVE_ORIENTATION ) ); 00080 } 00081 00082 00083 void PlaneOrientationProperty::AddDecorationTypes() 00084 { 00085 this->AddEnum( "No plane decoration", static_cast<IdType>( PLANE_DECORATION_NONE ) ); 00086 this->AddEnum( "Arrows in positive direction", static_cast<IdType>( PLANE_DECORATION_POSITIVE_ORIENTATION ) ); 00087 this->AddEnum( "Arrows in negative direction", static_cast<IdType>( PLANE_DECORATION_NEGATIVE_ORIENTATION ) ); 00088 } 00089 00090 00091 bool PlaneOrientationProperty::AddEnum( const std::string& name, const IdType& id ) 00092 { 00093 return Superclass::AddEnum( name, id ); 00094 } 00095 00096 00097 } // namespace