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." ); } } }
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 ); }
final Double line = rendererContext.geomHelper.fromCurve( (Curve) renderGeometry, false ); rendererContext.strokeRenderer.applyStroke( styling.stroke, styling.uom, line, styling.perpendicularOffset, styling.perpendicularOffsetType );