/** * @param mark * @param size * @param uom * @param context * @param x * @param y * @param rotation */ public static void renderMark( Mark mark, int size, UOM uom, RendererContext context, double x, double y, double rotation ) { if ( size == 0 ) { LOG.debug( "Not rendering a symbol because the size is zero." ); return; } if ( mark.fill == null && mark.stroke == null ) { LOG.debug( "Not rendering a symbol because no fill/stroke is available/configured." ); return; } Shape shape = getShapeFromMark( mark, size - 1, rotation, true, x, y ); if ( mark.fill != null ) { context.fillRenderer.applyFill( mark.fill, uom ); context.graphics.fill( shape ); } if ( mark.stroke != null ) { context.strokeRenderer.applyStroke( mark.stroke, uom, shape, 0, null ); } }
void render( TextStyling styling, Font font, String text, Curve c ) { java.awt.Stroke stroke = new TextStroke( text, font, styling.linePlacement ); if ( isZero( ( (TextStroke) stroke ).getLineHeight() ) ) { return; } stroke = applyOffset( styling, stroke ); Double line = renderer.rendererContext.geomHelper.fromCurve( c, false ); if ( styling.halo != null ) { Stroke haloStroke = new HaloStroke( text, font, styling.linePlacement, styling.halo, styling.uom, renderer.rendererContext.uomCalculator ); haloStroke = applyOffset( styling, haloStroke ); renderer.rendererContext.fillRenderer.applyFill( styling.halo.fill, styling.uom ); renderer.graphics.setStroke( haloStroke ); renderer.graphics.draw( line ); } renderer.rendererContext.fillRenderer.applyFill( styling.fill, styling.uom ); renderer.graphics.setStroke( stroke ); renderer.graphics.draw( line ); }
void render( PolygonStyling styling, Surface surface ) { for ( SurfacePatch patch : surface.getPatches() ) { if ( patch instanceof PolygonPatch ) { LinkedList<Double> lines = new LinkedList<Double>(); PolygonPatch polygonPatch = (PolygonPatch) patch; // just appending the holes appears to work, the Java2D rendering mechanism can determine that they lie // inside and thus no substraction etc. is needed. This speeds up things SIGNIFICANTLY GeneralPath polygon = new GeneralPath( WIND_EVEN_ODD ); for ( Curve curve : polygonPatch.getBoundaryRings() ) { Double d = geomHelper.fromCurve( curve, true ); lines.add( d ); polygon.append( d, false ); } fillRenderer.applyFill( styling.fill, styling.uom ); graphics.fill( polygon ); for ( Double d : lines ) { strokeRenderer.applyStroke( styling.stroke, styling.uom, d, styling.perpendicularOffset, styling.perpendicularOffsetType ); } } else { throw new IllegalArgumentException( "Cannot render non-planar surfaces." ); } } }
@Override public void render( Label pLabel ) { renderer.graphics.setFont( pLabel.getFont() ); AffineTransform transform = renderer.graphics.getTransform(); renderer.graphics.rotate( toRadians( pLabel.getStyling().rotation ), pLabel.getOrigin().x, pLabel.getOrigin().y ); if ( pLabel.getStyling().halo != null ) { context.fillRenderer.applyFill( pLabel.getStyling().halo.fill, pLabel.getStyling().uom ); BasicStroke stroke = new BasicStroke( round( 2 * context.uomCalculator.considerUOM( pLabel.getStyling().halo.radius, pLabel.getStyling().uom ) ), CAP_BUTT, JOIN_ROUND ); renderer.graphics.setStroke( stroke ); renderer.graphics.draw( pLabel.getLayout().getOutline( getTranslateInstance( pLabel.getDrawPosition().x, pLabel.getDrawPosition().y ) ) ); } //LOG.debug("LabelRender w:" + pLabel.getLayout().getBounds().getWidth() + " h: "+pLabel.getLayout().getBounds().getHeight()+" x: "+pLabel.getDrawPosition().x + " y: "+pLabel.getDrawPosition().y); renderer.graphics.setStroke( new BasicStroke() ); context.fillRenderer.applyFill( pLabel.getStyling().fill, pLabel.getStyling().uom ); pLabel.getLayout().draw( renderer.graphics, (float) pLabel.getDrawPosition().x, (float) pLabel.getDrawPosition().y ); renderer.graphics.setTransform( transform ); }
transed = s.createStrokedShape( transed ); if ( stroke.stroke.mark.fill != null ) { fillRenderer.applyFill( stroke.stroke.mark.fill, uom ); graphics.fill( transed );