use of org.opengis.style.AnchorPoint in project geotoolkit by Geomatys.
the class Styles method graphicFillPolygon.
public static MutableStyle graphicFillPolygon() {
// general informations
final String name = "mySymbol";
final Description desc = DEFAULT_DESCRIPTION;
// use the default geometry of the feature
final String geometry = null;
final Unit unit = Units.POINT;
final Displacement disp = DEFAULT_DISPLACEMENT;
final Expression offset = LITERAL_ZERO_FLOAT;
// stroke element
final Expression color = SF.literal(Color.BLUE);
final Expression width = FF.literal(2);
final Expression opacity = LITERAL_ONE_FLOAT;
final Stroke stroke = SF.stroke(color, width, opacity);
// fill element
// a pattern that will be repeated like a mosaic
final Expression size = FF.literal(12);
final Expression rotation = LITERAL_ONE_FLOAT;
final AnchorPoint anchor = DEFAULT_ANCHOR_POINT;
final List<GraphicalSymbol> symbols = new ArrayList<GraphicalSymbol>();
final Stroke fillStroke = SF.stroke(Color.BLACK, 2);
final Fill pattern = SF.fill(Color.BLUE);
final Mark mark = SF.mark(MARK_CROSS, pattern, fillStroke);
symbols.add(mark);
final GraphicFill graphicfill = SF.graphicFill(symbols, opacity, size, rotation, anchor, disp);
final Fill fill = SF.fill(graphicfill, color, opacity);
final PolygonSymbolizer symbolizer = SF.polygonSymbolizer(name, geometry, desc, unit, stroke, fill, disp, offset);
final MutableStyle style = SF.style(symbolizer);
return style;
}
use of org.opengis.style.AnchorPoint in project geotoolkit by Geomatys.
the class Styles method graphicStrokeLine.
public static MutableStyle graphicStrokeLine() throws URISyntaxException {
// general informations
final String name = "mySymbol";
final Description desc = DEFAULT_DESCRIPTION;
// use the default geometry of the feature
final String geometry = null;
final Unit unit = Units.POINT;
final Expression offset = LITERAL_ONE_FLOAT;
// the stroke fill
// a pattern that will be repeated like a mosaic
final Expression size = FF.literal(12);
final Expression opacity = LITERAL_ONE_FLOAT;
final Expression rotation = LITERAL_ONE_FLOAT;
final AnchorPoint anchor = DEFAULT_ANCHOR_POINT;
final Displacement disp = DEFAULT_DISPLACEMENT;
final List<GraphicalSymbol> symbols = new ArrayList<GraphicalSymbol>();
final GraphicalSymbol external = SF.externalGraphic(SF.onlineResource(Styles.class.getResource("/data/fish.png").toURI()), "image/png", null);
symbols.add(external);
final Graphic graphic = SF.graphic(symbols, opacity, size, rotation, anchor, disp);
final Expression initialGap = LITERAL_ZERO_FLOAT;
final Expression strokeGap = FF.literal(10);
final GraphicStroke graphicStroke = SF.graphicStroke(graphic, strokeGap, initialGap);
// the visual element
final Expression color = SF.literal(Color.BLUE);
final Expression width = FF.literal(4);
final Expression linecap = STROKE_CAP_ROUND;
final Expression linejoin = STROKE_JOIN_BEVEL;
final float[] dashes = new float[] { 8, 4, 2, 2, 2, 2, 2, 4 };
final Expression dashOffset = LITERAL_ZERO_FLOAT;
final Stroke stroke = SF.stroke(graphicStroke, color, opacity, width, linejoin, linecap, dashes, dashOffset);
final LineSymbolizer symbolizer = SF.lineSymbolizer(name, geometry, desc, unit, stroke, offset);
final MutableStyle style = SF.style(symbolizer);
return style;
}
use of org.opengis.style.AnchorPoint in project geotoolkit by Geomatys.
the class Styles method ttfPoint.
public static MutableStyle ttfPoint() throws URISyntaxException {
// general informations
final String name = "mySymbol";
final Description desc = DEFAULT_DESCRIPTION;
// use the default geometry of the feature
final String geometry = null;
final Unit unit = Units.POINT;
// the visual element
final Expression size = FF.literal(32);
final Expression opacity = LITERAL_ONE_FLOAT;
final Expression rotation = LITERAL_ONE_FLOAT;
final AnchorPoint anchor = DEFAULT_ANCHOR_POINT;
final Displacement disp = DEFAULT_DISPLACEMENT;
final List<GraphicalSymbol> symbols = new ArrayList<GraphicalSymbol>();
final Stroke stroke = SF.stroke(Color.BLACK, 1);
final Fill fill = SF.fill(Color.RED);
final ExternalMark external = SF.externalMark(SF.onlineResource(IconBuilder.FONTAWESOME.toURI()), "ttf", FontAwesomeIcons.ICON_DICE.codePointAt(0));
final Mark mark = SF.mark(external, fill, stroke);
symbols.add(mark);
final Graphic graphic = SF.graphic(symbols, opacity, size, rotation, anchor, disp);
final PointSymbolizer symbolizer = SF.pointSymbolizer(name, geometry, desc, unit, graphic);
final MutableStyle style = SF.style(symbolizer);
return style;
}
use of org.opengis.style.AnchorPoint in project geotoolkit by Geomatys.
the class Styles method markPoint.
public static MutableStyle markPoint() {
// general informations
final String name = "mySymbol";
final Description desc = DEFAULT_DESCRIPTION;
// use the default geometry of the feature
final String geometry = null;
final Unit unit = Units.POINT;
// the visual element
final Expression size = FF.literal(12);
final Expression opacity = LITERAL_ONE_FLOAT;
final Expression rotation = LITERAL_ONE_FLOAT;
final AnchorPoint anchor = DEFAULT_ANCHOR_POINT;
final Displacement disp = DEFAULT_DISPLACEMENT;
final List<GraphicalSymbol> symbols = new ArrayList<GraphicalSymbol>();
final Stroke stroke = SF.stroke(Color.BLACK, 2);
final Fill fill = SF.fill(Color.RED);
final Mark mark = SF.mark(MARK_CIRCLE, fill, stroke);
symbols.add(mark);
final Graphic graphic = SF.graphic(symbols, opacity, size, rotation, anchor, disp);
final PointSymbolizer symbolizer = SF.pointSymbolizer(name, geometry, desc, unit, graphic);
final MutableStyle style = SF.style(symbolizer);
return style;
}
use of org.opengis.style.AnchorPoint in project geotoolkit by Geomatys.
the class DefaultStyleVisitor method visit.
@Override
public Object visit(final Graphic graphic, Object data) {
final AnchorPoint ac = graphic.getAnchorPoint();
if (ac != null) {
data = ac.accept(this, data);
}
final Displacement disp = graphic.getDisplacement();
if (disp != null) {
data = disp.accept(this, data);
}
final Expression opa = graphic.getOpacity();
if (opa != null) {
visit(opa, data);
}
final Expression rot = graphic.getRotation();
if (rot != null) {
visit(rot, data);
}
final Expression size = graphic.getSize();
if (size != null) {
visit(size, data);
}
final List<GraphicalSymbol> symbols = graphic.graphicalSymbols();
if (symbols != null) {
for (GraphicalSymbol gs : symbols) {
if (gs instanceof Mark) {
data = ((Mark) gs).accept(this, data);
} else if (gs instanceof ExternalGraphic) {
data = ((ExternalGraphic) gs).accept(this, data);
}
}
}
return data;
}
Aggregations