public void visit(TextSymbolizer text) { TextSymbolizer copy = sf.createTextSymbolizer(); copy.setFill(copy(text.getFill())); copy.fonts().clear(); copy.fonts().addAll(copyFonts(text.fonts())); copy.setGeometry(copy(text.getGeometry())); copy.setUnitOfMeasure(text.getUnitOfMeasure()); copy.setHalo(copy(text.getHalo())); copy.setLabel(copy(text.getLabel())); copy.setLabelPlacement(copy(text.getLabelPlacement())); copy.setPriority(copy(text.getPriority())); copy.getOptions().putAll(text.getOptions()); if (text instanceof TextSymbolizer2) { TextSymbolizer2 text2 = (TextSymbolizer2) text; TextSymbolizer2 copy2 = (TextSymbolizer2) copy; copy2.setGraphic(copy(text2.getGraphic())); copy2.setSnippet(copy(text2.getSnippet())); copy2.setFeatureDescription(copy(text2.getFeatureDescription())); copy2.setOtherText(copy(text2.getOtherText())); } if (STRICT && !copy.equals(text)) { throw new IllegalStateException( "Was unable to duplicate provided TextSymbolizer:" + text); } pages.push(copy); }
public TextSymbolizer createTextSymbolizer( Fill fill, Font[] fonts, Halo halo, Expression label, LabelPlacement labelPlacement, String geometryPropertyName) { TextSymbolizer tSymb = new TextSymbolizerImpl(filterFactory); tSymb.setFill(fill); if (fonts != null) { tSymb.fonts().addAll(Arrays.asList(fonts)); } tSymb.setGeometryPropertyName(geometryPropertyName); tSymb.setHalo(halo); tSymb.setLabel(label); tSymb.setLabelPlacement(labelPlacement); return tSymb; }
@Override public void visit(TextSymbolizer text) { if (text.getDescription() != null) { text.getDescription().accept(this); } if (text.getFill() != null) { text.getFill().accept(this); } if (text.getHalo() != null) { text.getHalo().accept(this); } if (text.getLabelPlacement() != null) { text.getLabelPlacement().accept(this); } }
public TextSymbolizerBuilder reset(TextSymbolizer symbolizer) { fill.reset(symbolizer.getFill()); halo.reset(symbolizer.getHalo()); label = symbolizer.getLabel(); geometry = null; LabelPlacement otherPlacement = symbolizer.getLabelPlacement(); if (symbolizer.getLabelPlacement() instanceof PointPlacement) { PointPlacementBuilder builder = new PointPlacementBuilder(this); builder.reset((PointPlacement) otherPlacement); placement = builder; } else if (symbolizer.getLabelPlacement() instanceof LabelPlacement) { LinePlacementBuilder builder = new LinePlacementBuilder(this); builder.reset((LinePlacement) otherPlacement); placement = builder; } else { throw new IllegalArgumentException("Unrecognized label placement: " + otherPlacement); } priority = symbolizer.getPriority(); unset = false; return this; }
public void setEdited(TextSymbolizer sym) { symbol = (TextSymbolizer) sym; if (sym != null) { guiFill.setEdited(symbol.getFill()); guiLabel.setExpression(symbol.getLabel()); guiGeom.setGeom(symbol.getGeometryPropertyName()); guiFonts.setEdited(symbol.getFonts()); guiHalo.setEdited(symbol.getHalo()); guiPriority.setExpression(symbol.getPriority()); guiPlacement.setEdited(symbol.getPlacement()); //dont know how to handle that option map // lack informations //symbol.getOptions(); } }
public TextSymbolizer createTextSymbolizer(Fill fill, Font[] fonts, Halo halo, Expression label, LabelPlacement labelPlacement, String geometryPropertyName) { TextSymbolizer tSymb = new TextSymbolizerImpl(filterFactory); tSymb.setFill(fill); tSymb.setFonts(fonts); tSymb.setGeometryPropertyName(geometryPropertyName); tSymb.setHalo(halo); tSymb.setLabel(label); tSymb.setPlacement(labelPlacement); return tSymb; }
symbol.setFill(null); if (uomNode != null) { UomOgcMapping uomMapping = UomOgcMapping.get(uomNode.getNodeValue()); symbol.setUnitOfMeasure(uomMapping.getUnit()); symbol.setGeometry(parseGeometry(child)); } else if (childName.equalsIgnoreCase(fillSt)) { symbol.setFill(parseFill(child)); } else if (childName.equalsIgnoreCase("Label")) { if (LOGGER.isLoggable(Level.FINEST)) symbol.setLabel(parseCssParameter(child, false)); if (symbol.getLabel() == null) { if (LOGGER.isLoggable(Level.WARNING)) LOGGER.warning( fonts.add(parseFont(child)); } else if (childName.equalsIgnoreCase("LabelPlacement")) { symbol.setLabelPlacement(parseLabelPlacement(child)); } else if (childName.equalsIgnoreCase("Halo")) { symbol.setHalo(parseHalo(child)); } else if (childName.equalsIgnoreCase("Graphic")) { if (LOGGER.isLoggable(Level.FINEST)) ((TextSymbolizer2) symbol).setOtherText(parseOtherText(child)); } else if (childName.equalsIgnoreCase("priority")) { symbol.setPriority(parseCssParameter(child)); } else if (childName.equalsIgnoreCase(VendorOptionString)) {
Unit<Length> uom = text.getUnitOfMeasure(); if (uom != null) atts.addAttribute("", "uom", "uom", "", UomOgcMapping.get(uom).getSEString()); encodeGeometryExpression(text.getGeometry()); if (text.getLabel() != null) { start("Label"); labelContent(text.getLabel()); end("Label"); if ((text.fonts() != null) && (!text.fonts().isEmpty())) { List<Font> fonts = text.fonts(); if (areFontsUniform(fonts)) { if (text.getLabelPlacement() != null) { text.getLabelPlacement().accept(this); if (text.getHalo() != null) { text.getHalo().accept(this); if (text.getFill() != null) { text.getFill().accept(this); if (text.getPriority() != null) { element("Priority", text.getPriority()); if (text.getOptions() != null) { encodeVendorOptions(text.getOptions());
if (geometry instanceof PropertyName) { PropertyName propertyName = (PropertyName) geometry; ts.setGeometryPropertyName(propertyName.getPropertyName()); } else { ts.setGeometry(geometry); ts.setLabel((Expression) node.getChildValue("Label")); ts.fonts().add((Font) node.getChildValue("Font")); ts.setLabelPlacement((LabelPlacement) node.getChildValue("LabelPlacement")); ts.setHalo((Halo) node.getChildValue("Halo")); ts.setFill((Fill) node.getChildValue("Fill")); ts.setPriority((Expression) node.getChildValue("Priority")); ts.getOptions() .put(param.getName(), param.getExpression().evaluate(null, String.class));
if (text.getGeometry() != null) { text.getGeometry().accept(this, null); } else { this.defaultGeometryUsed = true; // they want the default geometry (see GEOS-469) if (text.getFill() != null) { text.getFill().accept(this); if (text.getHalo() != null) { text.getHalo().accept(this); if (text.fonts() != null) { for (Font font : text.fonts()) { if (font.getFamily() != null) { for (Expression list : font.getFamily()) { if (text.getHalo() != null) { text.getHalo().accept(this); if (text.getLabel() != null) { text.getLabel().accept(this, null); if (text.getLabelPlacement() != null) { text.getLabelPlacement().accept(this); if (text.getPriority() != null) { text.getPriority().accept(this, null);
Unit<Length> uom = text.getUnitOfMeasure(); if(uom != null) atts.addAttribute("", "uom", "uom", "", UomOgcMapping.get(uom).getSEString()); encodeGeometryExpression(text.getGeometry()); if (text.getLabel() != null) { element("Label", text.getLabel()); if ((text.getFonts() != null) && (text.getFonts().length != 0)) { start("Font"); Font[] fonts = text.getFonts(); if (text.getPlacement() != null) { text.getPlacement().accept(this); if (text.getHalo() != null) { text.getHalo().accept(this); if (text.getFill() != null) { text.getFill().accept(this); if (text.getPriority() != null) { element("Priority", text.getPriority()); if (text.getOptions() != null) { encodeVendorOptions(text.getOptions());
TextSymbolizer copy = (TextSymbolizer) pages.peek(); Unit<Length> uom = copy.getUnitOfMeasure(); for (Font font : copy.fonts()) { font.setSize(rescale(font.getSize(), uom)); LabelPlacement placement = copy.getLabelPlacement(); if (placement instanceof PointPlacement) { rescale(linePlacement.getPerpendicularOffset(), uom)); copy.setLabelPlacement(placement); if (copy.getHalo() != null) { copy.getHalo().setRadius(rescale(copy.getHalo().getRadius(), uom)); Map<String, String> options = copy.getOptions(); scaleIntOption(options, TextSymbolizer.MAX_DISPLACEMENT_KEY, uom); scaleIntOption(options, TextSymbolizer.SPACE_AROUND_KEY, uom); scaleIntArrayOption(options, TextSymbolizer.GRAPHIC_MARGIN_KEY, uom); copy.setUnitOfMeasure(Units.PIXEL);
@Override public void visit(TextSymbolizer text) { if (text.getDescription() != null) { text.getDescription().accept(this); } if (text.getFill() != null) { text.getFill().accept(this); } if (text.getFont() != null) { //text.getFont().accept(this, null); } if (text.getGeometry() != null) { //text.getGeometry().accept(visitor, extraData) } if (text.getHalo() != null) { text.getHalo().accept(this); } if (text.getLabel() != null) { //text.getLabel().accept(visitor, extraData) } if (text.getLabelPlacement() != null) { text.getLabelPlacement().accept(this); } if (text.getPriority() != null) { //text.getPriority().accept(visitor, extraData) } }
symbol.setFill(null); symbol.setUnitOfMeasure(uomMapping.getUnit()); symbol.setGeometry(parseGeometry(child)); } else if (childName.equalsIgnoreCase(fillSt)) { symbol.setFill(parseFill(child)); } else if (childName.equalsIgnoreCase("Label")) { if (LOGGER.isLoggable(Level.FINEST)) symbol.setLabel(parseCssParameter(child, false)); if (symbol.getLabel() == null) { if (LOGGER.isLoggable(Level.WARNING)) LOGGER fonts.add(parseFont(child)); } else if (childName.equalsIgnoreCase("LabelPlacement")) { symbol.setPlacement(parseLabelPlacement(child)); } else if (childName.equalsIgnoreCase("Halo")) { symbol.setHalo(parseHalo(child)); } else if (childName.equalsIgnoreCase("Graphic")) { if (LOGGER.isLoggable(Level.FINEST)) ((TextSymbolizer2) symbol).setOtherText(parseOtherText(child)); } else if (childName.equalsIgnoreCase("priority")) { symbol.setPriority(parseCssParameter(child)); } else if (childName.equalsIgnoreCase(VendorOptionString)) { parseVendorOption(symbol, child);
symbol.setFill(null); symbol.setGeometryPropertyName(parseGeometryName(child)); symbol.setFill(parseFill(child)); symbol.setLabel(parseCssParameter(child,false)); if (symbol.getLabel() == null) symbol.setPlacement(parseLabelPlacement(child)); symbol.setHalo(parseHalo(child)); symbol.setPriority(parseCssParameter(child)); symbol.setFonts((Font[]) fonts.toArray(new Font[0]));
if (text.getGeometry() != null) { text.getGeometry().accept(this, null); } else { this.defaultGeometryUsed = true; // they want the default geometry (see GEOS-469) if (text.getFill() != null) { text.getFill().accept(this); if (text.getHalo() != null) { text.getHalo().accept(this); if (text.getFonts() != null) { Font[] fonts = text.getFonts(); if (text.getHalo() != null) { text.getHalo().accept(this); if (text.getLabel() != null) { text.getLabel().accept(this,null); if (text.getPlacement() != null) { text.getPlacement().accept(this); if (text.getPriority() != null) { text.getPriority().accept(this,null);
if(geometry instanceof PropertyName) { PropertyName propertyName = (PropertyName) geometry; ts.setGeometryPropertyName(propertyName.getPropertyName()); } else { ts.setGeometry(geometry); ts.setLabel((Expression) node.getChildValue("Label")); ts.setFonts(new Font[] { (Font) node.getChildValue("Font") }); ts.setPlacement((LabelPlacement) node.getChildValue("LabelPlacement")); ts.setHalo((Halo) node.getChildValue("Halo")); ts.setFill((Fill) node.getChildValue("Fill")); ts.getOptions().put(param.getName(), param.getExpression().evaluate(null, String.class));
String geomName = symbolizer.getGeometryPropertyName(); String label = evalToString(symbolizer.getLabel(), feature, ""); List<Font> fonts = symbolizer.fonts(); java.awt.Font[] javaFonts = getFonts(feature, fonts, symbolizer); ts2d.setFonts(javaFonts); LabelPlacement placement = symbolizer.getLabelPlacement(); double anchorX = PointPlacement.DEFAULT_ANCHOR_POINT.getAnchorPointX().evaluate(null, Double.class); ts2d.setFill(getPaint(symbolizer.getFill(), feature, symbolizer)); ts2d.setComposite(getComposite(symbolizer.getFill(), feature)); Halo halo = symbolizer.getHalo();
if (text.getFill() != null) { text.getFill().accept(this); if (text.getHalo() != null) { text.getHalo().accept(this); if (text.fonts() != null) { List<Font> fonts = text.fonts(); for (Font font : fonts) { if (font.getFamily() != null) { if (text.getHalo() != null) { text.getHalo().accept(this); if (text.getLabelPlacement() != null) { text.getLabelPlacement().accept(this);