Search in sources :

Example 31 with FieldConfigBase

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

the class GroupConfig method setGroupStateOverride.

/*
     * (non-Javadoc)
     * 
     * @see com.sldeditor.ui.detail.config.base.GroupConfigInterface#setGroupStateOverride(boolean)
     */
@Override
public void setGroupStateOverride(boolean enabled) {
    groupEnabled = enabled;
    for (FieldConfigBase field : getFieldConfigList()) {
        CurrentFieldState fieldState = field.getFieldState();
        fieldState.setGroupEnabled(groupEnabled);
        fieldState.setFieldEnabled(groupEnabled);
        field.setFieldState(fieldState);
    }
    setValueGroupState();
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase)

Example 32 with FieldConfigBase

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

the class MultiOptionGroup method removeOptionFields.

/**
 * Removes the option fields from the previous selection.
 *
 * @param box the box
 * @param fieldConfigManager the field config manager
 */
private void removeOptionFields(Box box, GraphicPanelFieldManager fieldConfigManager) {
    if (optionPanel != null) {
        box.remove(optionPanel);
        for (FieldConfigBase field : optionFieldList) {
            fieldConfigManager.removeField(field);
        }
        optionFieldList.clear();
        optionPanel = null;
        box.revalidate();
    }
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase)

Example 33 with FieldConfigBase

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

the class StrokeDetails method setSymbolTypeVisibility.

/**
 * Sets the symbol type visibility.
 *
 * @param panelId the panel id
 * @param selectedItem the selected item
 */
private void setSymbolTypeVisibility(Class<?> panelId, String selectedItem) {
    Map<GroupIdEnum, Boolean> groupList = fieldEnableState.getGroupIdList(panelId.getName(), selectedItem);
    for (GroupIdEnum groupId : groupList.keySet()) {
        boolean groupEnabled = groupList.get(groupId);
        GroupConfigInterface groupConfig = fieldConfigManager.getGroup(this.getClass(), groupId);
        if (groupConfig != null) {
            groupConfig.setGroupStateOverride(groupEnabled);
        } else {
            ConsoleManager.getInstance().error(this, "Failed to find group : " + groupId.toString());
        }
    }
    Map<FieldIdEnum, Boolean> fieldList = fieldEnableState.getFieldIdList(panelId.getName(), selectedItem);
    for (FieldIdEnum fieldId : fieldList.keySet()) {
        boolean fieldEnabled = fieldList.get(fieldId);
        FieldConfigBase fieldConfig = fieldConfigManager.get(fieldId);
        if (fieldConfig != null) {
            CurrentFieldState fieldState = fieldConfig.getFieldState();
            fieldState.setFieldEnabled(fieldEnabled);
            fieldConfig.setFieldState(fieldState);
        } else {
            ConsoleManager.getInstance().error(this, "Failed to find field : " + fieldId.toString());
        }
    }
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) CurrentFieldState(com.sldeditor.ui.detail.config.base.CurrentFieldState) GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) GroupIdEnum(com.sldeditor.common.xml.ui.GroupIdEnum)

Example 34 with FieldConfigBase

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

the class FieldConfigWindBarbs method windBarbValueUpdated.

/**
 * Wind barb value updated.
 */
@Override
public void windBarbValueUpdated() {
    setCachedExpression(generateExpression());
    FieldConfigBase parent = getParent();
    if (parent != null) {
        parent.valueUpdated();
    }
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase)

Example 35 with FieldConfigBase

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

the class FieldConfigWKT method getValue.

/**
 * Gets the value.
 *
 * @param fieldConfigManager the field config manager
 * @param symbolType the symbol type
 * @param fillEnabled the fill enabled
 * @param strokeEnabled the stroke enabled
 * @return the value
 */
@Override
public List<GraphicalSymbol> getValue(GraphicPanelFieldManager fieldConfigManager, Expression symbolType, boolean fillEnabled, boolean strokeEnabled) {
    List<GraphicalSymbol> symbolList = new ArrayList<GraphicalSymbol>();
    if (fieldConfigManager != null) {
        Expression wellKnownName = null;
        if (getConfigField() != null) {
            wellKnownName = getConfigField().getExpression();
            if (wellKnownName != null) {
                Stroke stroke = null;
                Fill fill = null;
                // Stroke colour
                FieldConfigBase field = null;
                if (strokeEnabled) {
                    Expression expStrokeColour = null;
                    Expression expStrokeColourOpacity = null;
                    field = fieldConfigManager.get(this.strokeFieldConfig.getColour());
                    if (field != null) {
                        if (field instanceof FieldConfigColour) {
                            FieldConfigColour colourField = (FieldConfigColour) field;
                            expStrokeColour = colourField.getColourExpression();
                        }
                    }
                    // Stroke width
                    Expression strokeWidth = null;
                    field = fieldConfigManager.get(this.strokeFieldConfig.getWidth());
                    if (field != null) {
                        strokeWidth = field.getExpression();
                    }
                    // Opacity
                    field = fieldConfigManager.get(this.strokeFieldConfig.getOpacity());
                    if (field != null) {
                        expStrokeColourOpacity = field.getExpression();
                    }
                    stroke = getStyleFactory().createStroke(expStrokeColour, strokeWidth, expStrokeColourOpacity);
                }
                // Fill colour
                if (fillEnabled) {
                    Expression expFillColour = null;
                    Expression expFillColourOpacity = null;
                    field = fieldConfigManager.get(this.fillFieldConfig.getColour());
                    if (field != null) {
                        if (field instanceof FieldConfigColour) {
                            FieldConfigColour colourField = (FieldConfigColour) field;
                            expFillColour = colourField.getColourExpression();
                        }
                    }
                    // Opacity
                    field = fieldConfigManager.get(this.fillFieldConfig.getOpacity());
                    if (field != null) {
                        expFillColourOpacity = field.getExpression();
                    }
                    fill = getStyleFactory().createFill(expFillColour, expFillColourOpacity);
                }
                Expression symbolSize = null;
                field = fieldConfigManager.get(FieldIdEnum.STROKE_SYMBOL_SIZE);
                if (field != null) {
                    symbolSize = field.getExpression();
                }
                Expression rotation = null;
                Mark mark = getStyleFactory().createMark(wellKnownName, stroke, fill, symbolSize, rotation);
                symbolList.add(mark);
            }
        }
    }
    return symbolList;
}
Also used : Stroke(org.geotools.styling.Stroke) Fill(org.geotools.styling.Fill) GraphicFill(org.opengis.style.GraphicFill) FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) Expression(org.opengis.filter.expression.Expression) GraphicalSymbol(org.opengis.style.GraphicalSymbol) ArrayList(java.util.ArrayList) Mark(org.geotools.styling.Mark) FieldConfigColour(com.sldeditor.ui.detail.config.FieldConfigColour)

Aggregations

FieldConfigBase (com.sldeditor.ui.detail.config.FieldConfigBase)93 FieldConfigCommonData (com.sldeditor.ui.detail.config.FieldConfigCommonData)43 Test (org.junit.Test)42 FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)27 FieldConfigColour (com.sldeditor.ui.detail.config.FieldConfigColour)22 Expression (org.opengis.filter.expression.Expression)19 Mark (org.geotools.styling.Mark)14 GraphicPanelFieldManager (com.sldeditor.ui.detail.GraphicPanelFieldManager)13 FieldConfigSlider (com.sldeditor.ui.detail.config.FieldConfigSlider)13 FieldConfigSymbolType (com.sldeditor.ui.detail.config.FieldConfigSymbolType)13 GroupConfigInterface (com.sldeditor.ui.detail.config.base.GroupConfigInterface)13 PointFillDetails (com.sldeditor.ui.detail.PointFillDetails)12 ColourFieldConfig (com.sldeditor.ui.detail.ColourFieldConfig)10 ArrayList (java.util.ArrayList)10 Fill (org.geotools.styling.Fill)10 GraphicFill (org.opengis.style.GraphicFill)10 GraphicalSymbol (org.opengis.style.GraphicalSymbol)10 Geometry (com.vividsolutions.jts.geom.Geometry)9 StyleBuilder (org.geotools.styling.StyleBuilder)8 FieldConfigMarker (com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker)7