/** * @param graphics * @param width * @param height * @param envelope */ public Java2DTileRenderer( Graphics2D graphics, int width, int height, Envelope envelope ) { this.graphics = graphics; RenderHelper.getWorldToScreenTransform( worldToScreen, envelope, width, height ); }
/** * @param graphics * @param width * @param height * @param bbox */ public Java2DRenderer( Graphics2D graphics, int width, int height, Envelope bbox ) { this.graphics = graphics; this.width = width; if ( bbox != null ) { Pair<Envelope, DoublePair> p = RenderHelper.getWorldToScreenTransform( worldToScreen, bbox, width, height ); double scalex = p.second.first; double scaley = p.second.second; bbox = p.first; res = calculateResolution( bbox, width ); LOG.debug( "For coordinate transformations, scaling by x = {} and y = {}", scalex, -scaley ); LOG.trace( "Final transformation was {}", worldToScreen ); } else { LOG.warn( "No envelope given, proceeding with a scale of 1." ); } initRenderers( bbox ); }
/** * @param graphics * @param width * @param height * @param bbox */ public Java2DRasterRenderer( Graphics2D graphics, int width, int height, Envelope bbox ) { this.graphics = graphics; this.width = width; this.height = height; this.envelope = bbox; if ( bbox != null ) { Pair<Envelope, DoublePair> p = RenderHelper.getWorldToScreenTransform( worldToScreen, bbox, width, height ); double scalex = p.second.first; double scaley = p.second.second; bbox = p.first; resx = abs( 1 / scalex ); resy = abs( 1 / scaley ); // we have to flip horizontally, so invert y scale and add the screen height worldToScreen.translate( -bbox.getMin().get0() * scalex, bbox.getMin().get1() * scaley + height ); worldToScreen.scale( scalex, -scaley ); LOG.debug( "For coordinate transformations, scaling by x = {} and y = {}", scalex, -scaley ); LOG.trace( "Final transformation was {}", worldToScreen ); } else { LOG.warn( "No envelope given, proceeding with a scale of 1." ); } }