Search in sources :

Example 6 with GroupConfigInterface

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

the class GraphicPanelFieldManager method add.

/**
 * Adds an existing GraphicPanelFieldManager to this one.
 *
 * @param fieldConfigManager the field config manager
 */
public void add(GraphicPanelFieldManager fieldConfigManager) {
    if (fieldConfigManager != null) {
        Map<FieldIdEnum, FieldConfigBase> componentMapToAdd = fieldConfigManager.fieldConfigMap.get(fieldConfigManager.panelId);
        Map<FieldIdEnum, FieldConfigBase> componentMap = this.fieldConfigMap.get(fieldConfigManager.panelId);
        if (componentMap == null) {
            Map<FieldIdEnum, FieldConfigBase> value = fieldConfigManager.fieldConfigMap.get(fieldConfigManager.panelId);
            this.fieldConfigMap.put(fieldConfigManager.panelId, value);
        } else {
            for (FieldIdEnum fieldId : componentMapToAdd.keySet()) {
                FieldConfigBase dataToAdd = componentMapToAdd.get(fieldId);
                componentMap.put(fieldId, dataToAdd);
            }
        }
        // Add groups
        Map<GroupIdEnum, GroupConfigInterface> groupMapToAdd = fieldConfigManager.groupMap.get(fieldConfigManager.panelId);
        Map<GroupIdEnum, GroupConfigInterface> thisGroupMap = this.groupMap.get(fieldConfigManager.panelId);
        if (thisGroupMap == null) {
            Map<GroupIdEnum, GroupConfigInterface> value = fieldConfigManager.groupMap.get(fieldConfigManager.panelId);
            this.groupMap.put(fieldConfigManager.panelId, value);
        } else {
            for (GroupIdEnum groupId : groupMapToAdd.keySet()) {
                GroupConfigInterface dataToAdd = groupMapToAdd.get(groupId);
                thisGroupMap.put(groupId, dataToAdd);
            }
        }
    }
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) GroupIdEnum(com.sldeditor.common.xml.ui.GroupIdEnum)

Example 7 with GroupConfigInterface

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

the class PointFillDetails 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 8 with GroupConfigInterface

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

the class PolygonFillDetails method getGraphicFill.

/**
 * Gets the graphic fill.
 *
 * @return the graphic fill
 */
private GraphicFill getGraphicFill() {
    GroupConfigInterface fillGroup = getGroup(GroupIdEnum.FILL);
    boolean hasFill = fillGroup.isPanelEnabled();
    GroupConfigInterface strokeGroup = getGroup(GroupIdEnum.STROKE);
    boolean hasStroke = (strokeGroup == null) ? false : strokeGroup.isPanelEnabled();
    Expression opacity = null;
    Expression size = fieldConfigVisitor.getExpression(FieldIdEnum.SIZE);
    Expression rotation = fieldConfigVisitor.getExpression(FieldIdEnum.ANGLE);
    Expression symbolType = fieldConfigVisitor.getExpression(FieldIdEnum.SYMBOL_TYPE);
    // 
    // Anchor point
    // 
    AnchorPoint anchorPoint = null;
    GroupConfigInterface anchorPointPanel = getGroup(GroupIdEnum.ANCHORPOINT);
    if (anchorPointPanel.isPanelEnabled()) {
        anchorPoint = (AnchorPoint) getStyleFactory().anchorPoint(fieldConfigVisitor.getExpression(FieldIdEnum.ANCHOR_POINT_H), fieldConfigVisitor.getExpression(FieldIdEnum.ANCHOR_POINT_V));
        // default so it doesn't appear in the SLD
        if (DetailsUtilities.isSame(defaultAnchorPoint, anchorPoint)) {
            anchorPoint = null;
        }
    }
    // 
    // Displacement
    // 
    Displacement displacement = null;
    GroupConfigInterface displacementPanel = getGroup(GroupIdEnum.DISPLACEMENT);
    if (displacementPanel.isPanelEnabled()) {
        displacement = getStyleFactory().displacement(fieldConfigVisitor.getExpression(FieldIdEnum.DISPLACEMENT_X), fieldConfigVisitor.getExpression(FieldIdEnum.DISPLACEMENT_Y));
        // it doesn't appear in the SLD
        if (DetailsUtilities.isSame(defaultDisplacement, displacement)) {
            displacement = null;
        }
    }
    List<GraphicalSymbol> symbols = symbolTypeFactory.getValue(this.fieldConfigManager, symbolType, hasFill, hasStroke, selectedFillPanelId);
    GraphicFill graphicFill = getStyleFactory().graphicFill(symbols, opacity, size, rotation, anchorPoint, displacement);
    return graphicFill;
}
Also used : AnchorPoint(org.geotools.styling.AnchorPoint) Expression(org.opengis.filter.expression.Expression) GraphicFill(org.opengis.style.GraphicFill) GraphicalSymbol(org.opengis.style.GraphicalSymbol) GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface) Displacement(org.geotools.styling.Displacement)

Example 9 with GroupConfigInterface

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

the class RuleDetails method populateScaleRange.

/**
 * Populate scale range.
 *
 * @param enabled the enabled
 */
private void populateScaleRange(boolean enabled) {
    GroupConfigInterface group = getGroup(GroupIdEnum.SCALE);
    group.enable(enabled);
}
Also used : GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface)

Example 10 with GroupConfigInterface

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

the class ReadPanelConfig method read.

/**
 * Read configuration file and store the configuration in the object.
 *
 * @param panelId the panel id
 * @param resourceString the resource string
 * @return true, if successful
 */
public boolean read(Class<?> panelId, String resourceString) {
    groupList = new ArrayList<GroupConfigInterface>();
    PanelConfig panelConfig = (PanelConfig) ParseXML.parseUIFile(resourceString, SCHEMA_RESOURCE, PanelConfig.class);
    if (panelConfig == null) {
        return false;
    }
    Class<?> localisationClass = ReadPanelConfig.class;
    if (panelConfig.getLocalisation() != null) {
        try {
            localisationClass = Class.forName(panelConfig.getLocalisation());
        } catch (ClassNotFoundException e) {
            ConsoleManager.getInstance().exception(ReadPanelConfig.class, e);
        }
    }
    panelTitle = getLocalisedText(localisationClass, panelConfig.getPanelTitle());
    vendorOptionVersion = getVendorOptionVersion(panelConfig);
    for (Object groupObj : panelConfig.getGroupOrMultiOptionGroup()) {
        if (groupObj instanceof XMLGroupConfig) {
            GroupConfig groupConfig = parseGroup(localisationClass, panelId, (XMLGroupConfig) groupObj);
            groupList.add(groupConfig);
        } else if (groupObj instanceof XMLMultiOptionGroup) {
            MultiOptionGroup groupConfig = parseMultiOptionGroup(localisationClass, panelId, (XMLMultiOptionGroup) groupObj);
            groupList.add(groupConfig);
        }
    }
    return true;
}
Also used : XMLGroupConfig(com.sldeditor.common.xml.ui.XMLGroupConfig) GroupConfig(com.sldeditor.ui.detail.config.base.GroupConfig) XMLGroupConfig(com.sldeditor.common.xml.ui.XMLGroupConfig) XMLMultiOptionGroup(com.sldeditor.common.xml.ui.XMLMultiOptionGroup) PanelConfig(com.sldeditor.common.xml.ui.PanelConfig) GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface) XMLMultiOptionGroup(com.sldeditor.common.xml.ui.XMLMultiOptionGroup) MultiOptionGroup(com.sldeditor.ui.detail.config.base.MultiOptionGroup)

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