Search in sources :

Example 51 with FieldConfigBase

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

the class FieldConfigMarker method setValue.

/**
 * Sets the value.
 *
 * @param symbolizerType the symbolizer type
 * @param fieldConfigManager the field config manager
 * @param multiOptionPanel the multi option panel
 * @param graphic the graphic
 * @param symbol the symbol
 */
@Override
public void setValue(Class<?> symbolizerType, GraphicPanelFieldManager fieldConfigManager, FieldConfigSymbolType multiOptionPanel, Graphic graphic, GraphicalSymbol symbol) {
    if ((symbol != null) && (fieldConfigManager != null)) {
        MarkImpl markerSymbol = (MarkImpl) symbol;
        Expression wellKnownNameExpression = markerSymbol.getWellKnownName();
        if (wellKnownNameExpression instanceof LiteralExpressionImpl) {
            LiteralExpressionImpl literal = (LiteralExpressionImpl) wellKnownNameExpression;
            FieldConfigBase field = fieldConfigManager.get(symbolSelectionField);
            if (field != null) {
                field.populate(literal);
            }
            Expression expFillColour = null;
            Expression expFillOpacity = null;
            Expression expStrokeColour = null;
            Expression expStrokeOpacity = null;
            Expression expStrokeWidth = null;
            // Which opacity attribute do we use?
            if (symbol instanceof MarkImpl) {
                MarkImpl markSymbol = (MarkImpl) symbol;
                Fill fill = markSymbol.getFill();
                if (fill != null) {
                    expFillColour = fill.getColor();
                    if (!isOverallOpacity(symbolizerType)) {
                        expFillOpacity = fill.getOpacity();
                    }
                }
                Stroke stroke = markSymbol.getStroke();
                if (stroke != null) {
                    expStrokeColour = stroke.getColor();
                    if (!isOverallOpacity(symbolizerType)) {
                        expStrokeOpacity = stroke.getOpacity();
                    }
                    expStrokeWidth = stroke.getWidth();
                }
            }
            if (isOverallOpacity(symbolizerType)) {
                FieldConfigBase opacity = fieldConfigManager.get(FieldIdEnum.OVERALL_OPACITY);
                if (opacity != null) {
                    opacity.populate(graphic.getOpacity());
                }
            }
            FieldConfigBase opacity = fieldConfigManager.get(fillFieldConfig.getOpacity());
            if (opacity != null) {
                opacity.populate(expFillOpacity);
            }
            opacity = fieldConfigManager.get(strokeFieldConfig.getOpacity());
            if (opacity != null) {
                opacity.populate(expStrokeOpacity);
            }
            Class<?> panelId = getCommonData().getPanelId();
            GroupConfigInterface fillGroup = fieldConfigManager.getGroup(panelId, fillFieldConfig.getGroup());
            GroupConfigInterface strokeGroup = fieldConfigManager.getGroup(panelId, strokeFieldConfig.getGroup());
            if ((fillGroup == null) || (strokeGroup == null)) {
                return;
            }
            if (literal.toString().startsWith(GEOSERVER_MARKER_PREFIX)) {
                fillGroup.enable(expStrokeColour != null);
                FieldConfigBase fillColour = fieldConfigManager.get(fillFieldConfig.getColour());
                if (fillColour != null) {
                    fillColour.populate(expStrokeColour);
                }
                opacity = fieldConfigManager.get(fillFieldConfig.getOpacity());
                if (opacity != null) {
                    opacity.populate(expStrokeOpacity);
                }
                strokeGroup.enable(false);
            } else {
                fillGroup.enable(expFillColour != null);
                FieldConfigBase fillColour = fieldConfigManager.get(fillFieldConfig.getColour());
                if (fillColour != null) {
                    fillColour.populate(expFillColour);
                }
                strokeGroup.enable(expStrokeColour != null);
                FieldConfigBase strokeColour = fieldConfigManager.get(strokeFieldConfig.getColour());
                if (strokeColour != null) {
                    strokeColour.populate(expStrokeColour);
                }
                FieldConfigBase strokeWidth = fieldConfigManager.get(FieldIdEnum.STROKE_FILL_WIDTH);
                if (strokeWidth != null) {
                    strokeWidth.populate(expStrokeWidth);
                }
            }
        }
    }
}
Also used : Fill(org.geotools.styling.Fill) GraphicFill(org.opengis.style.GraphicFill) Stroke(org.geotools.styling.Stroke) FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) Expression(org.opengis.filter.expression.Expression) LiteralExpressionImpl(org.geotools.filter.LiteralExpressionImpl) MarkImpl(org.geotools.styling.MarkImpl) GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface)

Example 52 with FieldConfigBase

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

the class SymbolTypeFactory method setSolidFill.

/**
 * Sets the solid fill.
 *
 * @param fieldConfigManager the field config manager
 * @param expFillColour the exp fill colour
 * @param expFillColourOpacity the exp fill colour opacity
 */
public void setSolidFill(GraphicPanelFieldManager fieldConfigManager, Expression expFillColour, Expression expFillColourOpacity) {
    if (symbolTypeField != null) {
        FieldConfigBase field = fieldConfigManager.get(this.selectionComboBox);
        Literal expression = ff.literal(SOLID_FILL_VALUE);
        field.populate(expression);
        markerField.setSolidFill(fieldConfigManager, expFillColour, expFillColourOpacity);
    }
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) Literal(org.opengis.filter.expression.Literal)

Example 53 with FieldConfigBase

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

the class FieldConfigFilename method getFill.

/**
 * Gets the fill.
 *
 * @param graphicFill the graphic fill
 * @param fieldConfigManager the field config manager
 * @return the fill
 */
@Override
public Fill getFill(GraphicFill graphicFill, GraphicPanelFieldManager fieldConfigManager) {
    if (fieldConfigManager == null) {
        return null;
    }
    Fill fill = null;
    FieldConfigBase fieldConfig = fieldConfigManager.get(FieldIdEnum.OVERALL_OPACITY);
    if (fieldConfig != null) {
        Expression fillColour = null;
        Expression fillColourOpacity = null;
        if (fieldConfig instanceof FieldConfigColour) {
            fillColourOpacity = ((FieldConfigColour) fieldConfig).getColourOpacityExpression();
        } else {
            fillColourOpacity = fieldConfig.getExpression();
        }
        fill = getStyleFactory().fill(graphicFill, fillColour, fillColourOpacity);
    }
    return fill;
}
Also used : Fill(org.geotools.styling.Fill) GraphicFill(org.opengis.style.GraphicFill) FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) Expression(org.opengis.filter.expression.Expression) FieldConfigColour(com.sldeditor.ui.detail.config.FieldConfigColour)

Example 54 with FieldConfigBase

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

the class FieldConfigFilename method externalGraphicValueUpdated.

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

Example 55 with FieldConfigBase

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

the class GroupConfig method enableSubGroups.

/**
 * Enable sub groups.
 *
 * @param enabled the enabled
 */
private void enableSubGroups(boolean enabled) {
    for (FieldConfigBase field : getFieldConfigList()) {
        CurrentFieldState fieldState = field.getFieldState();
        fieldState.setGroupSelected(enabled);
        field.setFieldState(fieldState);
    }
    for (GroupConfigInterface subGroup : subGroupList) {
        subGroup.enable(enabled);
    }
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase)

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