Search in sources :

Example 16 with AnchorPoint

use of org.geotools.styling.AnchorPoint in project sldeditor by robward-scisys.

the class PointFillDetails method populate.

/**
 * Populate.
 *
 * @param selectedSymbol the selected symbol
 */
/*
     * (non-Javadoc)
     * 
     * @see com.sldeditor.ui.iface.PopulateDetailsInterface#populate(com.sldeditor.ui.detail.SelectedSymbol)
     */
@Override
public void populate(SelectedSymbol selectedSymbol) {
    Expression expSize = null;
    Expression expRotation = null;
    Expression expAnchorPointX = null;
    Expression expAnchorPointY = null;
    Expression expDisplacementX = null;
    Expression expDisplacementY = null;
    Expression expGap = null;
    Expression expInitialGap = null;
    PointSymbolizer pointSymbolizer = null;
    if (selectedSymbol != null) {
        Symbolizer symbolizer = selectedSymbol.getSymbolizer();
        if (symbolizer instanceof PointSymbolizerImpl) {
            pointSymbolizer = (PointSymbolizer) symbolizer;
            Graphic graphic = pointSymbolizer.getGraphic();
            if (graphic != null) {
                expSize = graphic.getSize();
                expRotation = graphic.getRotation();
                // Anchor point
                AnchorPoint anchorPoint = graphic.getAnchorPoint();
                if (anchorPoint != null) {
                    expAnchorPointX = anchorPoint.getAnchorPointX();
                    expAnchorPointY = anchorPoint.getAnchorPointY();
                } else {
                    expAnchorPointX = AnchorPoint.DEFAULT.getAnchorPointX();
                    expAnchorPointY = AnchorPoint.DEFAULT.getAnchorPointY();
                }
                // Offset
                Displacement displacement = graphic.getDisplacement();
                if (displacement != null) {
                    expDisplacementX = displacement.getDisplacementX();
                    expDisplacementY = displacement.getDisplacementY();
                } else {
                    expDisplacementX = Displacement.DEFAULT.getDisplacementX();
                    expDisplacementY = Displacement.DEFAULT.getDisplacementY();
                }
                expGap = graphic.getGap();
                expInitialGap = graphic.getInitialGap();
                List<GraphicalSymbol> graphicalSymbolList = graphic.graphicalSymbols();
                if (!graphicalSymbolList.isEmpty()) {
                    GraphicalSymbol symbol = graphicalSymbolList.get(0);
                    symbolTypeFactory.setValue(PointSymbolizer.class, this.fieldConfigManager, graphic, symbol);
                }
            }
        }
    }
    fieldConfigVisitor.populateField(FieldIdEnum.SIZE, expSize);
    fieldConfigVisitor.populateField(FieldIdEnum.ANGLE, expRotation);
    fieldConfigVisitor.populateField(FieldIdEnum.ANCHOR_POINT_H, expAnchorPointX);
    fieldConfigVisitor.populateField(FieldIdEnum.ANCHOR_POINT_V, expAnchorPointY);
    fieldConfigVisitor.populateField(FieldIdEnum.DISPLACEMENT_X, expDisplacementX);
    fieldConfigVisitor.populateField(FieldIdEnum.DISPLACEMENT_Y, expDisplacementY);
    fieldConfigVisitor.populateField(FieldIdEnum.GAP, expGap);
    fieldConfigVisitor.populateField(FieldIdEnum.INITIAL_GAP, expInitialGap);
    if (vendorOptionFillFactory != null) {
        vendorOptionFillFactory.populate(pointSymbolizer);
    }
    updateSymbol();
}
Also used : PointSymbolizer(org.geotools.styling.PointSymbolizer) AnchorPoint(org.geotools.styling.AnchorPoint) Expression(org.opengis.filter.expression.Expression) Graphic(org.geotools.styling.Graphic) GraphicalSymbol(org.opengis.style.GraphicalSymbol) PointSymbolizer(org.geotools.styling.PointSymbolizer) Symbolizer(org.opengis.style.Symbolizer) PointSymbolizerImpl(org.geotools.styling.PointSymbolizerImpl) Displacement(org.geotools.styling.Displacement)

Aggregations

AnchorPoint (org.geotools.styling.AnchorPoint)16 Expression (org.opengis.filter.expression.Expression)15 Displacement (org.geotools.styling.Displacement)12 GraphicalSymbol (org.opengis.style.GraphicalSymbol)11 Graphic (org.geotools.styling.Graphic)8 Fill (org.geotools.styling.Fill)7 GroupConfigInterface (com.sldeditor.ui.detail.config.base.GroupConfigInterface)6 ArrayList (java.util.ArrayList)4 Font (org.geotools.styling.Font)4 PointSymbolizer (org.geotools.styling.PointSymbolizer)4 Stroke (org.geotools.styling.Stroke)4 GraphicFill (org.opengis.style.GraphicFill)4 JsonObject (com.google.gson.JsonObject)3 Halo (org.geotools.styling.Halo)3 MarkImpl (org.geotools.styling.MarkImpl)3 TextSymbolizer (org.geotools.styling.TextSymbolizer)3 JsonElement (com.google.gson.JsonElement)2 FieldConfigColour (com.sldeditor.ui.detail.config.FieldConfigColour)2 MultiOptionGroup (com.sldeditor.ui.detail.config.base.MultiOptionGroup)2 ConstantExpression (org.geotools.filter.ConstantExpression)2