@Override public void visit(Mark mark) { final Expression wellKnownName = mark.getWellKnownName(); if (wellKnownName instanceof Literal) { final String name = wellKnownName.evaluate(null, String.class); if (name.startsWith("resource:/")) { try { Resource r = resourceLoader.fromURL(name); if (r != null && r.getType() != Type.UNDEFINED) { resources.add(r); } } catch (IllegalArgumentException e) { GeoServerConfigPersister.LOGGER.log( Level.WARNING, "Error attemping to process SLD resource", e); } } } }
/** * Retrieves the "well known name" of a Mark object. * * @param mark the Mark object * @return well known name or null if unavailable. */ public static String wellKnownName(Mark mark) { if (mark == null) { return null; } Expression exp = mark.getWellKnownName(); if (exp == null) { return null; } return Filters.asString(exp); }
/** @see org.geotools.styling.StyleVisitor#visit(org.geotools.styling.Mark) */ public void visit(Mark mark) { if (mark.getFill() != null) { mark.getFill().accept(this); } if (mark.getStroke() != null) { mark.getStroke().accept(this); } if (mark.getWellKnownName() != null) { if (mark.getWellKnownName() instanceof Literal) { visitCqlExpression(mark.getWellKnownName().evaluate(null, String.class)); } else { mark.getWellKnownName().accept(this, null); } } }
public void visit(Mark mark) { start("Mark"); if (mark.getWellKnownName() != null && (!"square".equals(mark.getWellKnownName().evaluate(null)) || isExportDefaultValues())) { encodeValue("WellKnownName", null, mark.getWellKnownName(), null); } if (mark.getFill() != null) { mark.getFill().accept(this); } if (mark.getStroke() != null) { mark.getStroke().accept(this); } end("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); }
Expression name = mark.getWellKnownName();
@SuppressWarnings("deprecation") static MarkImpl cast(GraphicalSymbol item) { if (item == null) { return null; } else if (item instanceof MarkImpl) { return (MarkImpl) item; } else if (item instanceof Mark) { Mark mark = (Mark) item; MarkImpl copy = new MarkImpl(); copy.setStroke(mark.getStroke()); copy.setWellKnownName(mark.getWellKnownName()); copy.setExternalMark(mark.getExternalMark()); return copy; } return null; } }
SymbolsEncoder encode(Mark mark) { putName("shape", mark.getWellKnownName()); inline(new StrokeEncoder(mark.getStroke())); inline(new FillEncoder(mark.getFill())); // encode("stroke", new StrokeEncoder(mark.getStroke())); // encode("fill", mark.getFill()); // url: // inline: return this; }
void assertSLD(StyledLayerDescriptor sld) { assertNotNull(sld); PointSymbolizer point = SLD.pointSymbolizer(SLD.defaultStyle(sld)); assertNotNull(point); assertEquals("triangle", SLD.mark(point).getWellKnownName().evaluate(null)); } }
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { if (value != null && value instanceof Mark) { mark = (Mark) value; but.setText(mark.getWellKnownName().toString()); } else { but.setText("????"); mark = null; } return but; }
@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JLabel lbl = (JLabel) super.getTableCellRendererComponent(table, text, isSelected, hasFocus, row, column); Mark m = (Mark) value; lbl.setText(m.getWellKnownName().toString()); return lbl; } }
public static String wellKnownName(Mark mark) { if (mark == null) { return null; } Expression exp = mark.getWellKnownName(); if (exp == null) { return null; } String string = stringValue(exp); return string; }
MarkStyle2D createMarkStyle(Mark mark, Object feature, Symbolizer symbolizer, double size) { Shape shape = getShape(mark, feature); if (shape == null) { throw new IllegalArgumentException( "The specified mark " + mark.getWellKnownName() + " was not found!"); } Composite composite = getComposite(symbolizer.getOptions()); MarkStyle2D ms2d = new MarkStyle2D(); ms2d.setShape(shape); ms2d.setFill(getPaint(mark.getFill(), feature, symbolizer)); ms2d.setFillComposite( composite != null ? composite : getComposite(mark.getFill(), feature)); ms2d.setStroke(getStroke(mark.getStroke(), feature)); ms2d.setContour(getStrokePaint(mark.getStroke(), feature)); ms2d.setContourComposite( composite != null ? composite : getStrokeComposite(mark.getStroke(), feature)); // in case of Mark we don't have a natural size, so we default // to 16 if (size <= 0) { size = DEFAULT_MARK_SIZE; } ms2d.setSize(size); return ms2d; }
private Mark getMark(Graphic graphic, Object feature) { Mark[] marks = graphic.getMarks(); Mark mark; for (int i = 0; i < marks.length; i++) { String name = marks[i].getWellKnownName().evaluate(feature).toString(); if (wellKnownMarks.contains(name)) { mark = marks[i]; return mark; } } mark = null; return mark; }
public void addMarkProperties(String prefix, Mark mark, Map<String, String> props) { if (mark.getWellKnownName() != null && !isStatic(mark.getWellKnownName())) { props.put(prefix + NAME, mark.getWellKnownName().evaluate(feature, String.class)); } if (mark.getFill() != null) { addFillProperties(prefix + FILL, mark.getFill(), props); } if (mark.getStroke() != null) { addStrokeProperties(prefix + STROKE, mark.getStroke(), props); } }
public void visit(Mark mark) { start("Mark"); if (mark.getWellKnownName() != null && !"square".equals(mark.getWellKnownName().evaluate(null))) { element("WellKnownName", mark.getWellKnownName().toString()); } if (mark.getFill() != null) { mark.getFill().accept(this); } if (mark.getStroke() != null) { mark.getStroke().accept(this); } end("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() )); if( STRICT && !copy.equals( mark )){ throw new IllegalStateException("Was unable to duplicate provided Mark:"+mark ); } pages.push(copy); }
assertEquals("shape://times", Filters.asString(mark.getWellKnownName()));
SymbolsEncoder encode(Mark mark) { putName("shape", mark.getWellKnownName()); inline(new StrokeEncoder(mark.getStroke())); inline(new FillEncoder(mark.getFill())); // encode("stroke", new StrokeEncoder(mark.getStroke())); // encode("fill", mark.getFill()); // url: // inline: return this; }
public void setEdited(Mark mk) { this.mark = mk; if (mark != null) { guiFill.setEdited(mark.getFill()); guiRotation.setExpression(mark.getRotation()); guiSize.setExpression(mark.getSize()); guiStroke.setEdited(mark.getStroke()); guiWKN.setExpression(mark.getWellKnownName()); } }