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