Search in sources :

Example 11 with AnchorPoint

use of org.opengis.style.AnchorPoint in project geotoolkit by Geomatys.

the class DefaultStyleVisitor 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, data);
    }
    return data;
}
Also used : AnchorPoint(org.opengis.style.AnchorPoint) Expression(org.opengis.filter.Expression) Displacement(org.opengis.style.Displacement)

Example 12 with AnchorPoint

use of org.opengis.style.AnchorPoint in project geotoolkit by Geomatys.

the class ListingPropertyVisitor 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, (Collection<String>) data);
    }
    final Expression rot = graphic.getRotation();
    if (rot != null) {
        visit(rot, (Collection<String>) data);
    }
    final Expression size = graphic.getSize();
    if (size != null) {
        visit(size, (Collection<String>) 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;
}
Also used : AnchorPoint(org.opengis.style.AnchorPoint) Expression(org.opengis.filter.Expression) GraphicalSymbol(org.opengis.style.GraphicalSymbol) Mark(org.opengis.style.Mark) ExternalMark(org.opengis.style.ExternalMark) ExternalGraphic(org.opengis.style.ExternalGraphic) Displacement(org.opengis.style.Displacement)

Example 13 with AnchorPoint

use of org.opengis.style.AnchorPoint in project geotoolkit by Geomatys.

the class SE100toGTTransformer method visit.

/**
 *  Transform a SLD v1.0 pointplacement in GT point placement.
 */
private PointPlacement visit(final org.geotoolkit.sld.xml.v100.PointPlacement pointPlacement) {
    if (pointPlacement == null)
        return null;
    final AnchorPoint anchor = visit(pointPlacement.getAnchorPoint());
    final Displacement disp = visit(pointPlacement.getDisplacement());
    final Expression rotation = visitExpression(pointPlacement.getRotation());
    return styleFactory.pointPlacement(anchor, disp, rotation);
}
Also used : AnchorPoint(org.opengis.style.AnchorPoint) Expression(org.opengis.filter.Expression) Displacement(org.opengis.style.Displacement)

Example 14 with AnchorPoint

use of org.opengis.style.AnchorPoint in project geotoolkit by Geomatys.

the class SE100toGTTransformer method visit.

/**
 * Transform a SLD v1.0 graphic in GT graphic.
 */
private Graphic visit(final org.geotoolkit.sld.xml.v100.Graphic graphic) {
    if (graphic == null)
        return null;
    final List<GraphicalSymbol> symbols = new ArrayList<GraphicalSymbol>();
    for (final Object obj : graphic.getExternalGraphicOrMark()) {
        if (obj instanceof org.geotoolkit.sld.xml.v100.Mark) {
            symbols.add(visit((org.geotoolkit.sld.xml.v100.Mark) obj));
        } else if (obj instanceof org.geotoolkit.sld.xml.v100.ExternalGraphic) {
            symbols.add(visit((org.geotoolkit.sld.xml.v100.ExternalGraphic) obj));
        }
    }
    final Expression opacity = visitExpression(graphic.getOpacity());
    final Expression size = visitExpression(graphic.getSize());
    final Expression rotation = visitExpression(graphic.getRotation());
    final AnchorPoint anchor = StyleConstants.DEFAULT_ANCHOR_POINT;
    final Displacement disp = StyleConstants.DEFAULT_DISPLACEMENT;
    return styleFactory.graphic(symbols, opacity, size, rotation, anchor, disp);
}
Also used : GraphicalSymbol(org.opengis.style.GraphicalSymbol) ArrayList(java.util.ArrayList) Mark(org.opengis.style.Mark) Displacement(org.opengis.style.Displacement) AnchorPoint(org.opengis.style.AnchorPoint) Expression(org.opengis.filter.Expression)

Example 15 with AnchorPoint

use of org.opengis.style.AnchorPoint in project geotoolkit by Geomatys.

the class SE110toGTTransformer method visit.

/**
 *  Transform a SLD v1.1 pointplacement in GT point placement.
 */
public PointPlacement visit(final PointPlacementType pointPlacement) {
    if (pointPlacement == null)
        return null;
    final AnchorPoint anchor = visit(pointPlacement.getAnchorPoint());
    final Displacement disp = visit(pointPlacement.getDisplacement());
    final Expression rotation = visitExpression(pointPlacement.getRotation());
    return styleFactory.pointPlacement(anchor, disp, rotation);
}
Also used : AnchorPoint(org.opengis.style.AnchorPoint) Expression(org.opengis.filter.Expression) Displacement(org.opengis.style.Displacement)

Aggregations

Expression (org.opengis.filter.Expression)18 AnchorPoint (org.opengis.style.AnchorPoint)18 Displacement (org.opengis.style.Displacement)18 GraphicalSymbol (org.opengis.style.GraphicalSymbol)14 ArrayList (java.util.ArrayList)12 Unit (javax.measure.Unit)10 Description (org.opengis.style.Description)10 Mark (org.opengis.style.Mark)9 Graphic (org.opengis.style.Graphic)8 MutableStyle (org.geotoolkit.style.MutableStyle)7 ExternalMark (org.opengis.style.ExternalMark)7 Stroke (org.opengis.style.Stroke)7 Fill (org.opengis.style.Fill)6 GraphicStroke (org.opengis.style.GraphicStroke)6 GraphicFill (org.opengis.style.GraphicFill)5 PointSymbolizer (org.opengis.style.PointSymbolizer)5 LineSymbolizer (org.opengis.style.LineSymbolizer)3 SimpleInternationalString (org.apache.sis.util.SimpleInternationalString)2 ExternalGraphic (org.opengis.style.ExternalGraphic)2 PolygonSymbolizer (org.opengis.style.PolygonSymbolizer)2