Search in sources :

Example 1 with Symbolizer

use of org.opengis.style.Symbolizer in project sldeditor by robward-scisys.

the class PointFillDetails method updateSymbol.

/**
 * Update symbol.
 */
private void updateSymbol() {
    if (!Controller.getInstance().isPopulating()) {
        Symbolizer symbolizer = SelectedSymbol.getInstance().getSymbolizer();
        if (symbolizer instanceof PointSymbolizer) {
            PointSymbolizerImpl newPointSymbolizer = (PointSymbolizerImpl) symbolizer;
            Graphic graphic = getGraphic();
            newPointSymbolizer.setGraphic(graphic);
        }
        this.fireUpdateSymbol();
    }
}
Also used : PointSymbolizer(org.geotools.styling.PointSymbolizer) Graphic(org.geotools.styling.Graphic) PointSymbolizer(org.geotools.styling.PointSymbolizer) Symbolizer(org.opengis.style.Symbolizer) PointSymbolizerImpl(org.geotools.styling.PointSymbolizerImpl)

Example 2 with Symbolizer

use of org.opengis.style.Symbolizer in project sldeditor by robward-scisys.

the class WindBarbDetails 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) {
    Symbolizer symbolizer = selectedSymbol.getSymbolizer();
    Expression wellKnownName = getWellKnownName(symbolizer);
    if (wellKnownName != null) {
        populateExpression(wellKnownName.toString());
    }
}
Also used : ConstantExpression(org.geotools.filter.ConstantExpression) Expression(org.opengis.filter.expression.Expression) Symbolizer(org.opengis.style.Symbolizer)

Example 3 with Symbolizer

use of org.opengis.style.Symbolizer 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

Symbolizer (org.opengis.style.Symbolizer)3 Graphic (org.geotools.styling.Graphic)2 PointSymbolizer (org.geotools.styling.PointSymbolizer)2 PointSymbolizerImpl (org.geotools.styling.PointSymbolizerImpl)2 Expression (org.opengis.filter.expression.Expression)2 ConstantExpression (org.geotools.filter.ConstantExpression)1 AnchorPoint (org.geotools.styling.AnchorPoint)1 Displacement (org.geotools.styling.Displacement)1 GraphicalSymbol (org.opengis.style.GraphicalSymbol)1