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 #include <vtkProperty.h> 00019 #include "mitkVtkInterpolationProperty.h" 00020 00021 00022 00023 mitk::VtkInterpolationProperty::VtkInterpolationProperty( ) 00024 { 00025 AddInterpolationTypes(); 00026 SetValue( static_cast<IdType>( VTK_GOURAUD ) ); 00027 } 00028 00029 00030 mitk::VtkInterpolationProperty::VtkInterpolationProperty( const IdType& value ) 00031 { 00032 AddInterpolationTypes(); 00033 if ( IsValidEnumerationValue( value ) ) 00034 { 00035 SetValue( value ) ; 00036 } 00037 else 00038 { 00039 SetValue( static_cast<IdType>( VTK_GOURAUD ) ); 00040 } 00041 } 00042 00043 mitk::VtkInterpolationProperty::VtkInterpolationProperty( const std::string& value ) 00044 { 00045 AddInterpolationTypes(); 00046 if ( IsValidEnumerationValue( value ) ) 00047 { 00048 SetValue( value ); 00049 } 00050 else 00051 { 00052 SetValue( static_cast<IdType>( VTK_GOURAUD ) ); 00053 } 00054 } 00055 00056 00057 int mitk::VtkInterpolationProperty::GetVtkInterpolation() 00058 { 00059 return static_cast<int>( GetValueAsId() ); 00060 } 00061 00062 00063 void mitk::VtkInterpolationProperty::SetInterpolationToFlat() 00064 { 00065 SetValue( static_cast<IdType>( VTK_FLAT ) ); 00066 } 00067 00068 00069 void mitk::VtkInterpolationProperty::SetInterpolationToGouraud() 00070 { 00071 SetValue( static_cast<IdType>( VTK_GOURAUD ) ); 00072 } 00073 00074 00075 void mitk::VtkInterpolationProperty::SetInterpolationToPhong() 00076 { 00077 SetValue( static_cast<IdType>( VTK_PHONG ) ); 00078 } 00079 00080 00081 void mitk::VtkInterpolationProperty::AddInterpolationTypes() 00082 { 00083 AddEnum( "Flat", static_cast<IdType>( VTK_FLAT ) ); 00084 AddEnum( "Gouraud", static_cast<IdType>( VTK_GOURAUD ) ); 00085 AddEnum( "Phong", static_cast<IdType>( VTK_PHONG ) ); 00086 } 00087 00088 00089 bool mitk::VtkInterpolationProperty::AddEnum( const std::string& name, const IdType& id ) 00090 { 00091 return Superclass::AddEnum( name, id ); 00092 }