00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _MITK_MATERIAL_H_
00019 #define _MITK_MATERIAL_H_
00020
00021 #include "mitkCommon.h"
00022 #include <itkRGBPixel.h>
00023 #include <itkObject.h>
00024 #include <itkVectorContainer.h>
00025 #include <vtkSystemIncludes.h>
00026 #include <string>
00027
00028 namespace mitk
00029 {
00030
00039 class MITK_CORE_EXPORT Material : public itk::Object
00040 {
00041 public:
00042 mitkClassMacro( Material, itk::Object );
00043
00044 typedef itk::RGBPixel<vtkFloatingPointType> Color;
00045
00046 enum InterpolationType
00047 {
00048 Flat, Gouraud, Phong
00049 };
00050
00051 enum RepresentationType
00052 {
00053 Points, Wireframe, Surface
00054 };
00055
00065 static Pointer New()
00066 {
00067 Pointer smartPtr = new Material( );
00068 smartPtr->UnRegister();
00069 return smartPtr;
00070 }
00071
00083 static Pointer New( Color color, vtkFloatingPointType opacity = 1.0f)
00084 {
00085 Pointer smartPtr = new Material(color, opacity );
00086 smartPtr->UnRegister();
00087 return smartPtr;
00088 }
00089
00102 static Pointer New( vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue, vtkFloatingPointType opacity = 1.0f)
00103 {
00104 Pointer smartPtr = new Material(red, green, blue, opacity );
00105 smartPtr->UnRegister();
00106 return smartPtr;
00107 }
00108
00127 static Pointer New( vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue, vtkFloatingPointType colorCoefficient,
00128 vtkFloatingPointType specularCoefficient, vtkFloatingPointType specularPower, vtkFloatingPointType opacity )
00129 {
00130 Pointer smartPtr = new Material(red, green, blue, colorCoefficient, specularCoefficient, specularPower, opacity );
00131 smartPtr->UnRegister();
00132 return smartPtr;
00133 }
00134
00153 static Pointer New( Color color, vtkFloatingPointType colorCoefficient, vtkFloatingPointType specularCoefficient, vtkFloatingPointType specularPower, vtkFloatingPointType opacity )
00154 {
00155 Pointer smartPtr = new Material(color, colorCoefficient, specularCoefficient, specularPower, opacity );
00156 smartPtr->UnRegister();
00157 return smartPtr;
00158 }
00159
00163 mitkNewMacro1Param(Material, const Material&);
00164
00169 static Pointer New( const Material& property, vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue, vtkFloatingPointType opacity = 1.0, std::string name = "" )
00170 {
00171 Pointer smartPtr = new Material(property, red, green, blue, opacity, name );
00172 smartPtr->UnRegister();
00173 return smartPtr;
00174 }
00175
00176 virtual bool Assignable(const Material& other) const;
00177 virtual Material& operator=(const Material& other);
00178
00179
00180
00181
00182
00183 virtual void SetColor( Color color );
00184
00192 virtual void SetColor( vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue );
00193
00199 virtual void SetColorCoefficient( vtkFloatingPointType coefficient );
00200
00206 virtual void SetSpecularColor( Color color );
00207
00214 virtual void SetSpecularColor( vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue );
00215
00222 virtual void SetSpecularCoefficient( vtkFloatingPointType specularCoefficient );
00223
00230 virtual void SetSpecularPower( vtkFloatingPointType specularPower );
00231
00238 virtual void SetOpacity( vtkFloatingPointType opacity );
00239
00247 virtual void SetInterpolation( InterpolationType interpolation );
00248
00256 virtual void SetRepresentation( RepresentationType representation );
00257
00261 virtual void SetLineWidth( float lineWidth );
00262
00266 virtual Color GetColor() const;
00267
00271 virtual vtkFloatingPointType GetColorCoefficient() const;
00272
00277 virtual Color GetSpecularColor() const;
00278
00282 virtual vtkFloatingPointType GetSpecularCoefficient() const;
00283
00287 virtual vtkFloatingPointType GetSpecularPower() const;
00288
00292 virtual vtkFloatingPointType GetOpacity() const;
00293
00297 virtual InterpolationType GetInterpolation() const;
00298
00302 virtual RepresentationType GetRepresentation() const;
00303
00308 virtual int GetVtkInterpolation() const;
00309
00314 virtual int GetVtkRepresentation() const;
00315
00319 virtual float GetLineWidth() const;
00320
00330 virtual void Initialize( const Material& property );
00331
00336 virtual bool operator==( const Material& property ) const;
00337
00341 void PrintSelf ( std::ostream &os ) const;
00342
00348 itkSetMacro( Name, std::string );
00349
00353 itkGetConstMacro( Name, std::string );
00354
00355 protected:
00356
00366 Material( );
00367
00379 Material( Color color, vtkFloatingPointType opacity = 1.0f );
00380
00393 Material( vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue, vtkFloatingPointType opacity = 1.0f );
00394
00413 Material( vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue, vtkFloatingPointType colorCoefficient,
00414 vtkFloatingPointType specularCoefficient, vtkFloatingPointType specularPower, vtkFloatingPointType opacity );
00415
00434 Material( Color color, vtkFloatingPointType colorCoefficient, vtkFloatingPointType specularCoefficient, vtkFloatingPointType specularPower, vtkFloatingPointType opacity );
00435
00439 Material( const Material& property );
00440
00445 Material( const Material& property, vtkFloatingPointType red, vtkFloatingPointType green, vtkFloatingPointType blue, vtkFloatingPointType opacity = 1.0, std::string name = "");
00446
00447
00448 virtual void InitializeStandardValues();
00449
00450 virtual void Update();
00451
00452 std::string m_Name;
00453
00454 Color m_Color;
00455
00456 Color m_SpecularColor;
00457
00458 vtkFloatingPointType m_ColorCoefficient;
00459
00460 vtkFloatingPointType m_SpecularCoefficient;
00461
00462 vtkFloatingPointType m_SpecularPower;
00463
00464 vtkFloatingPointType m_Opacity;
00465
00466 float m_LineWidth;
00467
00468 InterpolationType m_Interpolation;
00469
00470 RepresentationType m_Representation;
00471 };
00472
00473 typedef itk::VectorContainer< unsigned int, Material::Pointer > MaterialVectorContainer;
00474
00475 }
00476
00477
00478 #endif