/** * get the priority from the symbolizer its an expression, so it will try to evaluate it: 1. if * its missing --> DEFAULT_PRIORITY 2. if its a number, return that number 3. if its not a * number, convert to string and try to parse the number; return the number 4. otherwise, return * DEFAULT_PRIORITY * * @param symbolizer * @param feature */ public double getPriority(TextSymbolizer symbolizer, Feature feature) { if (symbolizer.getPriority() == null) return DEFAULT_PRIORITY; // evaluate try { Double number = symbolizer.getPriority().evaluate(feature, Double.class); return number.doubleValue(); } catch (Exception e) { return DEFAULT_PRIORITY; } }
Expression priority = symbolizer.getPriority(); if ((priority != null) && (!(priority instanceof Literal))) { groupItem.setPriority(groupItem.getPriority() + priorityValue);
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 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); }
@Override protected void encode(TextSymbolizer text) { put("label", text.getLabel()); put("priority", text.getPriority()); inline(new FillEncoder(text.getFill())); inline(new HaloEncoder(text.getHalo())); inline(new FontEncoder(text.getFont())); inline(new PlacementEncoder(text.getLabelPlacement())); if (text instanceof TextSymbolizer2) { inline(new GraphicEncoder(((TextSymbolizer2) text).getGraphic(), false)); } super.encode(text); }
/** * get the priority from the symbolizer its an expression, so it will try to * evaluate it: 1. if its missing --> DEFAULT_PRIORITY 2. if its a number, * return that number 3. if its not a number, convert to string and try to * parse the number; return the number 4. otherwise, return DEFAULT_PRIORITY * * @param symbolizer * @param feature */ public double getPriority(TextSymbolizer symbolizer, Feature feature) { if (symbolizer.getPriority() == null) return DEFAULT_PRIORITY; // evaluate try { Double number = (Double) symbolizer.getPriority().evaluate(feature, Double.class); return number.doubleValue(); } catch (Exception e) { return DEFAULT_PRIORITY; } }
/** * get the priority from the symbolizer its an expression, so it will try to * evaluate it: 1. if its missing --> DEFAULT_PRIORITY 2. if its a number, * return that number 3. if its not a number, convert to string and try to * parse the number; return the number 4. otherwise, return DEFAULT_PRIORITY * * @param symbolizer * @param feature */ public double getPriority(TextSymbolizer symbolizer, Feature feature) { if (symbolizer.getPriority() == null) return DEFAULT_PRIORITY; // evaluate try { Double number = (Double) symbolizer.getPriority().evaluate( feature, Double.class ); return number.doubleValue(); } catch (Exception e) { return DEFAULT_PRIORITY; } }
if (text.getPriority() != null) { element("Priority", text.getPriority());
if (text.getPriority() != null) { text.getPriority().accept(this, null);
if ((symbolizer.getPriority() != null) && (!(symbolizer.getPriority() instanceof Literal)))
if ((symbolizer.getPriority() != null) && (!(symbolizer.getPriority() instanceof Literal)))
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 void visit(TextSymbolizer text) { TextSymbolizer copy = sf.createTextSymbolizer(); copy.setFill( copy( text.getFill())); copy.setFont( copy( text.getFont())); 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); }
copy.setLabel(copy(text.getLabel())); copy.setLabelPlacement(copy(text.getLabelPlacement())); copy.setPriority(copy(text.getPriority())); copy.getOptions().putAll(text.getOptions());
@Override protected void encode(TextSymbolizer text) { put("label", text.getLabel()); put("priority", text.getPriority()); inline(new FillEncoder(text.getFill())); inline(new HaloEncoder(text.getHalo())); inline(new FontEncoder(text.getFont())); inline(new PlacementEncoder(text.getLabelPlacement())); if (text instanceof TextSymbolizer2) { inline(new GraphicEncoder(((TextSymbolizer2) text).getGraphic(), false)); } super.encode(text); }
@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) } }
if (text.getPriority() != null) { element("Priority", text.getPriority());
if (text.getPriority() != null) { text.getPriority().accept(this,null);
if (text.getPriority() != null) { start("Priority"); element("PropertyName", text.getPriority()); end("Priority");
if (text.getPriority() != null) { text.getPriority().accept(this,null);