static public ProjectionImpl makeProjection ( CoverageTransform gct , Formatter errInfo ) { // standard name String transform_name = gct . findAttValueIgnoreCase ( CF . GRID_MAPPING_NAME , null ) ; if ( null == transform_name ) { errInfo . format ( "**Failed to find Coordinate Transform name from GridCoordTransform= %s%n" , gct ) ; return null ; } transform_name = transform_name . trim ( ) ; // do we have a transform registered for this ? Class builderClass = null ; for ( Transform transform : transformList ) { if ( transform . transName . equals ( transform_name ) ) { builderClass = transform . transClass ; break ; } } if ( null == builderClass ) { errInfo . format ( "**Failed to find CoordTransBuilder name= %s from GridCoordTransform= %s%n" , transform_name , gct ) ; return null ; } // get an instance of that class HorizTransformBuilderIF builder ; try { builder = ( HorizTransformBuilderIF ) builderClass . newInstance ( ) ; } catch ( InstantiationException | IllegalAccessException e ) { log . error ( "Cant create new instance " + builderClass . getName ( ) , e ) ; return null ; } if ( null == builder ) { // cant happen - because this was tested in registerTransform() errInfo . format ( "**Failed to build CoordTransBuilder object from class= %s for GridCoordTransform= %s%n" , builderClass . getName ( ) , gct ) ; return null ; } String units = gct . findAttValueIgnoreCase ( CDM . UNITS , null ) ; builder . setErrorBuffer ( errInfo ) ; ProjectionCT ct = builder . makeCoordinateTransform ( gct , units ) ; assert ct != null ; return ct . getProjection ( ) ; }
Make a CoordinateTransform object from the parameters in a GridCoordTransform using an intrinsic or registered CoordTransBuilder .