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 "mitkVtkRepresentationProperty.h" 00020 00021 00022 mitk::VtkRepresentationProperty::VtkRepresentationProperty( ) 00023 { 00024 AddRepresentationTypes(); 00025 SetValue( static_cast<IdType>( VTK_SURFACE ) ); 00026 } 00027 00028 00029 mitk::VtkRepresentationProperty::VtkRepresentationProperty( const IdType& value ) 00030 { 00031 AddRepresentationTypes(); 00032 if ( IsValidEnumerationValue( value ) ) 00033 { 00034 SetValue( value ); 00035 } 00036 else 00037 { 00038 SetValue( static_cast<IdType>( VTK_SURFACE ) ); 00039 } 00040 } 00041 00042 00043 mitk::VtkRepresentationProperty::VtkRepresentationProperty( const std::string& value ) 00044 { 00045 AddRepresentationTypes(); 00046 if ( IsValidEnumerationValue( value ) ) 00047 { 00048 SetValue( value ); 00049 } 00050 else 00051 { 00052 SetValue( static_cast<IdType>( VTK_SURFACE ) ); 00053 } 00054 } 00055 00056 00057 int mitk::VtkRepresentationProperty::GetVtkRepresentation() 00058 { 00059 return static_cast<int>( GetValueAsId() ); 00060 } 00061 00062 00063 void mitk::VtkRepresentationProperty::SetRepresentationToPoints() 00064 { 00065 SetValue( static_cast<IdType>( VTK_POINTS ) ); 00066 } 00067 00068 00069 void mitk::VtkRepresentationProperty::SetRepresentationToWireframe() 00070 { 00071 SetValue( static_cast<IdType>( VTK_WIREFRAME ) ); 00072 } 00073 00074 00075 void mitk::VtkRepresentationProperty::SetRepresentationToSurface() 00076 { 00077 SetValue( static_cast<IdType>( VTK_SURFACE ) ); 00078 } 00079 00080 void mitk::VtkRepresentationProperty::AddRepresentationTypes() 00081 { 00082 AddEnum( "Points", static_cast<IdType>( VTK_POINTS ) ); 00083 AddEnum( "Wireframe", static_cast<IdType>( VTK_WIREFRAME ) ); 00084 AddEnum( "Surface", static_cast<IdType>( VTK_SURFACE ) ); 00085 } 00086 00087 00088 bool mitk::VtkRepresentationProperty::AddEnum( const std::string& name, const IdType& id ) 00089 { 00090 return Superclass::AddEnum( name, id ); 00091 }