1 #ifndef __CPPLUGINS__EXTENSIONS__MESHMAPPER__HXX__
2 #define __CPPLUGINS__EXTENSIONS__MESHMAPPER__HXX__
4 #include <vtkInformation.h>
7 // TODO: #include <cpPlugins/Extensions/OpenGLMeshMapper.h>
9 // -------------------------------------------------------------------------
12 typename cpPlugins::Extensions::MeshMapper< M >::
13 Self* cpPlugins::Extensions::MeshMapper< M >::
16 return( cpPlugins::Extensions::OpenGLMeshMapper< M >::New( ) );
20 // -------------------------------------------------------------------------
22 void cpPlugins::Extensions::MeshMapper< M >::
23 ShallowCopy( vtkAbstractMapper* m )
25 Self* mapper = Self::SafeDownCast( m );
27 this->SetInputData( mapper->GetInput( ) );
28 this->vtkMapper::ShallowCopy( m );
31 // -------------------------------------------------------------------------
33 void cpPlugins::Extensions::MeshMapper< M >::
36 if( this->Mesh != in )
44 // -------------------------------------------------------------------------
46 M* cpPlugins::Extensions::MeshMapper< M >::
52 // -------------------------------------------------------------------------
54 const M* cpPlugins::Extensions::MeshMapper< M >::
60 // -------------------------------------------------------------------------
62 double* cpPlugins::Extensions::MeshMapper< M >::
65 // do we have an input
66 if( this->Mesh.IsNull( ) )
68 vtkMath::UninitializeBounds( this->Bounds );
69 return( this->Bounds );
73 this->Mesh->Update( );
74 this->ComputeBounds( );
76 if( !vtkMath::AreBoundsInitialized( this->Bounds ) )
78 return( this->Bounds );
83 // -------------------------------------------------------------------------
85 void cpPlugins::Extensions::MeshMapper< M >::
86 GetBounds( double bounds[ 6 ] )
88 this->Superclass::GetBounds( bounds );
91 // -------------------------------------------------------------------------
93 void cpPlugins::Extensions::MeshMapper< M >::
94 Render( vtkRenderer* aren, vtkActor* act )
96 if( this->Mesh.IsNull( ) )
98 vtkErrorMacro( "Mapper has no input." );
102 this->RenderPiece( aren, act );
105 // -------------------------------------------------------------------------
107 void cpPlugins::Extensions::MeshMapper< M >::
111 std::cout << "Update( )" << std::endl;
114 // -------------------------------------------------------------------------
116 void cpPlugins::Extensions::MeshMapper< M >::
120 std::cout << "Update( port = " << port << " ) "<< std::endl;
123 // -------------------------------------------------------------------------
125 void cpPlugins::Extensions::MeshMapper< M >::
126 MapDataArrayToVertexAttribute(
127 const char* vertexAttributeName,
128 const char* dataArrayName,
129 int fieldAssociation,
133 vtkErrorMacro( "Not implemented at this level..." );
136 // -------------------------------------------------------------------------
138 void cpPlugins::Extensions::MeshMapper< M >::
139 MapDataArrayToMultiTextureAttribute(
141 const char* dataArrayName,
142 int fieldAssociation,
146 vtkErrorMacro( "Not implemented at this level..." );
149 // -------------------------------------------------------------------------
151 void cpPlugins::Extensions::MeshMapper< M >::
152 RemoveVertexAttributeMapping( const char* vertexAttributeName )
154 vtkErrorMacro( "Not implemented at this level..." );
157 // -------------------------------------------------------------------------
159 void cpPlugins::Extensions::MeshMapper< M >::
160 RemoveAllVertexAttributeMappings( )
162 vtkErrorMacro( "Not implemented at this level..." );
165 // -------------------------------------------------------------------------
167 cpPlugins::Extensions::MeshMapper< M >::
173 // -------------------------------------------------------------------------
175 cpPlugins::Extensions::MeshMapper< M >::
180 // -------------------------------------------------------------------------
182 void cpPlugins::Extensions::MeshMapper< M >::
185 static const TScalar _0 = TScalar( 0 );
186 if( this->Mesh.IsNotNull( ) )
188 const typename M::BoundingBoxType* bb = this->Mesh->GetBoundingBox( );
189 TPoint minP = bb->GetMinimum( );
190 TPoint maxP = bb->GetMaximum( );
191 this->Bounds[ 0 ] = double( ( Self::Dimension >= 1 )? minP[ 0 ]: _0 );
192 this->Bounds[ 1 ] = double( ( Self::Dimension >= 1 )? maxP[ 0 ]: _0 );
193 this->Bounds[ 2 ] = double( ( Self::Dimension >= 2 )? minP[ 1 ]: _0 );
194 this->Bounds[ 3 ] = double( ( Self::Dimension >= 2 )? maxP[ 1 ]: _0 );
195 this->Bounds[ 4 ] = double( ( Self::Dimension >= 3 )? minP[ 2 ]: _0 );
196 this->Bounds[ 5 ] = double( ( Self::Dimension >= 3 )? maxP[ 2 ]: _0 );
211 // -------------------------------------------------------------------------
213 int cpPlugins::Extensions::MeshMapper< M >::
214 FillInputPortInformation( int port, vtkInformation* info )
216 info->Set( vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE( ), "itk::Mesh" );
220 #endif // __CPPLUGINS__EXTENSIONS__MESHMAPPER__HXX__