@Override protected void graphic(Graphic g) { stroke().setGraphicStroke(g); } });
if (LOGGER.isLoggable(Level.FINEST)) LOGGER.finest("setting stroke graphicStroke with " + g); stroke.setGraphicStroke(g);
/** * 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 { Stroke symbol = StyleFactoryFinder.createStyleFactory().getDefaultStroke(); for (int i = 0; i < value.length; i++) { if ((value[i] == null) || value[i].getElement() == null) { continue; } Element e = value[i].getElement(); if (elems[GRAPHICFILL].getName().equals(e.getName())) symbol.setGraphicFill((Graphic) value[i].getValue()); if (elems[GRAPHICSTROKE].getName().equals(e.getName())) symbol.setGraphicStroke((Graphic) value[i].getValue()); // if (elems[CSSPARAMETER].getName().equals(e.getName())) { // // TODO apply the css // } } return symbol; } }
public void visit(Stroke stroke) { Stroke copy = sf.getDefaultStroke(); copy.setColor(copy(stroke.getColor())); copy.setDashArray(copyExpressions(stroke.dashArray())); copy.setDashOffset(copy(stroke.getDashOffset())); copy.setGraphicFill(copy(stroke.getGraphicFill())); copy.setGraphicStroke(copy(stroke.getGraphicStroke())); copy.setLineCap(copy(stroke.getLineCap())); copy.setLineJoin(copy(stroke.getLineJoin())); copy.setOpacity(copy(stroke.getOpacity())); copy.setWidth(copy(stroke.getWidth())); if (STRICT && !copy.equals(stroke)) { throw new IllegalStateException("Was unable to duplicate provided Stroke:" + stroke); } pages.push(copy); }
@Override protected void graphic(Graphic g) { stroke().setGraphicStroke(g); } });
/** * Increase stroke width. * * <p>Based on feedback we may need to change the dash array as well. * * <p> */ public void visit(org.geotools.styling.Stroke stroke) { Stroke copy = sf.getDefaultStroke(); copy.setColor(copy(stroke.getColor())); copy.setDashArray(rescaleDashArray(stroke.dashArray())); copy.setDashOffset(rescale(stroke.getDashOffset())); copy.setGraphicFill(copy(stroke.getGraphicFill())); copy.setGraphicStroke(copy(stroke.getGraphicStroke())); copy.setLineCap(copy(stroke.getLineCap())); copy.setLineJoin(copy(stroke.getLineJoin())); copy.setOpacity(copy(stroke.getOpacity())); copy.setWidth(rescale(stroke.getWidth())); pages.push(copy); }
Graphic g = sf.createGraphic(null, new Mark[] {mark}, null, null, null, null); Stroke s = sf.createStroke(null, null); s.setGraphicStroke(g); l.setStroke(s);
stroke.setDashOffset(dashOffset); stroke.setGraphicFill(graphicFill); stroke.setGraphicStroke(graphicStroke);
stroke.setGraphicStroke( sb.createGraphic(null, sb.createMark("square", null, sb.createStroke(1)), null));
double expectedAnchorPointY = 0.75; graphic.setAnchorPoint(sb.createAnchorPoint(expectedAnchorPointX, expectedAnchorPointY)); stroke.setGraphicStroke(graphic);
@Override public void visit(Stroke stroke) { super.visit(stroke); Stroke copy = (Stroke) pages.peek(); if (copy.getGraphicFill() != null) { copy.setGraphicFill(null); } if (copy.getGraphicStroke() != null) { copy.setWidth(getSymbolsSize(copy.getGraphicStroke())); copy.setGraphicStroke(null); } copy.setColor(colorFunction); copy.setOpacity(LITERAL_ONE); if (copy.dashArray() != null) { copy.dashArray().clear(); } copy.setDashOffset(null); }
private void butStrokeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butStrokeActionPerformed JGraphicPane pane = new JGraphicPane(); pane.setLayer(layer); if(stroke != null){ pane.setEdited(stroke.getGraphicStroke()); } JSimpleDialog dia = new JSimpleDialog(null,true,pane); dia.pack(); dia.setLocationRelativeTo(butStroke); dia.setVisible(true); if(stroke == null){ stroke = new StyleBuilder().createStroke() ; } stroke.setGraphicStroke(pane.getEdited()); }//GEN-LAST:event_butStrokeActionPerformed
public void visit(Stroke stroke) { Stroke copy = sf.getDefaultStroke(); copy.setColor( copy(stroke.getColor())); copy.setDashArray( copy(stroke.getDashArray())); copy.setDashOffset( copy( stroke.getDashOffset())); copy.setGraphicFill( copy(stroke.getGraphicFill())); copy.setGraphicStroke( copy( stroke.getGraphicStroke())); copy.setLineCap(copy(stroke.getLineCap())); copy.setLineJoin( copy(stroke.getLineJoin())); copy.setOpacity( copy(stroke.getOpacity())); copy.setWidth( copy(stroke.getWidth())); if( STRICT && !copy.equals( stroke)){ throw new IllegalStateException("Was unable to duplicate provided Stroke:"+stroke ); } pages.push(copy); }
@Test public void testDynamicSymbolizerStrokeLineSymbolizer() { ExternalGraphic dynamicSymbolizer = sb.createExternalGraphic("file://./${myAttribute}.jpeg", "image/jpeg"); Graphic graphic = sb.createGraphic(dynamicSymbolizer, null, null); LineSymbolizer ls = sb.createLineSymbolizer(); ls.getStroke().setGraphicStroke(graphic); Style style = sb.createStyle(ls); checkSingleSymbolizer(style, ls); }
@Test public void testMixDynamicGraphicStroke() { Style style = sb.createStyle(); FeatureTypeStyle fts1 = sb.createFeatureTypeStyle("Feature", staticPolygonRule); Graphic graphic = sb.createGraphic(null, sb.createMark("square"), null); graphic.setSize(sb.getFilterFactory().property("myAttribute")); LineSymbolizer ls = sb.createLineSymbolizer(); ls.getStroke().setGraphicStroke(graphic); FeatureTypeStyle fts2 = sb.createFeatureTypeStyle(ls); style.featureTypeStyles().add(fts1); style.featureTypeStyles().add(fts2); checkSingleSymbolizer(style, ls); }
@Test public void testStaticGraphicLineSymbolizer() { ExternalGraphic dynamicSymbolizer = sb.createExternalGraphic("file://./hello.jpeg", "image/jpeg"); Graphic graphic = sb.createGraphic(dynamicSymbolizer, null, null); LineSymbolizer ls = sb.createLineSymbolizer(); ls.getStroke().setGraphicStroke(graphic); Style style = sb.createStyle(ls); style.accept(visitor); Style copy = (Style) visitor.getCopy(); assertNull(copy); }
@Test public void testGraphicStroke() { Graphic graphic = sb.createGraphic(null, sb.createMark("square"), null); graphic.setSize(ff.literal(8)); Stroke stroke = sb.createStroke(); stroke.setGraphicStroke(graphic); Style style = sb.createStyle(sb.createLineSymbolizer(stroke)); style.accept(visitor); Style copy = (Style) visitor.getCopy(); LineSymbolizer ls = (LineSymbolizer) copy.featureTypeStyles().get(0).rules().get(0).symbolizers().get(0); stroke = ls.getStroke(); assertEquals(colorFunction, stroke.getColor()); assertEquals(Integer.valueOf(8), stroke.getWidth().evaluate(null, Integer.class)); assertNull(stroke.dashArray()); }
/** * Increase stroke width. * <p> * Based on feedback we may need to change the dash array as well. * <p> */ public void visit(org.geotools.styling.Stroke stroke) { Stroke copy = sf.getDefaultStroke(); copy.setColor( copy(stroke.getColor())); copy.setDashArray( rescale(stroke.getDashArray())); copy.setDashOffset( rescale(stroke.getDashOffset())); copy.setGraphicFill( copy(stroke.getGraphicFill())); copy.setGraphicStroke( copy( stroke.getGraphicStroke())); copy.setLineCap(copy(stroke.getLineCap())); copy.setLineJoin( copy(stroke.getLineJoin())); copy.setOpacity( copy(stroke.getOpacity())); copy.setWidth( rescale(stroke.getWidth())); pages.push(copy); }
@Test public void testDynamicStrokeInGraphicMark() { 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); LineSymbolizer ls = sb.createLineSymbolizer(); ls.getStroke().setGraphicStroke(graphic); Style style = sb.createStyle(ls); checkSingleSymbolizer(style, ls); }
@Test public void testGraphicStrokeFill() { Graphic graphic = sb.createGraphic(null, sb.createMark("square"), null); graphic.setSize(ff.literal(8)); Stroke stroke = sb.createStroke(); stroke.setGraphicStroke(graphic); stroke.setOpacity(ff.literal(0.5)); Fill fill = sb.createFill(null, null, 0.5, graphic); PolygonSymbolizer polygonSymbolizer = sb.createPolygonSymbolizer(stroke, fill); Style style = sb.createStyle(polygonSymbolizer); style.accept(visitor); Style copy = (Style) visitor.getCopy(); PolygonSymbolizer ls = (PolygonSymbolizer) copy.featureTypeStyles().get(0).rules().get(0).symbolizers().get(0); Stroke strokeCopy = ls.getStroke(); assertEquals(colorFunction, strokeCopy.getColor()); assertEquals(Integer.valueOf(8), strokeCopy.getWidth().evaluate(null, Integer.class)); assertNull(strokeCopy.dashArray()); assertEquals(Integer.valueOf(1), strokeCopy.getOpacity().evaluate(null, Integer.class)); Fill fillCopy = ls.getFill(); assertEquals(colorFunction, fillCopy.getColor()); assertEquals(Integer.valueOf(1), fillCopy.getOpacity().evaluate(null, Integer.class)); }