Search in sources :

Example 11 with GroupConfigInterface

use of com.sldeditor.ui.detail.config.base.GroupConfigInterface 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 12 with GroupConfigInterface

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

the class TextSymbolizerDetails method populate.

/**
 * Populate.
 *
 * @param selectedSymbol the selected symbol
 */
/*
     * (non-Javadoc)
     * 
     * @see com.sldeditor.ui.iface.PopulateDetailsInterface#populate(com.sldeditor.ui.detail.selectedsymbol.SelectedSymbol)
     */
@Override
public void populate(SelectedSymbol selectedSymbol) {
    if (selectedSymbol != null) {
        TextSymbolizer textSymbolizer = (TextSymbolizer) selectedSymbol.getSymbolizer();
        if (textSymbolizer != null) {
            populateStandardData(textSymbolizer);
            // 
            // Geometry
            // 
            fieldConfigVisitor.populateField(FieldIdEnum.GEOMETRY, textSymbolizer.getGeometry());
            // 
            // Label
            // 
            fieldConfigVisitor.populateField(FieldIdEnum.LABEL, textSymbolizer.getLabel());
            // Font
            Font font = textSymbolizer.getFont();
            GroupConfigInterface group = getGroup(GroupIdEnum.FONT);
            group.enable(font != null);
            if (font != null) {
                fieldConfigVisitor.populateFontField(FieldIdEnum.FONT_FAMILY, font);
                fieldConfigVisitor.populateField(FieldIdEnum.FONT_WEIGHT, font.getWeight());
                fieldConfigVisitor.populateField(FieldIdEnum.FONT_STYLE, font.getStyle());
                fieldConfigVisitor.populateField(FieldIdEnum.FONT_SIZE, font.getSize());
            }
            fieldConfigVisitor.populateFontField(FieldIdEnum.FONT_PREVIEW, font);
            // Fill
            Fill fill = (FillImpl) textSymbolizer.getFill();
            if (fill != null) {
                fieldConfigVisitor.populateField(FieldIdEnum.FILL_COLOUR, fill.getColor());
                fieldConfigVisitor.populateField(FieldIdEnum.TEXT_OPACITY, fill.getOpacity());
            }
            // Halo
            Halo halo = textSymbolizer.getHalo();
            group = getGroup(GroupIdEnum.HALO);
            group.enable(halo != null);
            if (halo != null) {
                Fill haloFill = halo.getFill();
                fieldConfigVisitor.populateField(FieldIdEnum.HALO_COLOUR, haloFill.getColor());
                fieldConfigVisitor.populateField(FieldIdEnum.HALO_RADIUS, halo.getRadius());
            } else {
                fieldConfigVisitor.populateField(FieldIdEnum.HALO_COLOUR, (Expression) null);
                fieldConfigVisitor.populateField(FieldIdEnum.HALO_RADIUS, (Expression) null);
            }
            group = getGroup(GroupIdEnum.PLACEMENT);
            if (group != null) {
                MultiOptionGroup labelPlacementGroup = (MultiOptionGroup) group;
                LabelPlacement placement = textSymbolizer.getLabelPlacement();
                if (placement instanceof PointPlacementImpl) {
                    PointPlacementImpl pointPlacement = (PointPlacementImpl) placement;
                    labelPlacementGroup.setOption(GroupIdEnum.POINTPLACEMENT);
                    Expression anchorPointX = null;
                    Expression anchorPointY = null;
                    AnchorPoint anchorPoint = pointPlacement.getAnchorPoint();
                    if (anchorPoint != null) {
                        anchorPointX = anchorPoint.getAnchorPointX();
                        anchorPointY = anchorPoint.getAnchorPointY();
                    } else {
                        // Use the defaults as non specified
                        anchorPointX = defaultPointPlacementAnchorPointX;
                        anchorPointY = defaultPointPlacementAnchorPointY;
                    }
                    fieldConfigVisitor.populateField(FieldIdEnum.ANCHOR_POINT_H, anchorPointX);
                    fieldConfigVisitor.populateField(FieldIdEnum.ANCHOR_POINT_V, anchorPointY);
                    Displacement displacement = pointPlacement.getDisplacement();
                    if (displacement == null) {
                        displacement = DisplacementImpl.DEFAULT;
                    }
                    fieldConfigVisitor.populateField(FieldIdEnum.DISPLACEMENT_X, displacement.getDisplacementX());
                    fieldConfigVisitor.populateField(FieldIdEnum.DISPLACEMENT_Y, displacement.getDisplacementY());
                    fieldConfigVisitor.populateField(FieldIdEnum.ANGLE, pointPlacement.getRotation());
                } else if (placement instanceof LinePlacementImpl) {
                    LinePlacementImpl linePlacement = (LinePlacementImpl) placement;
                    labelPlacementGroup.setOption(GroupIdEnum.LINEPLACEMENT);
                    fieldConfigVisitor.populateField(FieldIdEnum.GAP, linePlacement.getGap());
                    fieldConfigVisitor.populateField(FieldIdEnum.INITIAL_GAP, linePlacement.getInitialGap());
                    fieldConfigVisitor.populateField(FieldIdEnum.PERPENDICULAR_OFFSET, linePlacement.getPerpendicularOffset());
                    fieldConfigVisitor.populateBooleanField(FieldIdEnum.GENERALISED_LINE, linePlacement.isGeneralizeLine());
                    fieldConfigVisitor.populateBooleanField(FieldIdEnum.ALIGN, linePlacement.isAligned());
                    fieldConfigVisitor.populateBooleanField(FieldIdEnum.REPEATED, linePlacement.isRepeated());
                }
            }
            if (vendorOptionTextFactory != null) {
                vendorOptionTextFactory.populate(textSymbolizer);
            }
        }
    }
}
Also used : Fill(org.opengis.style.Fill) FillImpl(org.geotools.styling.FillImpl) Font(org.geotools.styling.Font) PointPlacementImpl(org.geotools.styling.PointPlacementImpl) Displacement(org.geotools.styling.Displacement) AnchorPoint(org.geotools.styling.AnchorPoint) LabelPlacement(org.geotools.styling.LabelPlacement) TextSymbolizer(org.geotools.styling.TextSymbolizer) Expression(org.opengis.filter.expression.Expression) GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface) MultiOptionGroup(com.sldeditor.ui.detail.config.base.MultiOptionGroup) LinePlacementImpl(org.geotools.styling.LinePlacementImpl) Halo(org.geotools.styling.Halo)

Example 13 with GroupConfigInterface

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

the class UserLayerDetails method populate.

/*
     * (non-Javadoc)
     * 
     * @see com.sldeditor.ui.iface.PopulateDetailsInterface#populate(com.sldeditor.ui.detail.SelectedSymbol)
     */
@Override
public void populate(SelectedSymbol selectedSymbol) {
    if (selectedSymbol != null) {
        StyledLayer styledLayer = selectedSymbol.getStyledLayer();
        if (styledLayer instanceof UserLayerImpl) {
            UserLayerImpl userLayer = (UserLayerImpl) styledLayer;
            fieldConfigVisitor.populateTextField(FieldIdEnum.NAME, userLayer.getName());
            // Feature layer constraint
            List<FeatureTypeConstraint> ftcList = userLayer.layerFeatureConstraints();
            fieldConfigVisitor.populateFieldTypeConstraint(FieldIdEnum.LAYER_FEATURE_CONSTRAINTS, ftcList);
            // Source
            GroupConfigInterface group = getGroup(GroupIdEnum.USER_LAYER_SOURCE);
            if (group != null) {
                MultiOptionGroup userLayerSourceGroup = (MultiOptionGroup) group;
                if (userLayer.getInlineFeatureDatastore() == null) {
                    userLayerSourceGroup.setOption(GroupIdEnum.REMOTE_OWS_OPTION);
                    // Remote OWS
                    String service = "";
                    String onlineResource = "";
                    RemoteOWS remoteOWS = userLayer.getRemoteOWS();
                    if (remoteOWS != null) {
                        service = remoteOWS.getService();
                        onlineResource = remoteOWS.getOnlineResource();
                    }
                    fieldConfigVisitor.populateTextField(FieldIdEnum.REMOTE_OWS_SERVICE, service);
                    fieldConfigVisitor.populateTextField(FieldIdEnum.REMOTE_OWS_ONLINERESOURCE, onlineResource);
                } else {
                    userLayerSourceGroup.setOption(GroupIdEnum.INLINE_FEATURE_OPTION);
                    // Inline features
                    fieldConfigVisitor.populateUserLayer(FieldIdEnum.INLINE_FEATURE, userLayer);
                }
            }
        }
    }
}
Also used : RemoteOWS(org.geotools.styling.RemoteOWS) UserLayerImpl(org.geotools.styling.UserLayerImpl) FeatureTypeConstraint(org.geotools.styling.FeatureTypeConstraint) StyledLayer(org.geotools.styling.StyledLayer) GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface) MultiOptionGroup(com.sldeditor.ui.detail.config.base.MultiOptionGroup)

Example 14 with GroupConfigInterface

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

the class FieldConfigWKT 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)) {
        if (symbol instanceof Mark) {
            MarkImpl markerSymbol = (MarkImpl) symbol;
            // Fill
            FillImpl fill = markerSymbol.getFill();
            if (fill != null) {
                populateColour(fieldConfigManager, fillFieldConfig, fill.getColor(), fill.getOpacity());
            }
            GroupConfigInterface fillGroup = fieldConfigManager.getGroup(fieldConfigManager.getComponentId(), fillFieldConfig.getGroup());
            if (fillGroup != null) {
                fillGroup.enable(fill != null);
            }
            // Stroke
            StrokeImpl stroke = markerSymbol.getStroke();
            if (stroke != null) {
                populateColour(fieldConfigManager, strokeFieldConfig, stroke.getColor(), stroke.getOpacity());
            }
            GroupConfigInterface strokeGroup = fieldConfigManager.getGroup(fieldConfigManager.getComponentId(), strokeFieldConfig.getGroup());
            if (strokeGroup != null) {
                strokeGroup.enable(stroke != null);
            }
            if (wktPanel != null) {
                wktPanel.populateExpression(markerSymbol.getWellKnownName().toString());
            }
            if (multiOptionPanel != null) {
                multiOptionPanel.setSelectedItem(WKT_SYMBOL_KEY);
            }
        }
    }
}
Also used : FillImpl(org.geotools.styling.FillImpl) Mark(org.geotools.styling.Mark) MarkImpl(org.geotools.styling.MarkImpl) GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface) StrokeImpl(org.geotools.styling.StrokeImpl)

Example 15 with GroupConfigInterface

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

the class FieldConfigMarker method setSolidFill.

/**
 * Sets the solid fill.
 *
 * @param fieldConfigManager the field config manager
 * @param expFillColour the new solid fill
 * @param expFillColourOpacity the expression fill colour opacity
 */
public void setSolidFill(GraphicPanelFieldManager fieldConfigManager, Expression expFillColour, Expression expFillColourOpacity) {
    if (fieldConfigManager != null) {
        FieldConfigBase field = fieldConfigManager.get(fillFieldConfig.getColour());
        if (field != null) {
            field.populate(expFillColour);
        }
        Class<?> panelId = getCommonData().getPanelId();
        GroupConfigInterface fillGroup = fieldConfigManager.getGroup(panelId, GroupIdEnum.FILL);
        if (fillGroup != null) {
            fillGroup.enable(expFillColour != null);
        }
        // Opacity
        field = fieldConfigManager.get(fillFieldConfig.getOpacity());
        if (field != null) {
            field.populate(expFillColourOpacity);
        }
    }
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) 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