/** * Creates the default graphic object * * @return the graphic object */ public Graphic createGraphic() { Graphic gr = sf.getDefaultGraphic(); Mark mark = createMark(MARK_SQUARE, Color.decode("#808080"), Color.BLACK, 1); gr.setMarks(new Mark[] {mark}); gr.setSize(Expression.NIL); return gr; }
/** * creates a graphic object * * @param externalGraphic an external graphic to use if displayable * @param mark a mark to use * @param symbol a symbol to use * @return the graphic object */ public Graphic createGraphic(ExternalGraphic externalGraphic, Mark mark, Symbol symbol) { Graphic gr = sf.getDefaultGraphic(); if (symbol != null) { gr.setSymbols(new Symbol[] {symbol}); } else { gr.setSymbols(new Symbol[0]); } if (externalGraphic != null) { gr.setExternalGraphics(new ExternalGraphic[] {externalGraphic}); } if (mark != null) { gr.setMarks(new Mark[] {mark}); } else { gr.setMarks(new Mark[0]); } return gr; }
public void visit(Graphic gr) { Graphic copy = null; Displacement displacementCopy = copy(gr.getDisplacement()); ExternalGraphic[] externalGraphicsCopy = copy(gr.getExternalGraphics()); Mark[] marksCopy = copy(gr.getMarks()); Expression opacityCopy = copy(gr.getOpacity()); Expression rotationCopy = copy(gr.getRotation()); Expression sizeCopy = copy(gr.getSize()); AnchorPoint anchorCopy = copy(gr.getAnchorPoint()); // Looks like Symbols are a "view" of marks and external graphics? // Symbol[] symbolCopys = copy( gr.getSymbols() ); copy = sf.createDefaultGraphic(); copy.setDisplacement(displacementCopy); copy.setAnchorPoint(anchorCopy); copy.setExternalGraphics(externalGraphicsCopy); copy.setMarks(marksCopy); copy.setOpacity(opacityCopy); copy.setRotation(rotationCopy); copy.setSize(sizeCopy); // copy.setSymbols(symbolCopys); if (STRICT) { if (!copy.equals(gr)) { throw new IllegalStateException("Was unable to duplicate provided Graphic:" + gr); } } pages.push(copy); }
copy.setAnchorPoint(anchorCopy); copy.setExternalGraphics(externalGraphicsCopy); copy.setMarks(marksCopy); copy.setOpacity((Expression) opacityCopy); copy.setRotation((Expression) rotationCopy);
/** * Creates the default graphic object * * @return the graphic object */ public Graphic createGraphic() { Graphic gr = sf.getDefaultGraphic(); Mark mark = createMark(MARK_SQUARE, Color.decode("#808080"), Color.BLACK, 1); gr.setMarks( new Mark[] { mark }); gr.setSize(Expression.NIL); return gr; }
/** * Creates the default graphic object * * @return the graphic object */ public Graphic createGraphic() { Graphic gr = sf.getDefaultGraphic(); Mark mark = createMark(MARK_SQUARE, Color.decode("#808080"), Color.BLACK, 1); gr.setMarks( new Mark[] { mark }); gr.setSize(Expression.NIL); return gr; }
/** * creates a graphic object * * @param externalGraphic an external graphic to use if displayable * @param mark a mark to use * @param symbol a symbol to use * * @return the graphic object */ public Graphic createGraphic(ExternalGraphic externalGraphic, Mark mark, Symbol symbol) { Graphic gr = sf.getDefaultGraphic(); if (symbol != null) { gr.setSymbols(new Symbol[] { symbol }); } else { gr.setSymbols(new Symbol[0]); } if (externalGraphic != null) { gr.setExternalGraphics(new ExternalGraphic[] { externalGraphic }); } if (mark != null) { gr.setMarks(new Mark[] { mark }); } else { gr.setMarks(new Mark[0]); } return gr; }
/** * creates a graphic object * * @param externalGraphic an external graphic to use if displayable * @param mark a mark to use * @param symbol a symbol to use * * @return the graphic object */ public Graphic createGraphic(ExternalGraphic externalGraphic, Mark mark, Symbol symbol) { Graphic gr = sf.getDefaultGraphic(); if (symbol != null) { gr.setSymbols(new Symbol[] { symbol }); } else { gr.setSymbols(new Symbol[0]); } if (externalGraphic != null) { gr.setExternalGraphics(new ExternalGraphic[] { externalGraphic }); } if (mark != null) { gr.setMarks(new Mark[] { mark }); } else { gr.setMarks(new Mark[0]); } return gr; }
public void visit(Graphic gr) { Graphic copy = null; Displacement displacementCopy = copy( gr.getDisplacement() ); ExternalGraphic[] externalGraphicsCopy = copy( gr.getExternalGraphics() ); Mark[] marksCopy = copy( gr.getMarks() ); Expression opacityCopy = copy( gr.getOpacity() ); Expression rotationCopy = copy( gr.getRotation() ); Expression sizeCopy = copy( gr.getSize() ); // Looks like Symbols are a "view" of marks and external graphics? // Symbol[] symbolCopys = copy( gr.getSymbols() ); copy = sf.createDefaultGraphic(); copy.setDisplacement(displacementCopy); copy.setExternalGraphics(externalGraphicsCopy); copy.setMarks(marksCopy); copy.setOpacity((Expression) opacityCopy); copy.setRotation((Expression) rotationCopy); copy.setSize((Expression) sizeCopy); // copy.setSymbols(symbolCopys); if( STRICT ){ if( !copy.equals( gr )){ throw new IllegalStateException("Was unable to duplicate provided Graphic:"+gr ); } } pages.push(copy); }
public Graphic createGraphic(ExternalGraphic[] externalGraphics, Mark[] marks, Symbol[] symbols, Expression opacity, Expression size, Expression rotation) { Graphic graphic = new GraphicImpl(); symbols = symbols != null ? symbols : new Symbol[0]; graphic.setSymbols(symbols); externalGraphics = externalGraphics != null ? externalGraphics : new ExternalGraphic[0]; graphic.setExternalGraphics(externalGraphics); marks = marks != null ? marks : new Mark[0]; graphic.setMarks(marks); if (opacity == null) { opacity = Graphic.DEFAULT.getOpacity(); } graphic.setOpacity(opacity); if (size == null) { size = Graphic.DEFAULT.getSize(); } graphic.setSize(size); if (rotation == null) { rotation = Graphic.DEFAULT.getRotation(); } graphic.setRotation(rotation); return graphic; }
public PointSymbolizer createPointSymbolizer() { Fill fill = sb.createFill(randomColor(), 1); Stroke stroke = sb.createStroke(randomColor(), 1); Mark mark = sb.createMark(randomPointShape(), fill, stroke); Graphic gra = sb.createGraphic(); gra.setOpacity(sb.literalExpression(1)); gra.setMarks(new Mark[]{mark}); gra.setSize(sb.literalExpression(randomPointSize())); return sb.createPointSymbolizer(gra); }
public void apply() { if (graphic != null) { graphic.setDisplacement(guiDisplacement.getEdited()); graphic.setGeometryPropertyName(guiGeom.getGeom()); graphic.setOpacity(guiOpacity.getExpression()); graphic.setRotation(guiRotation.getExpression()); graphic.setSize(guiSize.getExpression()); graphic.setMarks(guiMark.getEdited()); graphic.setExternalGraphics(guiExternal.getEdited()); } }
copy.setDisplacement(displacementCopy); copy.setExternalGraphics(externalGraphicsCopy); copy.setMarks(marksCopy); copy.setOpacity((Expression) opacityCopy); copy.setRotation((Expression) rotationCopy);
copy.setDisplacement(displacementCopy); copy.setExternalGraphics(externalGraphicsCopy); copy.setMarks(marksCopy); copy.setOpacity(opacityCopy); copy.setRotation(rotationCopy);
copy.setDisplacement(displacementCopy); copy.setExternalGraphics(externalGraphicsCopy); copy.setMarks(marksCopy); copy.setOpacity((Expression) opacityCopy); copy.setRotation((Expression) rotationCopy);
private org.geotools.styling.Style setupStyle(int type, Color color) { StyleFactory sf = org.geotools.factory.CommonFactoryFinder .getStyleFactory(null); StyleBuilder sb = new StyleBuilder(); org.geotools.styling.Style s = sf.createStyle(); s.setTitle("selection"); // TODO parameterise the color PolygonSymbolizer ps = sb.createPolygonSymbolizer(color); ps.setStroke(sb.createStroke(color)); LineSymbolizer ls = sb.createLineSymbolizer(color); Graphic h = sb.createGraphic(); h.setMarks(new Mark[] { sb.createMark("square", color) }); PointSymbolizer pts = sb.createPointSymbolizer(h); // Rule r = sb.createRule(new Symbolizer[]{ps,ls,pts}); switch (type) { case POLYGON: s = sb.createStyle(ps); break; case POINT: s = sb.createStyle(pts); break; case LINE: s = sb.createStyle(ls); } return s; }
private void initSymbols(){ Color editionStyleColor = Color.RED; Fill fill = STYLE_BUILDER.createFill(editionStyleColor, 1f); Stroke stroke = STYLE_BUILDER.createStroke(editionStyleColor, 1); stroke.setOpacity(STYLE_BUILDER.literalExpression(1f)); Mark mark = STYLE_BUILDER.createMark("cross", fill, stroke); Graphic gra = STYLE_BUILDER.createGraphic(); gra.setOpacity(STYLE_BUILDER.literalExpression(1f)); gra.setMarks(new Mark[]{mark}); gra.setSize(STYLE_BUILDER.literalExpression(14)); pointSymbol = STYLE_BUILDER.createPointSymbolizer(gra); fill = STYLE_BUILDER.createFill(editionStyleColor, 0.4f); stroke = STYLE_BUILDER.createStroke(editionStyleColor, 2); stroke.setOpacity(STYLE_BUILDER.literalExpression(0.6f)); polygonSymbol = STYLE_BUILDER.createPolygonSymbolizer(stroke, fill); lineSymbol = STYLE_BUILDER.createLineSymbolizer(stroke); }
Graphic gra = STYLE_BUILDER.createGraphic(); gra.setOpacity(STYLE_BUILDER.literalExpression(1f)); gra.setMarks(new Mark[]{mark}); gra.setSize(STYLE_BUILDER.literalExpression(15)); Graphic gra = STYLE_BUILDER.createGraphic(); gra.setOpacity(STYLE_BUILDER.literalExpression(1f)); gra.setMarks(new Mark[]{mark}); gra.setSize(STYLE_BUILDER.literalExpression(5)); Graphic gra = STYLE_BUILDER.createGraphic(); gra.setOpacity(STYLE_BUILDER.literalExpression(1f)); gra.setMarks(new Mark[]{mark}); gra.setSize(STYLE_BUILDER.literalExpression(5)); PointSymbolizer ps = STYLE_BUILDER.createPointSymbolizer(gra); Graphic gra = STYLE_BUILDER.createGraphic(); gra.setOpacity(STYLE_BUILDER.literalExpression(0.6f)); gra.setMarks(new Mark[]{mark}); gra.setSize(STYLE_BUILDER.literalExpression(14)); PointSymbolizer ps = STYLE_BUILDER.createPointSymbolizer(gra);