Search in sources :

Example 1 with PointSymbolizerImpl

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

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

the class PolygonFillDetails 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 expFillColour = null;
    Expression expGap = null;
    Expression expInitialGap = null;
    Fill fill = null;
    Expression expOpacity = null;
    symbolizer = null;
    if (selectedSymbol != null) {
        symbolizer = selectedSymbol.getSymbolizer();
        Graphic graphic = null;
        if (symbolizer instanceof PointSymbolizerImpl) {
            PointSymbolizer pointSymbolizer = (PointSymbolizer) symbolizer;
            graphic = pointSymbolizer.getGraphic();
            if (graphic != null) {
                List<GraphicalSymbol> graphicSymbolList = graphic.graphicalSymbols();
                if (!graphicSymbolList.isEmpty()) {
                    GraphicalSymbol graphicalSymbol = graphicSymbolList.get(0);
                    if (graphicalSymbol instanceof MarkImpl) {
                        MarkImpl mark = (MarkImpl) graphicalSymbol;
                        fill = mark.getFill();
                        if (fill != null) {
                            expOpacity = fill.getOpacity();
                        }
                    }
                }
            }
        } else if (symbolizer instanceof PolygonSymbolizerImpl) {
            PolygonSymbolizer polygonSymbolizer = (PolygonSymbolizer) symbolizer;
            if (polygonSymbolizer != null) {
                fill = polygonSymbolizer.getFill();
                if (fill != null) {
                    expOpacity = fill.getOpacity();
                    graphic = fill.getGraphicFill();
                }
            }
        }
        if (graphic == null) {
            if (fill != null) {
                expFillColour = fill.getColor();
            }
            if (fill == null) {
                symbolTypeFactory.setNoFill(this.fieldConfigManager);
            } else {
                symbolTypeFactory.setSolidFill(this.fieldConfigManager, expFillColour, expOpacity);
            }
        } else {
            expSize = graphic.getSize();
            expRotation = graphic.getRotation();
            // Anchor point
            AnchorPoint anchorPoint = graphic.getAnchorPoint();
            if (anchorPoint != null) {
                expAnchorPointX = anchorPoint.getAnchorPointX();
                expAnchorPointY = anchorPoint.getAnchorPointY();
            } else {
                expAnchorPointX = defaultAnchorPoint.getAnchorPointX();
                expAnchorPointY = defaultAnchorPoint.getAnchorPointY();
            }
            // Offset
            Displacement displacement = graphic.getDisplacement();
            if (displacement != null) {
                expDisplacementX = displacement.getDisplacementX();
                expDisplacementY = displacement.getDisplacementY();
            } else {
                expDisplacementX = defaultDisplacement.getDisplacementX();
                expDisplacementY = defaultDisplacement.getDisplacementY();
            }
            expGap = graphic.getGap();
            expInitialGap = graphic.getInitialGap();
            List<GraphicalSymbol> graphicalSymbolList = graphic.graphicalSymbols();
            if (!graphicalSymbolList.isEmpty()) {
                GraphicalSymbol symbol = graphicalSymbolList.get(0);
                symbolTypeFactory.setValue(PolygonSymbolizer.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);
    fieldConfigVisitor.populateField(FieldIdEnum.OVERALL_OPACITY, expOpacity);
    if (vendorOptionFillFactory != null) {
        if (symbolizer instanceof PolygonSymbolizer) {
            vendorOptionFillFactory.populate((PolygonSymbolizer) symbolizer);
        }
    }
    updateSymbol();
}
Also used : PolygonSymbolizerImpl(org.geotools.styling.PolygonSymbolizerImpl) PointSymbolizer(org.geotools.styling.PointSymbolizer) Fill(org.geotools.styling.Fill) GraphicFill(org.opengis.style.GraphicFill) AnchorPoint(org.geotools.styling.AnchorPoint) Expression(org.opengis.filter.expression.Expression) PolygonSymbolizer(org.geotools.styling.PolygonSymbolizer) Graphic(org.geotools.styling.Graphic) GraphicalSymbol(org.opengis.style.GraphicalSymbol) MarkImpl(org.geotools.styling.MarkImpl) PointSymbolizerImpl(org.geotools.styling.PointSymbolizerImpl) Displacement(org.geotools.styling.Displacement)

Example 3 with PointSymbolizerImpl

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

the class SelectedSymbolTest method getGraphic.

/**
 * Gets the graphic.
 *
 * @param symbolizer the symbolizer
 * @return the graphic
 */
private Graphic getGraphic(Symbolizer symbolizer) {
    Graphic graphic = null;
    if (symbolizer instanceof PointSymbolizerImpl) {
        PointSymbolizer pointSymbolizer = (PointSymbolizer) symbolizer;
        graphic = pointSymbolizer.getGraphic();
    } else if (symbolizer instanceof PolygonSymbolizerImpl) {
        PolygonSymbolizer polygonSymbolizer = (PolygonSymbolizer) symbolizer;
        if (polygonSymbolizer != null) {
            Fill fill = polygonSymbolizer.getFill();
            if (fill != null) {
                graphic = fill.getGraphicFill();
            }
        }
    }
    return graphic;
}
Also used : PolygonSymbolizerImpl(org.geotools.styling.PolygonSymbolizerImpl) PointSymbolizer(org.geotools.styling.PointSymbolizer) Fill(org.geotools.styling.Fill) PolygonSymbolizer(org.geotools.styling.PolygonSymbolizer) Graphic(org.geotools.styling.Graphic) PointSymbolizerImpl(org.geotools.styling.PointSymbolizerImpl)

Example 4 with PointSymbolizerImpl

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

the class SymbolizerDetailsPanel method getMinimumVersion.

/**
 * Gets the minimum version vendor option present in the SLD.
 *
 * @param parentObj the parent obj
 * @param sldObj the sld obj
 * @param vendorOptionsPresentList the vendor options present list
 */
public void getMinimumVersion(Object parentObj, Object sldObj, List<VendorOptionPresent> vendorOptionsPresentList) {
    Class<?> parentClass = null;
    Class<?> classSelected = sldObj.getClass();
    if (sldObj instanceof StyledLayerDescriptor) {
    // No parent
    } else if (sldObj instanceof StyledLayer) {
        parentClass = StyledLayerDescriptor.class;
    } else if (sldObj instanceof Style) {
        parentClass = StyledLayer.class;
    } else if (sldObj instanceof FeatureTypeStyle) {
        parentClass = Style.class;
    } else if (sldObj instanceof Rule) {
        parentClass = FeatureTypeStyle.class;
    } else if (sldObj instanceof Symbolizer) {
        parentClass = Rule.class;
    }
    internal_getMinimumVersion(parentObj, sldObj, vendorOptionsPresentList, parentClass, classSelected);
    if (sldObj instanceof PointSymbolizerImpl) {
        PointSymbolizerImpl pointSymbolizer = (PointSymbolizerImpl) sldObj;
        parentClass = PointSymbolizerImpl.class;
        classSelected = FillImpl.class;
        internal_getMinimumVersion(pointSymbolizer, pointSymbolizer.getGraphic(), vendorOptionsPresentList, parentClass, classSelected);
    } else if (sldObj instanceof LineSymbolizerImpl) {
        LineSymbolizerImpl lineSymbolizer = (LineSymbolizerImpl) sldObj;
        parentClass = LineSymbolizerImpl.class;
        classSelected = StrokeImpl.class;
        internal_getMinimumVersion(lineSymbolizer, lineSymbolizer.getStroke(), vendorOptionsPresentList, parentClass, classSelected);
    } else if (sldObj instanceof PolygonSymbolizerImpl) {
        PolygonSymbolizerImpl polygonSymbolizer = (PolygonSymbolizerImpl) sldObj;
        parentClass = PolygonSymbolizerImpl.class;
        classSelected = FillImpl.class;
        internal_getMinimumVersion(polygonSymbolizer, polygonSymbolizer.getFill(), vendorOptionsPresentList, parentClass, classSelected);
        classSelected = StrokeImpl.class;
        internal_getMinimumVersion(polygonSymbolizer, polygonSymbolizer.getStroke(), vendorOptionsPresentList, parentClass, classSelected);
    } else if (sldObj instanceof TextSymbolizerImpl) {
        TextSymbolizerImpl textSymbolizer = (TextSymbolizerImpl) sldObj;
        parentClass = Rule.class;
        classSelected = TextSymbolizerImpl.class;
        internal_getMinimumVersion(parentObj, textSymbolizer, vendorOptionsPresentList, parentClass, classSelected);
    } else if (sldObj instanceof RasterSymbolizerImpl) {
        RasterSymbolizerImpl rasterSymbolizer = (RasterSymbolizerImpl) sldObj;
        parentClass = Rule.class;
        classSelected = RasterSymbolizerImpl.class;
        internal_getMinimumVersion(parentObj, rasterSymbolizer, vendorOptionsPresentList, parentClass, classSelected);
    }
}
Also used : TextSymbolizerImpl(org.geotools.styling.TextSymbolizerImpl) StyledLayer(org.geotools.styling.StyledLayer) LineSymbolizerImpl(org.geotools.styling.LineSymbolizerImpl) StrokeImpl(org.geotools.styling.StrokeImpl) Symbolizer(org.geotools.styling.Symbolizer) RasterSymbolizerImpl(org.geotools.styling.RasterSymbolizerImpl) PolygonSymbolizerImpl(org.geotools.styling.PolygonSymbolizerImpl) StyledLayerDescriptor(org.geotools.styling.StyledLayerDescriptor) Style(org.geotools.styling.Style) FeatureTypeStyle(org.geotools.styling.FeatureTypeStyle) FeatureTypeStyle(org.geotools.styling.FeatureTypeStyle) Rule(org.geotools.styling.Rule) PointSymbolizerImpl(org.geotools.styling.PointSymbolizerImpl)

Example 5 with PointSymbolizerImpl

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

the class WindBarbDetails method getWellKnownName.

/**
 * Gets the well known name.
 *
 * @param symbolizer the symbolizer
 * @return the well known name
 */
private Expression getWellKnownName(Symbolizer symbolizer) {
    Expression wellKnownName = null;
    if (symbolizer instanceof PointSymbolizerImpl) {
        PointSymbolizerImpl point = (PointSymbolizerImpl) symbolizer;
        List<GraphicalSymbol> graphicalSymbolList = point.getGraphic().graphicalSymbols();
        if ((graphicalSymbolList != null) && !graphicalSymbolList.isEmpty()) {
            GraphicalSymbol graphicalSymbol = graphicalSymbolList.get(0);
            if (graphicalSymbol instanceof MarkImpl) {
                MarkImpl mark = (MarkImpl) graphicalSymbol;
                wellKnownName = mark.getWellKnownName();
            }
        }
    }
    return wellKnownName;
}
Also used : ConstantExpression(org.geotools.filter.ConstantExpression) Expression(org.opengis.filter.expression.Expression) GraphicalSymbol(org.opengis.style.GraphicalSymbol) MarkImpl(org.geotools.styling.MarkImpl) PointSymbolizerImpl(org.geotools.styling.PointSymbolizerImpl)

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