use of org.opengis.style.AnchorPoint in project geotoolkit by Geomatys.
the class ListingPropertyVisitor method visit.
@Override
public Object visit(final PointPlacement pointPlacement, Object data) {
final AnchorPoint ap = pointPlacement.getAnchorPoint();
if (ap != null) {
data = ap.accept(this, data);
}
final Displacement disp = pointPlacement.getDisplacement();
if (disp != null) {
data = disp.accept(this, data);
}
final Expression rot = pointPlacement.getRotation();
if (rot != null) {
visit(rot, (Collection<String>) data);
}
return data;
}
use of org.opengis.style.AnchorPoint in project geotoolkit by Geomatys.
the class Styles method graphicFillLine.
public static MutableStyle graphicFillLine() 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 Stroke fillStroke = SF.stroke(Color.BLACK, 2);
final Fill fill = SF.fill(Color.RED);
final Mark mark = SF.mark(MARK_CIRCLE, fill, fillStroke);
symbols.add(mark);
final GraphicFill graphicfill = SF.graphicFill(symbols, opacity, size, rotation, anchor, disp);
// 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(graphicfill, 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 imagePoint.
public static MutableStyle imagePoint() 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(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 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 ttfPoint2.
public static MutableStyle ttfPoint2() 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(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, 1);
final Fill fill = SF.fill(Color.RED);
final Expression external = FF.literal("ttf:Dialog?char=0x2A");
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 MapfileToSLDProcess method createPointSymbolizer.
private List<Symbolizer> createPointSymbolizer(final Feature style) {
final String symbolName = (String) style.getPropertyValue(STYLE_SYMBOL.toString());
Expression expSize = (Expression) style.getPropertyValue(STYLE_SIZE.toString());
Expression expOpacity = (Expression) style.getPropertyValue(STYLE_OPACITY.toString());
Expression expFillColor = (Expression) style.getPropertyValue(STYLE_COLOR.toString());
Expression expStrokeColor = (Expression) style.getPropertyValue(STYLE_OUTLINECOLOR.toString());
Expression expStrokeWidth = (Expression) style.getPropertyValue(STYLE_WIDTH.toString());
if (expFillColor == null) {
expFillColor = DEFAULT_FILL_COLOR;
}
if (expStrokeColor == null) {
expStrokeColor = DEFAULT_STROKE_COLOR;
}
if (expStrokeWidth == null) {
expStrokeWidth = FF.literal(0);
}
if (expOpacity == null) {
expOpacity = DEFAULT_GRAPHIC_OPACITY;
}
if (expSize == null) {
expSize = DEFAULT_GRAPHIC_SIZE;
}
final List<Symbolizer> symbolizers = new ArrayList<Symbolizer>();
final Feature symbol = getSymbol(symbolName);
if (symbol == null) {
// no symbol found for this name
return symbolizers;
}
final Stroke stroke = SF.stroke(expStrokeColor, expStrokeWidth);
final Fill fill = SF.fill(expFillColor);
final String symbolTypeName = (String) symbol.getPropertyValue(SYMBOL_TYPE.toString());
final Mark mark;
if ("ellipse".equals(symbolTypeName)) {
mark = SF.mark(MARK_CIRCLE, fill, stroke);
} else if ("hatch".equals(symbolTypeName)) {
// TODO
mark = SF.mark(MARK_SQUARE, fill, stroke);
} else if ("pixmap".equals(symbolTypeName)) {
// TODO
mark = SF.mark(MARK_SQUARE, fill, stroke);
} else if ("simple".equals(symbolTypeName)) {
// TODO
mark = SF.mark(MARK_SQUARE, fill, stroke);
} else if ("truetype".equals(symbolTypeName)) {
// TODO
mark = SF.mark(MARK_SQUARE, fill, stroke);
} else if ("vector".equals(symbolTypeName)) {
// TODO
mark = SF.mark(MARK_SQUARE, fill, stroke);
} else {
// can not build symbol
return symbolizers;
}
// general informations
final String name = "";
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 opacity = LITERAL_ONE_FLOAT;
final Expression rotation = LITERAL_ZERO_FLOAT;
final AnchorPoint anchor = DEFAULT_ANCHOR_POINT;
final Displacement disp = DEFAULT_DISPLACEMENT;
final List<GraphicalSymbol> symbols = new ArrayList<GraphicalSymbol>();
symbols.add(mark);
final Graphic graphic = SF.graphic(symbols, opacity, expSize, rotation, anchor, disp);
final PointSymbolizer symbolizer = SF.pointSymbolizer(name, geometry, desc, unit, graphic);
symbolizers.add(symbolizer);
return symbolizers;
}
Aggregations