use of org.opengis.style.Graphic in project geotoolkit by Geomatys.
the class XMLUtilitiesTest method createPointSymbolizer.
private static PointSymbolizer createPointSymbolizer() {
String name = "Point symbolizer name";
Description desc = STYLE_FACTORY.description("Point symbolizer title", "Point symbolizer description");
Unit uom = Units.POINT;
String geom = "geom";
List<GraphicalSymbol> symbols = new ArrayList<GraphicalSymbol>();
symbols.add(STYLE_FACTORY.mark());
Expression opacity = FILTER_FACTORY.literal(0.7);
Expression size = FILTER_FACTORY.literal(32);
Expression rotation = FILTER_FACTORY.literal(110);
AnchorPoint anchor = STYLE_FACTORY.anchorPoint(23, 12);
Displacement disp = STYLE_FACTORY.displacement(21, 15);
Graphic graphic = STYLE_FACTORY.graphic(symbols, opacity, size, rotation, anchor, disp);
return STYLE_FACTORY.pointSymbolizer(name, geom, desc, uom, graphic);
}
use of org.opengis.style.Graphic 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.Graphic 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.Graphic 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;
}
Aggregations