/** * Draw a rectangle's interior with this color. * * @param rect rectangle * @param color colour */ public void fillRectangle(Rectangle rect, Color color) { template.saveState(); setFill(color); template.rectangle(origX + rect.getLeft(), origY + rect.getBottom(), rect.getWidth(), rect.getHeight()); template.fill(); template.restoreState(); }
public void strokeRectangle(Rectangle rect, Color color, float linewidth, float[] dashArray) { template.saveState(); setStroke(color, linewidth, dashArray); template.rectangle(origX + rect.getLeft(), origY + rect.getBottom(), rect.getWidth(), rect.getHeight()); template.stroke(); template.restoreState(); }
private void drawPoint(Coordinate coord, SymbolInfo symbol) { if (symbol.getImage() != null) { try { Image pointImage = Image.getInstance(symbol.getImage().getHref()); //template.addImage(image, width, 0, 0, height, x, y) template.addImage(pointImage, symbol.getImage().getWidth(), 0, 0, symbol.getImage().getHeight() , origX + (float) coord.x, origY + (float) coord.y); } catch (Exception ex) { // NOSONAR log.error("Not able to create POINT image for rendering", ex); } } else if (symbol.getCircle() != null) { float radius = symbol.getCircle().getR(); template.circle(origX + (float) coord.x, origY + (float) coord.y, radius); } else if (symbol.getRect() != null) { float width = symbol.getRect().getW(); float height = symbol.getRect().getW(); template.rectangle(origX + (float) coord.x - (width / 2), origY + (float) coord.y - (height / 2), width, height); } }
/** * Draw the specified geometry. * * @param geometry geometry to draw * @param symbol symbol for geometry * @param fillColor fill colour * @param strokeColor stroke colour * @param lineWidth line width * @param clipRect clipping rectangle */ public void drawGeometry(Geometry geometry, SymbolInfo symbol, Color fillColor, Color strokeColor, float lineWidth, float[] dashArray, Rectangle clipRect) { template.saveState(); // clipping code if (clipRect != null) { template.rectangle(clipRect.getLeft() + origX, clipRect.getBottom() + origY, clipRect.getWidth(), clipRect .getHeight()); template.clip(); template.newPath(); } setStroke(strokeColor, lineWidth, dashArray); setFill(fillColor); drawGeometry(geometry, symbol); template.restoreState(); }
template.rectangle(clipRect.getLeft() + origX, clipRect.getBottom() + origY, clipRect.getWidth(), clipRect.getHeight()); template.clip();