]> Creatis software - cpMesh.git/blob - lib/cpm/VTK/MeshMapper.h
73d80ec9c60732051e3d74359b88d745d7b3e375
[cpMesh.git] / lib / cpm / VTK / MeshMapper.h
1 #ifndef __CPM__VTK__MESHMAPPER__H__
2 #define __CPM__VTK__MESHMAPPER__H__
3
4 #include <itkConceptChecking.h>
5 #include <vtkMapper.h>
6
7 class vtkActor;
8 class vtkInformation;
9 class vtkRenderer;
10
11 namespace cpm
12 {
13   namespace VTK
14   {
15     /**
16      */
17     template< class M >
18     class MeshMapper
19       : public vtkMapper
20     {
21     public:
22       typedef MeshMapper Self;
23       vtkTypeMacro( MeshMapper, vtkMapper );
24
25       typedef M                             TMesh;
26       typedef typename M::PointType         TPoint;
27       typedef typename TPoint::VectorType   TVector;
28       typedef typename TPoint::CoordRepType TScalar;
29       itkStaticConstMacro( Dimension, unsigned int, M::PointDimension );
30
31       // Begin concept checking
32 #ifdef ITK_USE_CONCEPT_CHECKING
33       /* TODO
34          itkConceptMacro(
35          InputMeshIsTwoOrThreeimensionalCheck,
36          ( itk::Concept::SameDimensionOrMinusOne< Self::Dimension, 3 > )
37          );
38          itkConceptMacro(
39          ScalarTypeHasFloatResolution,
40          ( itk::Concept::IsFloatingPoint< TScalar > )
41          );
42       */
43 #endif
44       // End concept checking
45
46     public:
47       static Self* New( );
48       virtual void ShallowCopy( vtkAbstractMapper* m );
49
50       virtual void SetInputData( M* in );
51       virtual M* GetInput( );
52       virtual const M* GetInput( ) const;
53
54       virtual double* GetBounds( );
55       virtual void GetBounds( double bounds[ 6 ] );
56
57       virtual void RenderPiece( vtkRenderer* aren, vtkActor* act ) = 0;
58       virtual void Render( vtkRenderer* aren, vtkActor* act );
59       virtual void Update( );
60       virtual void Update( int port );
61
62       virtual void MapDataArrayToVertexAttribute(
63         const char* vertexAttributeName,
64         const char* dataArrayName,
65         int fieldAssociation,
66         int componentno = -1
67         );
68       virtual void MapDataArrayToMultiTextureAttribute(
69         int unit,
70         const char* dataArrayName,
71         int fieldAssociation,
72         int componentno = -1
73         );
74       virtual void RemoveVertexAttributeMapping(
75         const char* vertexAttributeName
76         );
77       virtual void RemoveAllVertexAttributeMappings( );
78
79     protected:
80       MeshMapper( );
81       virtual ~MeshMapper( );
82
83       virtual void ComputeBounds( );
84       virtual int FillInputPortInformation( int port, vtkInformation* info );
85
86     private:
87       // These methods aren't supposed to be implemented
88       MeshMapper( const Self& other );
89       Self& operator=( const Self& other );
90
91     protected:
92       typename M::Pointer Mesh;
93     };
94
95   } // ecapseman
96
97 } // ecapseman
98
99 #endif // __CPM__VTK__MESHMAPPER__H__
100
101 // eof - $RCSfile$