@Override protected void fill(Fill fill) { sym.setFill(fill); } });
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { Color color = (Color) value; TextSymbolizer textSymbolizer = sb.createTextSymbolizer(); textSymbolizer.setFill(sb.createFill(color)); return textSymbolizer; } }
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; }
/** * Creates a default text symbolizer. Warning: there is no definition of a default text * symbolizer in the SLD standard, this is provided just for convenience and uniformity with the * other symbolizers * * @return the default text symbolizer */ public TextSymbolizer createTextSymbolizer() { TextSymbolizer ts = sf.createTextSymbolizer(); ts.setFill(createFill(Color.BLACK)); ts.setLabel(literalExpression("Label")); ts.fonts().add(createFont("Lucida Sans", 10)); return ts; }
ts.setFill(fill);
@Override protected void fill(Fill fill) { sym.setFill(fill); } });
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 void testKerningOffByDefault() throws Exception { TextSymbolizer ts = sf.createTextSymbolizer(); ts.setFill(sf.createFill(null)); Font font = sf.createFont( ff.literal("Serif"), ff.literal("italic"), ff.literal("bold"), ff.literal(20)); ts.setFont(font); ts.getOptions().put(TextSymbolizer.KERNING_KEY, "false"); TextStyle2D tsd = (TextStyle2D) sld.createTextStyle(feature, ts, range); assertEquals(20, tsd.getFont().getSize()); Map<TextAttribute, ?> attributes = tsd.getFont().getAttributes(); Object kerningValue = attributes.get(TextAttribute.KERNING); assertNull(kerningValue); }
public void testKerningOnByDefault() throws Exception { TextSymbolizer ts = sf.createTextSymbolizer(); ts.setFill(sf.createFill(null)); Font font = sf.createFont( ff.literal("Serif"), ff.literal("italic"), ff.literal("bold"), ff.literal(20)); ts.setFont(font); TextStyle2D tsd = (TextStyle2D) sld.createTextStyle(feature, ts, range); assertEquals(20, tsd.getFont().getSize()); Map<TextAttribute, ?> attributes = tsd.getFont().getAttributes(); Object kerningValue = attributes.get(TextAttribute.KERNING); assertEquals(TextAttribute.KERNING_ON, kerningValue); }
public void testUnknownFont() throws Exception { TextSymbolizer ts = sf.createTextSymbolizer(); ts.setFill(sf.createFill(null)); Font font = sf.createFont( ff.literal("notExistingFont"), ff.literal("italic"), ff.literal("bold"), ff.literal(20)); ts.setFont(font); TextStyle2D tsd = (TextStyle2D) sld.createTextStyle(feature, ts, range); assertEquals(20, tsd.getFont().getSize()); assertEquals(java.awt.Font.ITALIC | java.awt.Font.BOLD, tsd.getFont().getStyle()); assertEquals("Serif", tsd.getFont().getName()); assertEquals(0.0, tsd.getAnchorX(), 0.0); assertEquals(0.5, tsd.getAnchorY(), 0.0); }
ts.setFill((Fill) node.getChildValue("Fill"));
@Override public void visit(TextSymbolizer text) { super.visit(text); TextSymbolizer textCopy = (TextSymbolizer) pages.peek(); Fill textFill = textCopy.getFill(); if (textFill != null) { textFill.setOpacity(textExp); } else { textCopy.setFill(defaultTextFill); } } }
@Override public void visit(TextSymbolizer text) { super.visit(text); TextSymbolizer textCopy = (TextSymbolizer) pages.peek(); Fill textFill = textCopy.getFill(); if (textFill != null) { textFill.setOpacity(textExp); } else { textCopy.setFill(defaultTextFill); } } }
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; }
public TextSymbolizer createTextSymbolizer(Fill fill, Font[] fonts, Halo halo, Expression label, LabelPlacement labelPlacement, String geometryPropertyName) { TextSymbolizer tSymb = new TextSymbolizerImpl(); tSymb.setFill(fill); tSymb.setFonts(fonts); tSymb.setGeometryPropertyName(geometryPropertyName); tSymb.setHalo(halo); tSymb.setLabel(label); tSymb.setPlacement(labelPlacement); return tSymb; }
/** * Creates a default text symbolizer. Warning: there is no definition of a default text * symbolizer in the SLD standard, this is provided just for convenience and uniformity with * the other symbolizers * * @return the default text symbolizer */ public TextSymbolizer createTextSymbolizer() { TextSymbolizer ts = sf.createTextSymbolizer(); ts.setFill(createFill(Color.BLACK)); ts.setLabel(literalExpression("Label")); ts.setFonts(new Font[] { createFont("Lucida Sans", 10)}); return ts; }
/** * Creates a default text symbolizer. Warning: there is no definition of a default text * symbolizer in the SLD standard, this is provided just for convenience and uniformity with * the other symbolizers * * @return the default text symbolizer */ public TextSymbolizer createTextSymbolizer() { TextSymbolizer ts = sf.createTextSymbolizer(); ts.setFill(createFill(Color.BLACK)); ts.setLabel(literalExpression("Label")); ts.setFonts(new Font[] { createFont("Lucida Sans", 10)}); return ts; }
public void apply() { if (symbol != null) { symbol.setFill(guiFill.getEdited()); symbol.setLabel(guiLabel.getExpression()); symbol.setGeometryPropertyName(guiGeom.getGeom()); symbol.setFonts(guiFonts.getEdited()); symbol.setHalo(guiHalo.getEdited()); symbol.setPlacement(guiPlacement.getEdited()); } }