Search in sources :

Example 6 with PointSymbolizerImpl

use of org.geotools.styling.PointSymbolizerImpl 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

PointSymbolizerImpl (org.geotools.styling.PointSymbolizerImpl)6 Graphic (org.geotools.styling.Graphic)4 PointSymbolizer (org.geotools.styling.PointSymbolizer)4 PolygonSymbolizerImpl (org.geotools.styling.PolygonSymbolizerImpl)3 Expression (org.opengis.filter.expression.Expression)3 GraphicalSymbol (org.opengis.style.GraphicalSymbol)3 AnchorPoint (org.geotools.styling.AnchorPoint)2 Displacement (org.geotools.styling.Displacement)2 Fill (org.geotools.styling.Fill)2 MarkImpl (org.geotools.styling.MarkImpl)2 PolygonSymbolizer (org.geotools.styling.PolygonSymbolizer)2 Symbolizer (org.opengis.style.Symbolizer)2 ConstantExpression (org.geotools.filter.ConstantExpression)1 FeatureTypeStyle (org.geotools.styling.FeatureTypeStyle)1 LineSymbolizerImpl (org.geotools.styling.LineSymbolizerImpl)1 RasterSymbolizerImpl (org.geotools.styling.RasterSymbolizerImpl)1 Rule (org.geotools.styling.Rule)1 StrokeImpl (org.geotools.styling.StrokeImpl)1 Style (org.geotools.styling.Style)1 StyledLayer (org.geotools.styling.StyledLayer)1