public Mark getTriangleMark() { Mark mark = getDefaultMark(); mark.setWellKnownName(filterFactory.literal("Triangle")); return mark; }
/** * create the named mark * * @param wellKnownName the wellknown name of the mark * @return the mark created */ public Mark createMark(String wellKnownName) { Mark mark = sf.createMark(); mark.setWellKnownName(literalExpression(wellKnownName)); return mark; }
public Mark getCrossMark() { Mark mark = getDefaultMark(); mark.setWellKnownName(filterFactory.literal("Cross")); return mark; }
public Mark getCircleMark() { Mark mark = getDefaultMark(); mark.setWellKnownName(filterFactory.literal("Circle")); return mark; }
public Mark getXMark() { Mark mark = getDefaultMark(); mark.setWellKnownName(filterFactory.literal("X")); return mark; }
public Mark getStarMark() { Mark mark = getDefaultMark(); mark.setWellKnownName(filterFactory.literal("Star")); return mark; }
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; }
@Override public void visit(Mark mark) { super.visit(mark); Mark copy = (Mark) pages.peek(); copy.setWellKnownName(ff.literal(markName)); } };
/** * 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); }
/** * 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; }
@Override public void handle(YamlObject<?> obj, YamlParseContext context) { mark(mark); YamlMap map = obj.map(); if (map.has("shape")) { mark.setWellKnownName(Util.expression(map.str("shape"), factory)); } context.push( new StrokeParser(factory) { @Override protected void stroke(Stroke stroke) { mark.setStroke(stroke); } }); context.push( new FillParser(factory) { @Override protected void fill(Fill fill) { mark.setFill(fill); } }); }
public void testDefaultSizeMark() throws Exception { PointSymbolizer symb = sf.createPointSymbolizer(); Mark myMark = sf.createMark(); myMark.setWellKnownName(ff.literal("square")); symb.getGraphic().addMark(myMark); MarkStyle2D ms = (MarkStyle2D) sld.createPointStyle(feature, symb, range); assertEquals(16.0, ms.getSize()); }
public void testMarkSizeCalculation() throws Exception { assertFalse(MarkStyle2D.isMaxMarkSizeEnabled()); PointSymbolizer symb = sf.createPointSymbolizer(); Mark myMark = sf.createMark(); myMark.setWellKnownName(ff.literal("square")); symb.getGraphic().graphicalSymbols().add(myMark); MarkStyle2D ms = (MarkStyle2D) sld.createPointStyle(feature, symb, range); assertFalse(MarkStyle2D.isMaxMarkSizeEnabled()); MarkStyle2D.setMaxMarkSizeEnabled(true); ms = (MarkStyle2D) sld.createPointStyle(feature, symb, range); assertTrue(MarkStyle2D.isMaxMarkSizeEnabled()); }
public void testTexturePaintNoSize() throws Exception { PolygonSymbolizer symb = sf.createPolygonSymbolizer(); Mark myMark = sf.createMark(); myMark.setWellKnownName(ff.literal("square")); org.geotools.styling.Fill fill = sf.createFill(null); fill.setGraphicFill(sf.createGraphic(null, new Mark[] {myMark}, null, null, null, null)); symb.setFill(fill); PolygonStyle2D ps = sld.createPolygonStyle(feature, symb, range); assertTrue(ps.getFill() instanceof TexturePaint); }
@Test public void testNameExpressionAttribute() throws Exception { PointSymbolizer p = CommonFactoryFinder.getStyleFactory().createPointSymbolizer(); Expression nameExpression = CommonFactoryFinder.getFilterFactory2().property("test"); Mark mark = CommonFactoryFinder.getStyleFactory().createMark(); mark.setWellKnownName(nameExpression); p.getGraphic().graphicalSymbols().add(mark); StringWriter out = new StringWriter(); Ysld.encode(sld(p), out); YamlMap obj = new YamlMap(YamlUtil.getSafeYaml().load(out.toString())); String result = obj.seq("feature-styles") .map(0) .seq("rules") .map(0) .seq("symbolizers") .map(0) .map("point") .seq("symbols") .map(0) .map("mark") .str("shape"); assertThat(result, equalTo("${test}")); }
@Test public void testNameExpressionLiteral() throws Exception { PointSymbolizer p = CommonFactoryFinder.getStyleFactory().createPointSymbolizer(); Expression nameExpression = CommonFactoryFinder.getFilterFactory2().literal("test"); Mark mark = CommonFactoryFinder.getStyleFactory().createMark(); mark.setWellKnownName(nameExpression); p.getGraphic().graphicalSymbols().add(mark); StringWriter out = new StringWriter(); Ysld.encode(sld(p), out); YamlMap obj = new YamlMap(YamlUtil.getSafeYaml().load(out.toString())); String result = obj.seq("feature-styles") .map(0) .seq("rules") .map(0) .seq("symbolizers") .map(0) .map("point") .seq("symbols") .map(0) .map("mark") .str("shape"); assertThat(result, equalTo("test")); }