#include #include #include #include // ------------------------------------------------------------------------- template< class M > typename cpm::VTK::MeshMapper< M >:: Self* cpm::VTK::MeshMapper< M >:: New( ) { return( cpm::VTK::OpenGLMeshMapper< M >::New( ) ); } // ------------------------------------------------------------------------- template< class M > void cpm::VTK::MeshMapper< M >:: ShallowCopy( vtkAbstractMapper* m ) { Self* mapper = Self::SafeDownCast( m ); if( m != NULL ) this->SetInputData( mapper->GetInput( ) ); this->vtkMapper::ShallowCopy( m ); } // ------------------------------------------------------------------------- template< class M > void cpm::VTK::MeshMapper< M >:: SetInputData( M* in ) { if( this->Mesh != in ) { this->Mesh = in; this->Modified( ); } // fi } // ------------------------------------------------------------------------- template< class M > M* cpm::VTK::MeshMapper< M >:: GetInput( ) { return( this->Mesh ); } // ------------------------------------------------------------------------- template< class M > const M* cpm::VTK::MeshMapper< M >:: GetInput( ) const { return( this->Mesh ); } // ------------------------------------------------------------------------- template< class M > double* cpm::VTK::MeshMapper< M >:: GetBounds( ) { // do we have an input if( this->Mesh.IsNull( ) ) { vtkMath::UninitializeBounds( this->Bounds ); return( this->Bounds ); } else { this->Mesh->Update( ); this->ComputeBounds( ); if( !vtkMath::AreBoundsInitialized( this->Bounds ) ) return( NULL ); return( this->Bounds ); } // fi } // ------------------------------------------------------------------------- template< class M > void cpm::VTK::MeshMapper< M >:: GetBounds( double bounds[ 6 ] ) { this->Superclass::GetBounds( bounds ); } // ------------------------------------------------------------------------- template< class M > void cpm::VTK::MeshMapper< M >:: Render( vtkRenderer* aren, vtkActor* act ) { if( this->Mesh.IsNull( ) ) { vtkErrorMacro( "Mapper has no input." ); return; } // fi this->RenderPiece( aren, act ); } // ------------------------------------------------------------------------- template< class M > void cpm::VTK::MeshMapper< M >:: Update( ) { // TODO: std::cout << "Update( )" << std::endl; } // ------------------------------------------------------------------------- template< class M > void cpm::VTK::MeshMapper< M >:: Update( int port ) { // TODO: std::cout << "Update( port = " << port << " ) "<< std::endl; } // ------------------------------------------------------------------------- template< class M > void cpm::VTK::MeshMapper< M >:: MapDataArrayToVertexAttribute( const char* vertexAttributeName, const char* dataArrayName, int fieldAssociation, int componentno ) { vtkErrorMacro( "Not implemented at this level..." ); } // ------------------------------------------------------------------------- template< class M > void cpm::VTK::MeshMapper< M >:: MapDataArrayToMultiTextureAttribute( int unit, const char* dataArrayName, int fieldAssociation, int componentno ) { vtkErrorMacro( "Not implemented at this level..." ); } // ------------------------------------------------------------------------- template< class M > void cpm::VTK::MeshMapper< M >:: RemoveVertexAttributeMapping( const char* vertexAttributeName ) { vtkErrorMacro( "Not implemented at this level..." ); } // ------------------------------------------------------------------------- template< class M > void cpm::VTK::MeshMapper< M >:: RemoveAllVertexAttributeMappings( ) { vtkErrorMacro( "Not implemented at this level..." ); } // ------------------------------------------------------------------------- template< class M > cpm::VTK::MeshMapper< M >:: MeshMapper( ) : Superclass( ) { } // ------------------------------------------------------------------------- template< class M > cpm::VTK::MeshMapper< M >:: ~MeshMapper( ) { } // ------------------------------------------------------------------------- template< class M > void cpm::VTK::MeshMapper< M >:: ComputeBounds( ) { static const TScalar _0 = TScalar( 0 ); if( this->Mesh.IsNotNull( ) ) { const typename M::BoundingBoxType* bb = this->Mesh->GetBoundingBox( ); TPoint minP = bb->GetMinimum( ); TPoint maxP = bb->GetMaximum( ); this->Bounds[ 0 ] = double( ( Self::Dimension >= 1 )? minP[ 0 ]: _0 ); this->Bounds[ 1 ] = double( ( Self::Dimension >= 1 )? maxP[ 0 ]: _0 ); this->Bounds[ 2 ] = double( ( Self::Dimension >= 2 )? minP[ 1 ]: _0 ); this->Bounds[ 3 ] = double( ( Self::Dimension >= 2 )? maxP[ 1 ]: _0 ); this->Bounds[ 4 ] = double( ( Self::Dimension >= 3 )? minP[ 2 ]: _0 ); this->Bounds[ 5 ] = double( ( Self::Dimension >= 3 )? maxP[ 2 ]: _0 ); } else { this->Bounds[ 0 ] = this->Bounds[ 1 ] = this->Bounds[ 2 ] = this->Bounds[ 3 ] = this->Bounds[ 4 ] = this->Bounds[ 5 ] = double( 0 ); } // fi } // ------------------------------------------------------------------------- template< class M > int cpm::VTK::MeshMapper< M >:: FillInputPortInformation( int port, vtkInformation* info ) { info->Set( vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE( ), "itk::Mesh" ); return( 1 ); } // ------------------------------------------------------------------------- #include #include using namespace cpm::DataStructures; using namespace cpm::VTK; template class MeshMapper< QuadEdgeMesh< float, 2 > >; template class MeshMapper< QuadEdgeMesh< float, 3 > >; template class MeshMapper< QuadEdgeMesh< double, 2 > >; template class MeshMapper< QuadEdgeMesh< double, 3 > >; template class MeshMapper< SimplexMesh< float, 2 > >; template class MeshMapper< SimplexMesh< float, 3 > >; template class MeshMapper< SimplexMesh< double, 2 > >; template class MeshMapper< SimplexMesh< double, 3 > >; // eof - $RCSfile$