Search in sources :

Example 16 with GroupConfigInterface

use of com.sldeditor.ui.detail.config.base.GroupConfigInterface in project sldeditor by robward-scisys.

the class VOGeoServerTextSymbolizer2 method updateSymbol.

/**
 * Update symbol.
 *
 * @param textSymbolizer the text symbolizer
 */
/*
     * (non-Javadoc)
     * 
     * @see com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface#updateSymbol(org.geotools.styling.TextSymbolizer)
     */
@Override
public void updateSymbol(TextSymbolizer textSymbolizer) {
    GroupConfigInterface fillGroup = getGroup(GroupIdEnum.VO_TEXTSYMBOLIZER_2_FILL);
    GroupConfigInterface strokeGroup = getGroup(GroupIdEnum.VO_TEXTSYMBOLIZER_2_STROKE);
    GroupConfigInterface group = null;
    if (textSymbolizer instanceof TextSymbolizer2) {
        TextSymbolizer2 textSymbol2 = (TextSymbolizer2) textSymbolizer;
        Expression featureDescription = fieldConfigVisitor.getExpression(FieldIdEnum.VO_TEXTSYMBOLIZER_2_FEATURE_DESCRIPTION);
        if (!featureDescription.toString().isEmpty()) {
            textSymbol2.setFeatureDescription(featureDescription);
        }
        Expression snippet = fieldConfigVisitor.getExpression(FieldIdEnum.VO_TEXTSYMBOLIZER_2_SNIPPET);
        if (!snippet.toString().isEmpty()) {
            textSymbol2.setSnippet(snippet);
        }
        // Extract OtherText
        OtherText otherText = null;
        group = getGroup(GroupIdEnum.VO_TEXTSYMBOLIZER_2_OTHERTEXT);
        if (group != null) {
            if (group.isPanelEnabled()) {
                String target = fieldConfigVisitor.getText(FieldIdEnum.VO_TEXTSYMBOLIZER_2_OTHERTEXT_TARGET);
                Expression text = fieldConfigVisitor.getExpression(FieldIdEnum.VO_TEXTSYMBOLIZER_2_OTHERTEXT_TEXT);
                if (!target.isEmpty() && !text.toString().isEmpty()) {
                    otherText = new OtherTextImpl();
                    otherText.setTarget(target);
                    otherText.setText(text);
                }
            }
        }
        textSymbol2.setOtherText(otherText);
        // Graphic
        Graphic graphic = null;
        group = getGroup(GroupIdEnum.VO_TEXTSYMBOLIZER_2_GRAPHIC);
        if (group.isPanelEnabled()) {
            Expression symbolType = fieldConfigVisitor.getExpression(FieldIdEnum.VO_TEXTSYMBOLIZER_2_SYMBOL_TYPE);
            boolean hasFill = (fillGroup == null) ? false : fillGroup.isPanelEnabled();
            boolean hasStroke = (strokeGroup == null) ? false : strokeGroup.isPanelEnabled();
            Expression size = fieldConfigVisitor.getExpression(FieldIdEnum.VO_TEXTSYMBOLIZER_2_SIZE);
            Expression rotation = fieldConfigVisitor.getExpression(FieldIdEnum.VO_TEXTSYMBOLIZER_2_ANGLE);
            List<GraphicalSymbol> symbols = symbolTypeFactory.getValue(fieldConfigManager, symbolType, hasFill, hasStroke, selectedFillPanelId);
            AnchorPoint anchor = null;
            Displacement displacement = null;
            graphic = getStyleFactory().graphic(symbols, null, size, rotation, anchor, displacement);
            if (!symbols.isEmpty()) {
                boolean overallOpacity = (symbols.get(0) instanceof ExternalGraphic);
                if (overallOpacity) {
                    Expression opacity = fieldConfigVisitor.getExpression(FieldIdEnum.VO_TEXTSYMBOLIZER_2_OVERALL_OPACITY);
                    graphic.setOpacity(opacity);
                }
            }
        }
        textSymbol2.setGraphic(graphic);
    }
}
Also used : ExternalGraphic(org.geotools.styling.ExternalGraphic) Graphic(org.geotools.styling.Graphic) GraphicalSymbol(org.opengis.style.GraphicalSymbol) OtherText(org.geotools.styling.OtherText) ExternalGraphic(org.geotools.styling.ExternalGraphic) Displacement(org.geotools.styling.Displacement) OtherTextImpl(org.geotools.styling.OtherTextImpl) AnchorPoint(org.geotools.styling.AnchorPoint) TextSymbolizer2(org.geotools.styling.TextSymbolizer2) Expression(org.opengis.filter.expression.Expression) GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface)

Example 17 with GroupConfigInterface

use of com.sldeditor.ui.detail.config.base.GroupConfigInterface in project sldeditor by robward-scisys.

the class VOGeoServerFTSComposite method populate.

/*
     * (non-Javadoc)
     * 
     * @see
     * com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface#populate(org.geotools.styling.
     * FeatureTypeStyle)
     */
@Override
public void populate(FeatureTypeStyle featureTypeStyle) {
    Map<String, String> options = featureTypeStyle.getOptions();
    String compositeString = options.get(FeatureTypeStyle.COMPOSITE);
    String name = null;
    double opacity = DEFAULT_COMPOSITE_OPACITY;
    if (compositeString != null) {
        String[] components = compositeString.split(",");
        FieldConfigEnum optionData = (FieldConfigEnum) fieldConfigVisitor.getFieldConfig(FieldIdEnum.VO_FTS_COMPOSITE_OPTION);
        if (optionData.isValidOption(components[0])) {
            name = components[0];
        }
        if (components.length == 2) {
            try {
                opacity = Double.valueOf(components[1]);
            } catch (Exception e) {
            // Do nothing and revert to default
            }
        }
    }
    fieldConfigVisitor.populateComboBoxField(FieldIdEnum.VO_FTS_COMPOSITE_OPTION, name);
    fieldConfigVisitor.populateDoubleField(FieldIdEnum.VO_FTS_COMPOSITE_OPACITY, opacity);
    GroupConfigInterface groupPanel = getGroup(GroupIdEnum.VO_FTS_COMPOSITE);
    groupPanel.enable(compositeString != null);
}
Also used : FieldConfigEnum(com.sldeditor.ui.detail.config.FieldConfigEnum) GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface)

Example 18 with GroupConfigInterface

use of com.sldeditor.ui.detail.config.base.GroupConfigInterface in project sldeditor by robward-scisys.

the class VOGeoServerFTSComposite method updateSymbol.

/*
     * (non-Javadoc)
     * 
     * @see
     * com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface#updateSymbol(org.geotools.
     * styling.FeatureTypeStyle)
     */
@Override
public void updateSymbol(FeatureTypeStyle featureTypeStyle) {
    Map<String, String> options = featureTypeStyle.getOptions();
    GroupConfigInterface groupPanel = getGroup(GroupIdEnum.VO_FTS_COMPOSITE);
    if (groupPanel.isPanelEnabled()) {
        ValueComboBoxData name = fieldConfigVisitor.getComboBox(FieldIdEnum.VO_FTS_COMPOSITE_OPTION);
        double opacity = fieldConfigVisitor.getDouble(FieldIdEnum.VO_FTS_COMPOSITE_OPACITY);
        StringBuilder composite = new StringBuilder();
        composite.append(name.getKey());
        if (!(Math.abs(opacity - DEFAULT_COMPOSITE_OPACITY) < 0.0001)) {
            // Don't add to string if the opacity is set to the default
            composite.append(",");
            composite.append(opacity);
        }
        options.put(FeatureTypeStyle.COMPOSITE, composite.toString());
    } else {
        options.remove(FeatureTypeStyle.COMPOSITE);
    }
}
Also used : GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface) ValueComboBoxData(com.sldeditor.ui.widgets.ValueComboBoxData)

Example 19 with GroupConfigInterface

use of com.sldeditor.ui.detail.config.base.GroupConfigInterface in project sldeditor by robward-scisys.

the class VOGeoServerFTSRuleEvaluation method updateSymbol.

/*
     * (non-Javadoc)
     * 
     * @see
     * com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface#updateSymbol(org.geotools.
     * styling.FeatureTypeStyle)
     */
@Override
public void updateSymbol(FeatureTypeStyle featureTypeStyle) {
    Map<String, String> options = featureTypeStyle.getOptions();
    GroupConfigInterface groupPanel = getGroup(GroupIdEnum.VO_FTS_RULE_EVALUATION);
    if (groupPanel.isPanelEnabled()) {
        ValueComboBoxData value = fieldConfigVisitor.getComboBox(FieldIdEnum.VO_FTS_RULE_EVALUATION_OPTION);
        options.put(FeatureTypeStyle.KEY_EVALUATION_MODE, value.getKey());
    } else {
        options.remove(FeatureTypeStyle.KEY_EVALUATION_MODE);
    }
}
Also used : GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface) ValueComboBoxData(com.sldeditor.ui.widgets.ValueComboBoxData)

Example 20 with GroupConfigInterface

use of com.sldeditor.ui.detail.config.base.GroupConfigInterface in project sldeditor by robward-scisys.

the class VOGeoServerFTSRuleEvaluation method populate.

/*
     * (non-Javadoc)
     * 
     * @see
     * com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface#populate(org.geotools.styling.
     * FeatureTypeStyle)
     */
@Override
public void populate(FeatureTypeStyle featureTypeStyle) {
    Map<String, String> options = featureTypeStyle.getOptions();
    String compositeBaseString = options.get(FeatureTypeStyle.KEY_EVALUATION_MODE);
    String value = DEFAULT_COMPOSITE_RULE_EVALUATION;
    if ((compositeBaseString != null) && (compositeBaseString.equals(FeatureTypeStyle.VALUE_EVALUATION_MODE_ALL) || compositeBaseString.equals(FeatureTypeStyle.VALUE_EVALUATION_MODE_FIRST))) {
        value = compositeBaseString;
    }
    fieldConfigVisitor.populateComboBoxField(FieldIdEnum.VO_FTS_RULE_EVALUATION_OPTION, value);
    GroupConfigInterface groupPanel = getGroup(GroupIdEnum.VO_FTS_RULE_EVALUATION);
    groupPanel.enable(compositeBaseString != null);
}
Also used : GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface)

Aggregations

GroupConfigInterface (com.sldeditor.ui.detail.config.base.GroupConfigInterface)45 MultiOptionGroup (com.sldeditor.ui.detail.config.base.MultiOptionGroup)18 FieldConfigBase (com.sldeditor.ui.detail.config.FieldConfigBase)13 Expression (org.opengis.filter.expression.Expression)13 OptionGroup (com.sldeditor.ui.detail.config.base.OptionGroup)9 FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)8 GroupIdEnum (com.sldeditor.common.xml.ui.GroupIdEnum)8 ChannelSelection (org.geotools.styling.ChannelSelection)8 RasterSymbolizer (org.geotools.styling.RasterSymbolizer)7 Test (org.junit.Test)7 GroupConfig (com.sldeditor.ui.detail.config.base.GroupConfig)6 AnchorPoint (org.geotools.styling.AnchorPoint)6 Displacement (org.geotools.styling.Displacement)6 RasterSymbolizerDetails (com.sldeditor.ui.detail.RasterSymbolizerDetails)5 Box (javax.swing.Box)5 ContrastEnhancement (org.geotools.styling.ContrastEnhancement)5 StyleFactoryImpl (org.geotools.styling.StyleFactoryImpl)5 GraphicalSymbol (org.opengis.style.GraphicalSymbol)5 CurrentFieldState (com.sldeditor.ui.detail.config.base.CurrentFieldState)4 Graphic (org.geotools.styling.Graphic)4