/** * create a fill of color * * @param fillColor an Expression representing the color of the fill * @return the fill constructed */ public Fill createFill(Expression fillColor) { return sf.createFill(fillColor); }
/** * create a fill with the supplied color and opacity * * @param color an expression representing the color to fill with * @param opacity an expression representing the opacity of the fill 0 - transparent, 1 - * completly filled * @return the fill created */ public Fill createFill(Expression color, Expression opacity) { return sf.createFill(color, opacity); }
/** * create a fill with color, background color and opacity supplied and uses the graphic supplied * for the fill * * @param color an Expression representing the foreground color * @param backgroundColor an Expression representing the background color * @param opacity an Expression representing the opacity of the fill * @param fill the graphic object to use to fill the fill * @return the fill created */ public Fill createFill( Expression color, Expression backgroundColor, Expression opacity, Graphic fill) { return sf.createFill(color, backgroundColor, opacity, fill); }
} else if ("polygon".equalsIgnoreCase(type)) { PolygonSymbolizer ps = styleFactory.createPolygonSymbolizer(); ps.setFill(styleFactory.createFill(filterFactory.literal(color))); } else { Mark mark = styleFactory.createMark(); mark.setFill(styleFactory.createFill(filterFactory.literal(color)));
protected abstract void fill(Fill fill); }
/** * create a fill with the supplied color and opacity * * @param fillColor the color to fill with * @param opacity the opacity of the fill 0 - transparent, 1 - completly filled * @return the fill created */ public Fill createFill(Color fillColor, double opacity) { return sf.createFill(colorExpression(fillColor), literalExpression(opacity)); }
/** * Build Fill as defined; FillBuilder will be reset after this use. * * @return Created Fill as defined */ public Fill build() { if (unset) { return null; } Fill fill = sf.createFill(color, null, opacity, graphic.build()); if (parent == null) { reset(); } return fill; }
/** Internal parse method - made protected for unit testing */ protected Halo parseHalo(Node root) { if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.finest("parsing halo"); } Halo halo = factory.createHalo(factory.createFill(ff.literal("#FFFFFF")), ff.literal(1.0)); NodeList children = root.getChildNodes(); final int length = children.getLength(); for (int i = 0; i < length; i++) { Node child = children.item(i); if ((child == null) || (child.getNodeType() != Node.ELEMENT_NODE)) { continue; } String childName = child.getLocalName(); if (childName == null) { childName = child.getNodeName(); } if (childName.equalsIgnoreCase(fillSt)) { halo.setFill(parseFill(child)); } else if (childName.equalsIgnoreCase("Radius")) { halo.setRadius(parseCssParameter(child)); } } return halo; }
/** * create a fill with color, background color and opacity supplied and uses the graphic supplied * for the fill * * @param color the foreground color * @param backgroundColor the background color * @param opacity the opacity of the fill * @param fill the graphic object to use to fill the fill * @return the fill created */ public Fill createFill(Color color, Color backgroundColor, double opacity, Graphic fill) { return sf.createFill( colorExpression(color), colorExpression(backgroundColor), literalExpression(opacity), fill); }
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { // get the children and apply the defaults in case they are missing Fill fill = (Fill) node.getChildValue("Fill"); if (fill == null) { fill = styleFactory.createFill(filterFactory.literal("#FFFFFF")); } Expression radius = (Expression) node.getChildValue("Radius"); if (radius == null) { radius = filterFactory.literal(1.0); } return styleFactory.createHalo(fill, radius); } }
/** * Create a polygon style with the given colors and opacity. * * @param outlineColor color of polygon outlines * @param fillColor color for the fill * @param opacity proportional opacity (0 to 1) * @return a new Style instance */ public static Style createPolygonStyle(Color outlineColor, Color fillColor, float opacity) { Stroke stroke = sf.createStroke(ff.literal(outlineColor), ff.literal(1.0f)); Fill fill = Fill.NULL; if (fillColor != null) { fill = sf.createFill(ff.literal(fillColor), ff.literal(opacity)); } return wrapSymbolizers(sf.createPolygonSymbolizer(stroke, fill, null)); }
public void testFill() { Fill fill = styleFactory.getDefaultFill(); Fill clone = (Fill) ((Cloneable) fill).clone(); assertClone(fill, clone); Fill notEq = styleFactory.createFill(filterFactory.literal("#FF0000")); assertEqualsContract(clone, notEq, fill); }
public void testFill() { Fill fill = sf.getDefaultFill(); Fill clone = visitor.copy(fill); assertCopy(fill, clone); Fill notEq = sf.createFill(ff.literal("#FF0000")); assertEqualsContract(clone, notEq, fill); }
public void testResizeGraphicFill() throws Exception { URL url = StreamingRenderer.class.getResource("test-data/"); PolygonSymbolizer symb = sf.createPolygonSymbolizer(); ExternalGraphic eg = sf.createExternalGraphic(url + "icon64.png", "image/png"); Graphic g = sf.createGraphic( new ExternalGraphic[] {eg}, null, null, null, ff.literal(20), null); Fill fill = sf.createFill(null, null, null, g); symb.setFill(fill); PolygonStyle2D ps = sld.createPolygonStyle(feature, symb, range); assertTrue(ps.getFill() instanceof TexturePaint); TexturePaint paint = (TexturePaint) ps.getFill(); assertEquals(20, paint.getImage().getWidth()); }
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); }
public void testTexturePaintNoSize() throws Exception { PolygonSymbolizer symb = sf.createPolygonSymbolizer(); Mark myMark = sf.createMark(); myMark.setWellKnownName(ff.literal("square")); org.geotools.styling.Fill fill = sf.createFill(null); fill.setGraphicFill(sf.createGraphic(null, new Mark[] {myMark}, null, null, null, null)); symb.setFill(fill); PolygonStyle2D ps = sld.createPolygonStyle(feature, symb, range); assertTrue(ps.getFill() instanceof TexturePaint); }
@Test public void testGEOT3111() throws Exception { FilterFactory2 ff2 = CommonFactoryFinder.getFilterFactory2(null); StyleFactory sf = CommonFactoryFinder.getStyleFactory(null); Symbolizer sym = sf.createPolygonSymbolizer( Stroke.NULL, sf.createFill(ff2.literal(Color.CYAN)), null); Style style = SLD.wrapSymbolizers(sym); MapContent mc = new MapContent(); mc.addLayer(new FeatureLayer(fs, style)); StreamingRenderer renderer = new StreamingRenderer(); renderer.setMapContent(mc); renderer.setJava2DHints(new RenderingHints(KEY_ANTIALIASING, VALUE_ANTIALIAS_ON)); RendererBaseTest.showRender("GEOT-3111", renderer, TIME, bounds); } }
/** Test of createPointStyle method, of class org.geotools.renderer.style.SLDStyleFactory. */ public void testCreateCompletePointStyle() { PointSymbolizer symb; Mark myMark; // full symbolizer symb = sf.createPointSymbolizer(); myMark = sf.createMark(); myMark.setFill(sf.createFill(ff.literal("#ffff00"))); symb.getGraphic().setSize(ff.literal(10)); symb.getGraphic().addMark(myMark); symb.getGraphic().setOpacity(ff.literal(1)); symb.getGraphic().setRotation(ff.literal(0)); sld.createPointStyle(null, symb, range); }