1 #ifndef __CPPLUGINS__EXTENSIONS__VISUALIZATION__MESHMAPPER__HXX__
2 #define __CPPLUGINS__EXTENSIONS__VISUALIZATION__MESHMAPPER__HXX__
4 #include <vtkInformation.h>
7 // TODO: #include <cpPlugins/Extensions/Visualization/OpenGLMeshMapper.h>
9 // -------------------------------------------------------------------------
12 typename cpPlugins::Extensions::Visualization::MeshMapper< M >::
13 Self* cpPlugins::Extensions::Visualization::MeshMapper< M >::
17 cpPlugins::Extensions::Visualization::OpenGLMeshMapper< M >::New( )
22 // -------------------------------------------------------------------------
24 void cpPlugins::Extensions::Visualization::MeshMapper< M >::
25 ShallowCopy( vtkAbstractMapper* m )
27 Self* mapper = Self::SafeDownCast( m );
29 this->SetInputData( mapper->GetInput( ) );
30 this->vtkMapper::ShallowCopy( m );
33 // -------------------------------------------------------------------------
35 void cpPlugins::Extensions::Visualization::MeshMapper< M >::
38 if( this->Mesh != in )
46 // -------------------------------------------------------------------------
48 M* cpPlugins::Extensions::Visualization::MeshMapper< M >::
54 // -------------------------------------------------------------------------
56 const M* cpPlugins::Extensions::Visualization::MeshMapper< M >::
62 // -------------------------------------------------------------------------
64 double* cpPlugins::Extensions::Visualization::MeshMapper< M >::
67 // do we have an input
68 if( this->Mesh.IsNull( ) )
70 vtkMath::UninitializeBounds( this->Bounds );
71 return( this->Bounds );
75 this->Mesh->Update( );
76 this->ComputeBounds( );
78 if( !vtkMath::AreBoundsInitialized( this->Bounds ) )
80 return( this->Bounds );
85 // -------------------------------------------------------------------------
87 void cpPlugins::Extensions::Visualization::MeshMapper< M >::
88 GetBounds( double bounds[ 6 ] )
90 this->Superclass::GetBounds( bounds );
93 // -------------------------------------------------------------------------
95 void cpPlugins::Extensions::Visualization::MeshMapper< M >::
96 Render( vtkRenderer* aren, vtkActor* act )
98 if( this->Mesh.IsNull( ) )
100 vtkErrorMacro( "Mapper has no input." );
104 this->RenderPiece( aren, act );
107 // -------------------------------------------------------------------------
109 void cpPlugins::Extensions::Visualization::MeshMapper< M >::
113 std::cout << "Update( )" << std::endl;
116 // -------------------------------------------------------------------------
118 void cpPlugins::Extensions::Visualization::MeshMapper< M >::
122 std::cout << "Update( port = " << port << " ) "<< std::endl;
125 // -------------------------------------------------------------------------
127 void cpPlugins::Extensions::Visualization::MeshMapper< M >::
128 MapDataArrayToVertexAttribute(
129 const char* vertexAttributeName,
130 const char* dataArrayName,
131 int fieldAssociation,
135 vtkErrorMacro( "Not implemented at this level..." );
138 // -------------------------------------------------------------------------
140 void cpPlugins::Extensions::Visualization::MeshMapper< M >::
141 MapDataArrayToMultiTextureAttribute(
143 const char* dataArrayName,
144 int fieldAssociation,
148 vtkErrorMacro( "Not implemented at this level..." );
151 // -------------------------------------------------------------------------
153 void cpPlugins::Extensions::Visualization::MeshMapper< M >::
154 RemoveVertexAttributeMapping( const char* vertexAttributeName )
156 vtkErrorMacro( "Not implemented at this level..." );
159 // -------------------------------------------------------------------------
161 void cpPlugins::Extensions::Visualization::MeshMapper< M >::
162 RemoveAllVertexAttributeMappings( )
164 vtkErrorMacro( "Not implemented at this level..." );
167 // -------------------------------------------------------------------------
169 cpPlugins::Extensions::Visualization::MeshMapper< M >::
175 // -------------------------------------------------------------------------
177 cpPlugins::Extensions::Visualization::MeshMapper< M >::
182 // -------------------------------------------------------------------------
184 void cpPlugins::Extensions::Visualization::MeshMapper< M >::
187 static const TScalar _0 = TScalar( 0 );
188 if( this->Mesh.IsNotNull( ) )
190 const typename M::BoundingBoxType* bb = this->Mesh->GetBoundingBox( );
191 TPoint minP = bb->GetMinimum( );
192 TPoint maxP = bb->GetMaximum( );
193 this->Bounds[ 0 ] = double( ( Self::Dimension >= 1 )? minP[ 0 ]: _0 );
194 this->Bounds[ 1 ] = double( ( Self::Dimension >= 1 )? maxP[ 0 ]: _0 );
195 this->Bounds[ 2 ] = double( ( Self::Dimension >= 2 )? minP[ 1 ]: _0 );
196 this->Bounds[ 3 ] = double( ( Self::Dimension >= 2 )? maxP[ 1 ]: _0 );
197 this->Bounds[ 4 ] = double( ( Self::Dimension >= 3 )? minP[ 2 ]: _0 );
198 this->Bounds[ 5 ] = double( ( Self::Dimension >= 3 )? maxP[ 2 ]: _0 );
213 // -------------------------------------------------------------------------
215 int cpPlugins::Extensions::Visualization::MeshMapper< M >::
216 FillInputPortInformation( int port, vtkInformation* info )
218 info->Set( vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE( ), "itk::Mesh" );
222 #endif // __CPPLUGINS__EXTENSIONS__VISUALIZATION__MESHMAPPER__HXX__