Search in sources :

Example 41 with FieldConfigBase

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

the class FieldConfigFilename 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 instanceof ExternalGraphicImpl) {
        ExternalGraphicImpl markerSymbol = (ExternalGraphicImpl) symbol;
        if (externalGraphicPanel != null) {
            externalGraphicPanel.setValue(markerSymbol);
        }
        if (multiOptionPanel != null) {
            multiOptionPanel.setSelectedItem(EXTERNAL_SYMBOL_KEY);
        }
        FieldConfigBase opacity = fieldConfigManager.get(FieldIdEnum.OVERALL_OPACITY);
        if (opacity != null) {
            opacity.populate(graphic.getOpacity());
        }
    }
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) ExternalGraphicImpl(org.geotools.styling.ExternalGraphicImpl)

Example 42 with FieldConfigBase

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

the class VOGeoServerLabelling method includeValue.

/**
 * Find out whether to include value based on the value of another field.
 *
 * @param field the field
 * @return true, if successful
 */
private boolean includeValue(FieldIdEnum field) {
    DefaultOverride override = overrideMap.get(field);
    if (override != null) {
        String value = null;
        FieldConfigBase fieldConfig = fieldConfigManager.get(override.getField());
        if (fieldConfig instanceof FieldConfigBoolean) {
            value = String.valueOf(fieldConfigVisitor.getBoolean(override.getField()));
        } else if (fieldConfig instanceof FieldConfigInteger) {
            value = String.valueOf(fieldConfigVisitor.getInteger(override.getField()));
        } else if (fieldConfig instanceof FieldConfigDouble) {
            value = String.valueOf(fieldConfigVisitor.getDouble(override.getField()));
        } else if (fieldConfig instanceof FieldConfigEnum) {
            value = String.valueOf(fieldConfigVisitor.getComboBox(override.getField()));
        } else {
            ConsoleManager.getInstance().error(this, "Unsupported field type : " + field + " " + fieldConfig.getClass().getName());
        }
        if (value != null) {
            for (String legalValue : override.getLegalValues()) {
                if (value.compareToIgnoreCase(legalValue) == 0) {
                    return true;
                }
            }
        }
    }
    return false;
}
Also used : FieldConfigInteger(com.sldeditor.ui.detail.config.FieldConfigInteger) FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) FieldConfigDouble(com.sldeditor.ui.detail.config.FieldConfigDouble) FieldConfigEnum(com.sldeditor.ui.detail.config.FieldConfigEnum) FieldConfigBoolean(com.sldeditor.ui.detail.config.FieldConfigBoolean)

Example 43 with FieldConfigBase

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

the class FieldConfigArrow method arrowValueUpdated.

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

Example 44 with FieldConfigBase

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

the class FieldConfigTTF 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) {
        return;
    }
    if (fieldConfigManager == null) {
        return;
    }
    MarkImpl markerSymbol = (MarkImpl) symbol;
    FillImpl fill = markerSymbol.getFill();
    Expression expFillColour = null;
    Expression expFillOpacity = null;
    if (fill != null) {
        expFillColour = fill.getColor();
        if (!isOverallOpacity(symbolizerType)) {
            expFillOpacity = fill.getOpacity();
        }
    }
    FieldConfigBase field = fieldConfigManager.get(fillFieldConfig.getColour());
    if (field != null) {
        field.populate(expFillColour);
    }
    // Opacity
    if (isOverallOpacity(symbolizerType)) {
        FieldConfigBase opacity = fieldConfigManager.get(FieldIdEnum.OVERALL_OPACITY);
        if (opacity != null) {
            opacity.populate(graphic.getOpacity());
        }
    }
    field = fieldConfigManager.get(fillFieldConfig.getOpacity());
    if (field != null) {
        field.populate(expFillOpacity);
    }
    Class<?> panelId = getCommonData().getPanelId();
    GroupConfigInterface fillGroup = fieldConfigManager.getGroup(panelId, fillFieldConfig.getGroup());
    if (fillGroup != null) {
        fillGroup.enable(expFillColour != null);
    }
    if (ttfPanel != null) {
        Expression wellKnownNameExpression = markerSymbol.getWellKnownName();
        String wellKnownName = null;
        if (wellKnownNameExpression != null) {
            wellKnownName = wellKnownNameExpression.toString();
        }
        ttfPanel.populateExpression(wellKnownName);
    }
    if (multiOptionPanel != null) {
        multiOptionPanel.setSelectedItem(TTF_SYMBOL_KEY);
    }
}
Also used : FillImpl(org.geotools.styling.FillImpl) FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) Expression(org.opengis.filter.expression.Expression) MarkImpl(org.geotools.styling.MarkImpl) GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface)

Example 45 with FieldConfigBase

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

the class FieldConfigTTF method ttfValueUpdated.

/**
 * TTF field value updated.
 */
@Override
public void ttfValueUpdated() {
    setCachedExpression(generateExpression());
    checkSymbolIsValid();
    FieldConfigBase parent = getParent();
    if (parent != null) {
        parent.valueUpdated();
    }
}
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