Search in sources :

Example 1 with GraphicType

use of org.geotoolkit.se.xml.v110.GraphicType in project geotoolkit by Geomatys.

the class GTtoSE110Transformer method visit.

/**
 * transform a GT graphic in jaxb graphic
 */
@Override
public GraphicType visit(final Graphic graphic, final Object data) {
    final GraphicType gt = se_factory.createGraphicType();
    gt.setAnchorPoint(visit(graphic.getAnchorPoint(), null));
    for (final GraphicalSymbol gs : graphic.graphicalSymbols()) {
        if (gs instanceof Mark) {
            final Mark mark = (Mark) gs;
            gt.getExternalGraphicOrMark().add(visit(mark, null));
        } else if (gs instanceof ExternalMark) {
            final ExternalMark ext = (ExternalMark) gs;
            gt.getExternalGraphicOrMark().add(visit(ext, null));
        } else if (gs instanceof ExternalGraphic) {
            final ExternalGraphic ext = (ExternalGraphic) gs;
            gt.getExternalGraphicOrMark().add(visit(ext, null));
        }
    }
    gt.setDisplacement(visit(graphic.getDisplacement(), null));
    gt.setOpacity(visitExpression(graphic.getOpacity()));
    gt.setRotation(visitExpression(graphic.getRotation()));
    gt.setSize(visitExpression(graphic.getSize()));
    return gt;
}
Also used : GraphicType(org.geotoolkit.se.xml.v110.GraphicType) ExternalGraphicType(org.geotoolkit.se.xml.v110.ExternalGraphicType) LegendGraphicType(org.geotoolkit.se.xml.v110.LegendGraphicType) ExternalMark(org.opengis.style.ExternalMark) GraphicalSymbol(org.opengis.style.GraphicalSymbol) ExternalMark(org.opengis.style.ExternalMark) Mark(org.opengis.style.Mark) ExternalGraphic(org.opengis.style.ExternalGraphic)

Example 2 with GraphicType

use of org.geotoolkit.se.xml.v110.GraphicType in project geotoolkit by Geomatys.

the class SE110toGTTransformer method visit.

/**
 * Transform a SLD v1.1 graphic in GT graphic.
 */
public Graphic visit(final GraphicType graphic) {
    if (graphic == null)
        return null;
    final List<GraphicalSymbol> symbols = new ArrayList<GraphicalSymbol>();
    for (final Object obj : graphic.getExternalGraphicOrMark()) {
        if (obj instanceof MarkType) {
            symbols.add(visit((MarkType) obj));
        } else if (obj instanceof ExternalGraphicType) {
            symbols.add(visit((ExternalGraphicType) obj));
        }
    }
    final Expression opacity = visitExpression(graphic.getOpacity());
    final Expression size = visitExpression(graphic.getSize());
    final Expression rotation = visitExpression(graphic.getRotation());
    final AnchorPoint anchor = visit(graphic.getAnchorPoint());
    final Displacement disp = visit(graphic.getDisplacement());
    return styleFactory.graphic(symbols, opacity, size, rotation, anchor, disp);
}
Also used : AnchorPoint(org.opengis.style.AnchorPoint) Expression(org.opengis.filter.Expression) GraphicalSymbol(org.opengis.style.GraphicalSymbol) ExternalGraphicType(org.geotoolkit.se.xml.v110.ExternalGraphicType) ArrayList(java.util.ArrayList) MarkType(org.geotoolkit.se.xml.v110.MarkType) Displacement(org.opengis.style.Displacement)

Aggregations

ExternalGraphicType (org.geotoolkit.se.xml.v110.ExternalGraphicType)2 GraphicalSymbol (org.opengis.style.GraphicalSymbol)2 ArrayList (java.util.ArrayList)1 GraphicType (org.geotoolkit.se.xml.v110.GraphicType)1 LegendGraphicType (org.geotoolkit.se.xml.v110.LegendGraphicType)1 MarkType (org.geotoolkit.se.xml.v110.MarkType)1 Expression (org.opengis.filter.Expression)1 AnchorPoint (org.opengis.style.AnchorPoint)1 Displacement (org.opengis.style.Displacement)1 ExternalGraphic (org.opengis.style.ExternalGraphic)1 ExternalMark (org.opengis.style.ExternalMark)1 Mark (org.opengis.style.Mark)1