ps.setGraphic(styleFactory.createDefaultGraphic()); ps.getGraphic().graphicalSymbols().add(mark);
/** * create a point symbolizer * * @param graphic - the graphic object to draw at the point * @return the new point symbolizer */ public PointSymbolizer createPointSymbolizer(Graphic graphic) { PointSymbolizer ps = sf.createPointSymbolizer(); ps.setGraphic(graphic); return ps; }
public PointSymbolizer createPointSymbolizer(Graphic graphic, String geometryPropertyName) { PointSymbolizer pSymb = new PointSymbolizerImpl(); pSymb.setGeometryPropertyName(geometryPropertyName); pSymb.setGraphic(graphic); return pSymb; }
symbol.setGeometry(parseGeometry(child)); } else if (childName.equalsIgnoreCase(graphicSt)) { symbol.setGraphic(parseGraphic(child)); } else if (childName.equalsIgnoreCase(VendorOptionString)) { parseVendorOption(symbol.getOptions(), child);
public void visit(PointSymbolizer ps) { PointSymbolizer copy = sf.getDefaultPointSymbolizer(); copy.setGeometry(copy(ps.getGeometry())); copy.setUnitOfMeasure(ps.getUnitOfMeasure()); copy.setGraphic(copy(ps.getGraphic())); copy.getOptions().putAll(ps.getOptions()); if (STRICT) { if (!copy.equals(ps)) { throw new IllegalStateException("Was unable to duplicate provided Graphic:" + ps); } } pages.push(copy); }
public PointSymbolizer build() { if (unset) { return null; } PointSymbolizer ps = sf.createPointSymbolizer(); ps.setGeometry(geometry); ps.setGraphic(graphic.build()); if (uom != null) { ps.setUnitOfMeasure(uom); } ps.getOptions().putAll(options); if (parent == null) { reset(); } return ps; }
/** * getValue ... * * @see org.geotools.xml.schema.Type#getValue(org.geotools.xml.schema.Element, * org.geotools.xml.schema.ElementValue[], org.xml.sax.Attributes, java.util.Map) * @param element * @param value * @param attrs1 * @param hints * @throws OperationNotSupportedException */ public Object getValue(Element element, ElementValue[] value, Attributes attrs1, Map hints) throws OperationNotSupportedException { PointSymbolizer symbol = StyleFactoryFinder.createStyleFactory().getDefaultPointSymbolizer(); // symbol.setGraphic(null); for (int i = 0; i < value.length; i++) { if ((value[i] == null) || value[i].getElement() == null) { continue; } Element e = value[i].getElement(); if (elems[GEOMETRY].getName().equals(e.getName())) symbol.setGeometryPropertyName((String) value[i].getValue()); if (elems[GRAPHIC].getName().equals(e.getName())) symbol.setGraphic((Graphic) value[i].getValue()); } return symbol; } }
/** This test created from Render2DTest.testSimplePointRender */ public void testCreatePointStyle() { // The following is complex, and should be built from // an SLD document and not by hand PointSymbolizer pointsym = sf.createPointSymbolizer(); pointsym.setGraphic(sf.getDefaultGraphic()); NumberRange<Double> scaleRange = NumberRange.create(1.0, 50000.0); Style2D style = sld.createPointStyle(null, pointsym, scaleRange); assertNotNull(style); }
ps.setGraphic((Graphic) node.getChildValue("Graphic"));
public void apply() { if (symbol != null) { symbol.setGraphic(guiGraphic.getEdited()); } }
/** * create a point symbolizer * * @param graphic - the graphic object to draw at the point * * @return the new point symbolizer */ public PointSymbolizer createPointSymbolizer(Graphic graphic) { PointSymbolizer ps = sf.createPointSymbolizer(); ps.setGraphic(graphic); return ps; }
public PointSymbolizer createPointSymbolizer(Graphic graphic, String geometryPropertyName) { PointSymbolizer pSymb = new PointSymbolizerImpl(); pSymb.setGeometryPropertyName(geometryPropertyName); pSymb.setGraphic(graphic); return pSymb; }
public PointSymbolizer createPointSymbolizer(Graphic graphic, String geometryPropertyName) { PointSymbolizer pSymb = new PointSymbolizerImpl(); pSymb.setGeometryPropertyName(geometryPropertyName); pSymb.setGraphic(graphic); return pSymb; }
point.setGraphic(rule.getLegend()); graphic = point.getGraphic();
@Test public void testLegend() throws Exception { StyleFactory sf = CommonFactoryFinder.getStyleFactory(); FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(); PointSymbolizer p = sf.createPointSymbolizer(); Mark mark = sf.mark(ff.literal("circle"), sf.fill(null, ff.literal("#FF0000"), null), null); p.setGraphic(sf.createGraphic(null, new Mark[] {mark}, null, null, null, null)); Rule rule = sf.createRule(); rule.symbolizers().add(p); ExternalGraphic eg = sf.createExternalGraphic("smileyface.png", "image/png"); rule.setLegend(sf.createGraphic(new ExternalGraphic[] {eg}, null, null, null, null, null)); StringWriter out = new StringWriter(); Ysld.encode(sld(sf.createFeatureTypeStyle(new Rule[] {rule})), out); // System.out.append(out.toString()); YamlMap obj = new YamlMap(YamlUtil.getSafeYaml().load(out.toString())); YamlMap result = obj.seq("feature-styles") .map(0) .seq("rules") .map(0) .map("legend") .seq("symbols") .map(0) .map("external"); assertEquals("smileyface.png", result.str("url")); assertEquals("image/png", result.str("format")); }
/** * Tests size calculation of dynamically sized feature, using real-world units combined with * DPI-based resizing. */ @Test public void testCombinedResizingDpiUom() { // given: Point with dynamic size in real-world units int sizeNum = 10; double scaleDpi = 2; double scaleUom = 3; PointSymbolizer symbolizer = sb.createPointSymbolizer(); Graphic graphic = sb.createGraphic(); graphic.setSize(ff.function("strConcat", ff.property("size"), ff.literal("m"))); symbolizer.setGraphic(graphic); // when: DPI based resizing is applied RescaleStyleVisitor dpiVisitor = new GraphicsAwareDpiRescaleStyleVisitor(scaleDpi); symbolizer.accept(dpiVisitor); symbolizer = (PointSymbolizer) dpiVisitor.getCopy(); // and: UOM resizing is applied UomRescaleStyleVisitor uomVisitor = new UomRescaleStyleVisitor(scaleUom); uomVisitor.visit(symbolizer); symbolizer = (PointSymbolizer) uomVisitor.getCopy(); SimpleFeature feature = createFeatureSized(sizeNum); // then: only the UOM resizing must have an effect Double size = symbolizer.getGraphic().getSize().evaluate(feature, Double.class); assertEquals(sizeNum * scaleUom, size.doubleValue(), 0d); }
private PointSymbolizer injectPointSymbolizer(String key, PointSymbolizer original) { PointSymbolizer copy = styleFactory.createPointSymbolizer(); if (original.getGraphic() != null) { copy.setGraphic(injectGraphic(key, original.getGraphic())); } return copy; }
public void visit(PointSymbolizer ps) { PointSymbolizer copy = sf.getDefaultPointSymbolizer(); copy.setGeometry(copy(ps.getGeometry())); copy.setUnitOfMeasure(ps.getUnitOfMeasure()); copy.setGraphic( copy( ps.getGraphic() )); copy.getOptions().putAll(ps.getOptions()); if( STRICT ){ if( !copy.equals( ps )){ throw new IllegalStateException("Was unable to duplicate provided Graphic:"+ps ); } } pages.push(copy); }
pointsym.setGraphic(sFac.getDefaultGraphic()); pointsym.setGeometryPropertyName("point");
pointsym.setGraphic(sFac.getDefaultGraphic());