@Override protected void stroke(Stroke stroke) { mark.setStroke(stroke); } });
protected MarkParser(Factory factory) { super(factory); mark = factory.style.createMark(); mark.setStroke(null); mark.setFill(null); }
public Mark createMark( Expression wellKnownName, Stroke stroke, Fill fill, Expression size, Expression rotation) { Mark mark = new MarkImpl(filterFactory, null); if (wellKnownName == null) { throw new IllegalArgumentException("WellKnownName can not be null in mark"); } mark.setWellKnownName(wellKnownName); mark.setStroke(stroke); mark.setFill(fill); return mark; }
/** * create a mark with the supplied fill and stroke * * @param wellKnownName an Expression representing the well known name of the mark * @param fill the fill to use * @param stroke the stroke to use * @return the mark created */ public Mark createMark(Expression wellKnownName, Fill fill, Stroke stroke) { Mark mark = sf.createMark(); mark.setWellKnownName(wellKnownName); mark.setStroke(stroke); mark.setFill(fill); return mark; }
/** * create a mark with default fill (50% gray) and the supplied outline * * @param wellKnownName the well known name of the mark * @param borderColor the outline color * @param borderWidth the outline width * @return the mark created */ public Mark createMark(String wellKnownName, Color borderColor, double borderWidth) { Mark mark = sf.createMark(); mark.setWellKnownName(literalExpression(wellKnownName)); mark.setStroke(createStroke(borderColor, borderWidth)); return mark; }
/** * create a mark with the supplied fill and stroke * * @param wellKnownName the well known name of the mark * @param fill the fill to use * @param stroke the stroke to use * @return the mark created */ public Mark createMark(String wellKnownName, Fill fill, Stroke stroke) { Mark mark = sf.createMark(); mark.setWellKnownName(literalExpression(wellKnownName)); mark.setStroke(stroke); mark.setFill(fill); return mark; }
/** * create a mark of the supplied color and a default outline (black) * * @param wellKnownName the well known name of the mark * @param fillColor the color of the mark * @return the created mark */ public Mark createMark(String wellKnownName, Color fillColor) { Mark mark = sf.createMark(); mark.setWellKnownName(literalExpression(wellKnownName)); mark.setFill(createFill(fillColor, 1.0)); mark.setStroke(null); return mark; }
public void visit(Mark mark) { Mark copy = null; copy = sf.createMark(); copy.setFill(copy(mark.getFill())); copy.setStroke(copy(mark.getStroke())); copy.setWellKnownName(copy(mark.getWellKnownName())); copy.setExternalMark(copy(mark.getExternalMark())); if (STRICT && !copy.equals(mark)) { throw new IllegalStateException("Was unable to duplicate provided Mark:" + mark); } pages.push(copy); }
mark.setStroke(stroke); mark.setFill(fill);
/** * create the named mark with the colors etc supplied * * @param wellKnownName the well known name of the mark * @param fillColor the color of the mark * @param borderColor the outline color of the mark * @param borderWidth the width of the outline * @return the mark created */ public Mark createMark( String wellKnownName, Color fillColor, Color borderColor, double borderWidth) { Mark mark = sf.createMark(); mark.setWellKnownName(literalExpression(wellKnownName)); mark.setStroke(createStroke(borderColor, borderWidth)); mark.setFill(createFill(fillColor)); return mark; }
/** * getValue ... * * @see org.geotools.xml.schema.Type#getValue(org.geotools.xml.schema.Element, * org.geotools.xml.schema.ElementValue[], org.xml.sax.Attributes, java.util.Map) * @param element * @param value * @param attrs1 * @param hints * @throws OperationNotSupportedException */ public Object getValue( Element element, ElementValue[] value, Attributes attrs1, Map hints) { Mark symbol = StyleFactoryFinder.createStyleFactory().getDefaultMark(); for (int i = 0; i < value.length; i++) { if ((value[i] == null) || value[i].getElement() == null) { continue; } Element e = value[i].getElement(); if (elems[WELLKNOWNNAME].getName().equals(e.getName())) symbol.setWellKnownName((Expression) value[i].getValue()); if (elems[FILL].getName().equals(e.getName())) symbol.setFill((Fill) value[i].getValue()); if (elems[STROKE].getName().equals(e.getName())) symbol.setStroke((Stroke) value[i].getValue()); } return symbol; } }
/** * Sets the Colour for the given point symbolizer * * @param symbolizer the point symbolizer * @param colour the new colour */ public static void setPointColour(PointSymbolizer symbolizer, Color colour) { if (symbolizer == null || colour == null) { return; } Graphic graphic = symbolizer.getGraphic(); if (graphic == null) { graphic = sf.createDefaultGraphic(); } for (GraphicalSymbol gs : graphic.graphicalSymbols()) { if (gs != null && gs instanceof Mark) { Mark mark = (Mark) gs; Stroke stroke = mark.getStroke(); if (stroke == null) { stroke = sf.createStroke(ff.literal(Color.BLACK), Stroke.DEFAULT.getWidth()); mark.setStroke(stroke); } Fill fill = mark.getFill(); if (fill != null) { fill.setColor(ff.literal(colour)); } } } }
CommonFactoryFinder.getStyleFactory() .createFill(CommonFactoryFinder.getFilterFactory2().literal("#112233"))); m1.setStroke( CommonFactoryFinder.getStyleFactory() .createStroke(
@Test public void testMarkNoSizeNoStroke() throws Exception { StyleBuilder sb = new StyleBuilder(); Mark mark = sb.createMark("square"); mark.setStroke(null); Graphic graphic = sb.createGraphic(null, mark, null); graphic.setSize(NilExpression.NIL); PointSymbolizer ps = sb.createPointSymbolizer(graphic); Style style = sb.createStyle(ps); MetaBufferEstimator estimator = new MetaBufferEstimator(); style.accept(estimator); assertTrue(estimator.isEstimateAccurate()); assertEquals(16, estimator.getBuffer()); }
protected MarkParser(Factory factory) { super(factory); mark = factory.style.createMark(); mark.setStroke(null); mark.setFill(null); }
public Mark createMark(Expression wellKnownName, Stroke stroke, Fill fill, Expression size, Expression rotation) { Mark mark = new MarkImpl(filterFactory, null); if (wellKnownName == null) { throw new IllegalArgumentException( "WellKnownName can not be null in mark"); } mark.setWellKnownName(wellKnownName); mark.setStroke(stroke); mark.setFill(fill); return mark; }
@Test public void testGraphicSizeFunction() throws Exception { StyleBuilder sb = new StyleBuilder(); Mark mark = sb.createMark("square"); mark.setStroke(null); Graphic graphic = sb.createGraphic(null, mark, null); FilterFactory2 ff = sb.getFilterFactory(); graphic.setSize(ff.function("env", ff.literal("test"))); PointSymbolizer ps = sb.createPointSymbolizer(graphic); Style style = sb.createStyle(ps); try { EnvFunction.setGlobalValue("test", 10); MetaBufferEstimator estimator = new MetaBufferEstimator(); style.accept(estimator); assertTrue(estimator.isEstimateAccurate()); assertEquals(10, estimator.getBuffer()); } finally { EnvFunction.clearGlobalValues(); } }
public void visit(Mark mark) { Mark copy = null; copy = sf.createMark(); copy.setFill(copy( mark.getFill() )); copy.setStroke(copy( mark.getStroke() )); copy.setWellKnownName(copy( mark.getWellKnownName() )); if( STRICT && !copy.equals( mark )){ throw new IllegalStateException("Was unable to duplicate provided Mark:"+mark ); } pages.push(copy); }
public void apply() { if (mark != null) { mark.setFill(guiFill.getEdited()); mark.setRotation(guiRotation.getExpression()); mark.setSize(guiSize.getExpression()); mark.setStroke(guiStroke.getEdited()); mark.setWellKnownName(guiWKN.getExpression()); } }