use of org.opengis.style.Graphic 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;
}
use of org.opengis.style.Graphic in project geotoolkit by Geomatys.
the class SE100toGTTransformer method visit.
// Symbolizers---------------------------------------------------------------
/**
* Transform a SLD v1.0 point symbolizer in GT point symbolizer.
*/
public PointSymbolizer visit(final org.geotoolkit.sld.xml.v100.PointSymbolizer pst) {
if (pst == null)
return null;
final Graphic graphic = (pst.getGraphic() == null) ? styleFactory.graphic() : visit(pst.getGraphic());
final Unit uom = Units.POINT;
final String geom = visitGeom(pst.getGeometry());
final String name = null;
final Description desc = StyleConstants.DEFAULT_DESCRIPTION;
return styleFactory.pointSymbolizer(name, geom, desc, uom, graphic);
}
use of org.opengis.style.Graphic in project geotoolkit by Geomatys.
the class SE110toGTTransformer method visit.
/**
* Transform a SLD v1.1 graphic stroke in GT graphic stroke.
*/
public GraphicStroke visit(final GraphicStrokeType graphicStroke) {
if (graphicStroke == null || graphicStroke.getGraphic() == null) {
return null;
}
final Graphic graphic = visit(graphicStroke.getGraphic());
if (graphic != null) {
final Expression gap = visitExpression(graphicStroke.getGap());
final Expression initialGap = visitExpression(graphicStroke.getInitialGap());
return styleFactory.graphicStroke(graphic, gap, initialGap);
}
return null;
}
use of org.opengis.style.Graphic in project geotoolkit by Geomatys.
the class DefaultStyleVisitor method visit.
@Override
public Object visit(final GraphicStroke graphicStroke, Object data) {
data = visit((Graphic) graphicStroke, data);
final Expression gap = graphicStroke.getGap();
if (gap != null) {
visit(gap, data);
}
final Expression igap = graphicStroke.getInitialGap();
if (igap != null) {
visit(igap, data);
}
return data;
}
use of org.opengis.style.Graphic in project geotoolkit by Geomatys.
the class ListingPropertyVisitor method visit.
@Override
public Object visit(final GraphicStroke graphicStroke, Object data) {
data = visit((Graphic) graphicStroke, data);
final Expression gap = graphicStroke.getGap();
if (gap != null) {
visit(gap, (Collection<String>) data);
}
final Expression igap = graphicStroke.getInitialGap();
if (igap != null) {
visit(igap, (Collection<String>) data);
}
return data;
}
Aggregations