@Override protected void graphic(Graphic g) { fill().setGraphicFill(g); } });
if (LOGGER.isLoggable(Level.FINEST)) LOGGER.finest("setting fill graphic with " + g); fill.setGraphicFill(g);
fill.setGraphicFill(graphicFill);
public void visit(Fill fill) { Fill copy = sf.getDefaultFill(); copy.setBackgroundColor(copy(fill.getBackgroundColor())); copy.setColor(copy(fill.getColor())); copy.setGraphicFill(copy(fill.getGraphicFill())); copy.setOpacity(copy(fill.getOpacity())); if (STRICT && !copy.equals(fill)) { throw new IllegalStateException("Was unable to duplicate provided Fill:" + fill); } pages.push(copy); }
public Fill createFill( Expression color, Expression backgroundColor, Expression opacity, Graphic graphicFill) { Fill fill = new FillImpl(filterFactory); if (color == null) { color = Fill.DEFAULT.getColor(); } fill.setColor(color); if (backgroundColor == null) { backgroundColor = Fill.DEFAULT.getBackgroundColor(); } fill.setBackgroundColor(backgroundColor); if (opacity == null) { opacity = Fill.DEFAULT.getOpacity(); } // would be nice to check if this was within bounds but we have to wait until use since it // may depend on an attribute fill.setOpacity(opacity); fill.setGraphicFill(graphicFill); return fill; }
@Override protected void graphic(Graphic g) { fill().setGraphicFill(g); } });
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 testRescalePolygonMargin() throws Exception { // create a graphic that needs rescaling StyleBuilder sb = new StyleBuilder(); // a graphic fill Fill fill = sb.createFill(); fill.setColor(null); fill.setGraphicFill( sb.createGraphic(null, sb.createMark("square", null, sb.createStroke(2)), null)); // a polygon and line symbolizer using them PolygonSymbolizer polygonSymbolizer = sb.createPolygonSymbolizer(sb.createStroke(), fill); polygonSymbolizer.getOptions().put(PolygonSymbolizer.GRAPHIC_MARGIN_KEY, "1 2 3 4"); // rescale it polygonSymbolizer.accept(visitor); PolygonSymbolizer rps = (PolygonSymbolizer) visitor.getCopy(); Mark rm = (Mark) rps.getFill().getGraphicFill().graphicalSymbols().get(0); assertEquals(4.0, rm.getStroke().getWidth().evaluate(null, Double.class), 0d); assertEquals("2 4 6 8", rps.getOptions().get(PolygonSymbolizer.GRAPHIC_MARGIN_KEY)); } }
@Override public void visit(Fill fill) { super.visit(fill); Fill copy = (Fill) pages.peek(); if (copy.getGraphicFill() != null) { copy.setGraphicFill(null); copy.setColor(sb.colorExpression(Color.BLACK)); } }
@Override public void visit(Fill fill) { super.visit(fill); Fill copy = (Fill) pages.peek(); if (copy.getGraphicFill() != null) { copy.setGraphicFill(null); } copy.setColor(colorFunction); copy.setOpacity(LITERAL_ONE); }
if (LOGGER.isLoggable(Level.FINEST)) LOGGER.finest("setting fill graphic with " + g); fill.setGraphicFill(g);
Graphic g = parseGraphic(child); LOGGER.finest("setting fill graphic with " + g); fill.setGraphicFill(g);
fill.setGraphicFill( sb.createGraphic(null, sb.createMark("square", null, sb.createStroke(2)), null));
private void butFillActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butFillActionPerformed JDialog dia = new JDialog(); JGraphicPane pane = new JGraphicPane(); pane.setLayer(layer); if (fill != null) { pane.setEdited(fill.getGraphicFill()); } dia.setContentPane(pane); dia.pack(); dia.setLocationRelativeTo(butFill); dia.setModal(true); dia.setVisible(true); if (fill == null) { fill = new StyleBuilder().createFill(); } fill.setGraphicFill(pane.getEdited()); }//GEN-LAST:event_butFillActionPerformed
fill.setGraphicFill(graphicFill);
public void visit(Fill fill) { Fill copy = sf.getDefaultFill(); copy.setBackgroundColor( copy( fill.getBackgroundColor()) ); copy.setColor(copy( fill.getColor())); copy.setGraphicFill( copy(fill.getGraphicFill())); copy.setOpacity( copy(fill.getOpacity())); if( STRICT && !copy.equals( fill )){ throw new IllegalStateException("Was unable to duplicate provided Fill:"+fill ); } pages.push(copy); }
fill.setGraphicFill( sb.createGraphic(null, sb.createMark("square", null, sb.createStroke(2)), null));
public Fill createFill(Expression color, Expression backgroundColor, Expression opacity, Graphic graphicFill) { Fill fill = new FillImpl(filterFactory); if (color == null) { color = Fill.DEFAULT.getColor(); } fill.setColor(color); if (backgroundColor == null) { backgroundColor = Fill.DEFAULT.getBackgroundColor(); } fill.setBackgroundColor(backgroundColor); if (opacity == null) { opacity = Fill.DEFAULT.getOpacity(); } // would be nice to check if this was within bounds but we have to wait until use since it may depend on an attribute fill.setOpacity(opacity); fill.setGraphicFill(graphicFill); return fill; }
public Fill createFill(Expression color, Expression backgroundColor, Expression opacity, Graphic graphicFill) { Fill fill = new FillImpl(); if (color == null) { color = Fill.DEFAULT.getColor(); } fill.setColor(color); if (backgroundColor == null) { backgroundColor = Fill.DEFAULT.getBackgroundColor(); } fill.setBackgroundColor(backgroundColor); if (opacity == null) { opacity = Fill.DEFAULT.getOpacity(); } // would be nice to check if this was within bounds but we have to wait until use since it may depend on an attribute fill.setOpacity(opacity); fill.setGraphicFill(graphicFill); return fill; }
@Test // this one should fail now?? public void testDynamicStrokeInGraphicFill() { Stroke markStroke = sb.createStroke(); markStroke.setWidth(sb.getFilterFactory().property("myAttribute")); Mark mark = sb.createMark("square"); mark.setStroke(markStroke); Graphic graphic = sb.createGraphic(null, mark, null); PolygonSymbolizer ps = sb.createPolygonSymbolizer(); ps.getFill().setGraphicFill(graphic); Style style = sb.createStyle(ps); style.accept(visitor); Style copy = (Style) visitor.getCopy(); assertNull(copy); } }