float strokeWidthAdjustment) { if (ls2d.getStroke() != null) { if (ls2d.getGraphicStroke() != null) { drawWithGraphicsStroke( graphics, dashShape(shape, ls2d.getStroke()), ls2d.getGraphicStroke(), isLabelObstacle); } else { Paint paint = ls2d.getContour(); Stroke stroke = ls2d.getStroke(); if (graphics.getRenderingHint(RenderingHints.KEY_ANTIALIASING) == RenderingHints.VALUE_ANTIALIAS_ON) { graphics.setComposite(ls2d.getContourComposite()); graphics.draw(shape);
Style2D createLineStyle(Object feature, LineSymbolizer symbolizer, Range scaleRange) { // see if we have some information about the composite float opacity = 1f; if (symbolizer.getStroke() != null) { opacity = evalOpacity(symbolizer.getStroke().getOpacity(), feature); } Composite composite = getComposite(symbolizer.getOptions(), opacity); if (composite == null) { composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opacity); } LineStyle2D style = new LineStyle2D(); setScaleRange(style, scaleRange); style.setStroke(getStroke(symbolizer.getStroke(), feature)); style.setGraphicStroke( getGraphicStroke(symbolizer, symbolizer.getStroke(), feature, scaleRange)); style.setContour(getStrokePaint(symbolizer.getStroke(), feature)); style.setContourComposite(composite); style.setPerpendicularOffset( evalToDouble(symbolizer.getPerpendicularOffset(), feature, 0d)); return style; }
public static double getStyle2DSize(Style2D style) { if (style instanceof GraphicStyle2D) { final BufferedImage image = ((GraphicStyle2D) style).getImage(); return maxSize(image.getWidth(), image.getHeight()); } else if (style instanceof IconStyle2D) { final Icon icon = ((IconStyle2D) style).getIcon(); return maxSize(icon.getIconWidth(), icon.getIconHeight()); } else if (style instanceof LineStyle2D) { LineStyle2D ls = ((LineStyle2D) style); double gsSize = getStyle2DSize(ls.getGraphicStroke()); double strokeSize = 0; if (ls.getStroke() instanceof BasicStroke) { strokeSize = ((BasicStroke) ls.getStroke()).getLineWidth(); } double offset = ls.getPerpendicularOffset(); double lineSize = maxSize(maxSize(gsSize, strokeSize), offset); // a MarkStyle2D is also a LineStyle2D, but we have to account for the symbol size if (style instanceof MarkStyle2D) { MarkStyle2D mark = (MarkStyle2D) style; return mark.getSize() + lineSize; } else { return lineSize; } } else { return 0; } }
public static double getStyle2DSize(Style2D style) { if(style instanceof GraphicStyle2D) { final BufferedImage image = ((GraphicStyle2D) style).getImage(); return maxSize(image.getWidth(), image.getHeight()); } else if(style instanceof IconStyle2D) { final Icon icon = ((IconStyle2D) style).getIcon(); return maxSize(icon.getIconWidth(), icon.getIconHeight()); } else if(style instanceof LineStyle2D) { LineStyle2D ls = ((LineStyle2D) style); double gsSize = getStyle2DSize(ls.getGraphicStroke()); double strokeSize = 0; if(ls.getStroke() instanceof BasicStroke) { strokeSize = ((BasicStroke) ls.getStroke()).getLineWidth(); } return maxSize(gsSize, strokeSize); } else { return 0; } }
symbolizer.getStroke().getColor().toString(), "ff"); } else if (style != null) { encodeColor((Color) style.getContour(), opacity);
&& ((LineStyle2D) style).getPerpendicularOffset() != 0 && (source instanceof Polygon || source instanceof MultiPolygon); && ((LineStyle2D) style).getPerpendicularOffset() != 0 && g != null && !g.isEmpty()) { LineStyle2D ls = (LineStyle2D) style; double offset = ls.getPerpendicularOffset();
public void testCreateLineStyle() { LineSymbolizer ls = sf.createLineSymbolizer(); ls.setPerpendicularOffset(ff.literal(5)); NumberRange<Double> scaleRange = NumberRange.create(1.0, 50000.0); LineStyle2D style = (LineStyle2D) sld.createLineStyle(null, ls, scaleRange); assertNotNull(style); assertEquals(5, style.getPerpendicularOffset(), 0d); }
LineStyle2D ls2d = (LineStyle2D) style; if (ls2d.getStroke() != null) { if (ls2d.getGraphicStroke() != null) { drawWithGraphicsStroke(graphics, shape, ls2d.getGraphicStroke()); } else { Paint paint = ls2d.getContour(); Stroke stroke = ls2d.getStroke(); graphics.setComposite(ls2d.getContourComposite()); graphics.draw(shape);
LineStyle2D lineStyle = new LineStyle2D(); lineStyle.setStroke(ms2d.getStroke()); lineStyle.setContour(ms2d.getContour()); lineStyle.setContourComposite(ms2d.getContourComposite()); lineStyle.setGraphicStroke(ms2d.getGraphicStroke()); filler.fillRectangle(shape.getBounds2D(), this, clippedGraphics, lineStyle); return;
LineStyle2D ls2d = (LineStyle2D) style; if (ls2d.getStroke() != null) { if (ls2d.getGraphicStroke() != null) { drawWithGraphicsStroke(graphics, dashShape(shape, ls2d.getStroke()), ls2d.getGraphicStroke()); } else { Paint paint = ls2d.getContour(); Stroke stroke = ls2d.getStroke(); graphics.setComposite(ls2d.getContourComposite()); graphics.draw(shape);
Style2D createLineStyle(Object feature, LineSymbolizer symbolizer, Range scaleRange) { LineStyle2D style = new LineStyle2D(); setScaleRange(style, scaleRange); style.setStroke(getStroke(symbolizer.getStroke(), feature)); style.setGraphicStroke(getGraphicStroke(symbolizer.getStroke(), feature, scaleRange)); style.setContour(getStrokePaint(symbolizer.getStroke(), feature)); style.setContourComposite(getStrokeComposite(symbolizer.getStroke(), feature)); return style; }
LineStyle2D ls2d = (LineStyle2D) style; if (ls2d.getStroke() != null) { if (ls2d.getGraphicStroke() != null) { drawWithGraphicsStroke(graphics, dashShape(shape, ls2d.getStroke()), ls2d.getGraphicStroke(), isLabelObstacle); } else { Paint paint = ls2d.getContour(); Stroke stroke = ls2d.getStroke(); if (graphics .getRenderingHint(RenderingHints.KEY_ANTIALIASING) == RenderingHints.VALUE_ANTIALIAS_ON) { graphics.setComposite(ls2d.getContourComposite()); graphics.draw(shape);
Style2D createLineStyle(Object feature, LineSymbolizer symbolizer, Range scaleRange) { LineStyle2D style = new LineStyle2D(); setScaleRange(style, scaleRange); style.setStroke(getStroke(symbolizer.getStroke(), feature)); style.setGraphicStroke(getGraphicStroke(symbolizer.getStroke(), feature)); style.setContour(getStrokePaint(symbolizer.getStroke(), feature)); style.setContourComposite(getStrokeComposite(symbolizer.getStroke(), feature)); return style; }
LineStyle2D ls2d = (LineStyle2D) style; if (ls2d.getStroke() != null) { if (ls2d.getGraphicStroke() != null) { drawWithGraphicsStroke(graphics, shape, ls2d .getGraphicStroke()); } else { Paint paint = ls2d.getContour(); Stroke stroke = ls2d.getStroke(); if (graphics .getRenderingHint(RenderingHints.KEY_ANTIALIASING) == RenderingHints.VALUE_ANTIALIAS_ON) { graphics.setComposite(ls2d.getContourComposite()); graphics.draw(shape);