Search in sources :

Example 31 with GroupConfigInterface

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

the class VOGeoServerFTSCompositeBase method updateSymbol.

/*
     * (non-Javadoc)
     * 
     * @see
     * com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface#updateSymbol(org.geotools.
     * styling.FeatureTypeStyle)
     */
@Override
public void updateSymbol(FeatureTypeStyle featureTypeStyle) {
    Map<String, String> options = featureTypeStyle.getOptions();
    GroupConfigInterface groupPanel = getGroup(GroupIdEnum.VO_FTS_COMPOSITE_BASE);
    if (groupPanel.isPanelEnabled()) {
        boolean value = fieldConfigVisitor.getBoolean(FieldIdEnum.VO_FTS_COMPOSITE_BASE_BOOL);
        options.put(FeatureTypeStyle.COMPOSITE_BASE, String.valueOf(value));
    } else {
        options.remove(FeatureTypeStyle.COMPOSITE_BASE);
    }
}
Also used : GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface)

Example 32 with GroupConfigInterface

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

the class VOGeoServerFTSCompositeBase method populate.

/*
     * (non-Javadoc)
     * 
     * @see
     * com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface#populate(org.geotools.styling.
     * FeatureTypeStyle)
     */
@Override
public void populate(FeatureTypeStyle featureTypeStyle) {
    Map<String, String> options = featureTypeStyle.getOptions();
    String compositeBaseString = options.get(FeatureTypeStyle.COMPOSITE_BASE);
    boolean value = DEFAULT_COMPOSITE_BASE;
    try {
        value = Boolean.valueOf(compositeBaseString);
    } catch (Exception e) {
    // Do nothing and revert to default
    }
    fieldConfigVisitor.populateBooleanField(FieldIdEnum.VO_FTS_COMPOSITE_BASE_BOOL, value);
    GroupConfigInterface groupPanel = getGroup(GroupIdEnum.VO_FTS_COMPOSITE_BASE);
    groupPanel.enable(compositeBaseString != null);
}
Also used : GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface)

Example 33 with GroupConfigInterface

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

the class VOGeoServerContrastEnhancementNormalizeBlueTest method testVOGeoServerContrastEnhancementNormalizeBlue.

/**
 * Test method for {@link com.sldeditor.ui.detail.vendor.geoserver.raster.VOGeoServerContrastEnhancementNormalizeBlue#VOGeoServerContrastEnhancementNormalizeBlue(java.lang.Class, com.sldeditor.ui.detail.RasterSymbolizerDetails)}.
 * Test method for {@link com.sldeditor.ui.detail.vendor.geoserver.raster.VOGeoServerContrastEnhancementNormalizeBlue#getContrastEnhancement(com.sldeditor.common.xml.ui.GroupIdEnum, org.geotools.styling.ChannelSelection)}.
 */
@Test
public void testVOGeoServerContrastEnhancementNormalizeBlue() {
    RasterSymbolizerDetails panel = new RasterSymbolizerDetails();
    VOGeoServerContrastEnhancementNormalizeBlue testObj = new VOGeoServerContrastEnhancementNormalizeBlue(panel.getClass(), panel);
    RasterSymbolizer rasterSymbolizer = null;
    testObj.setParentPanel(panel);
    testObj.populate(rasterSymbolizer);
    testObj.updateSymbol(rasterSymbolizer);
    StyleFactoryImpl styleFactory = (StyleFactoryImpl) CommonFactoryFinder.getStyleFactory();
    rasterSymbolizer = styleFactory.createRasterSymbolizer();
    GroupConfigInterface constrastMethodGroup = panel.getGroup(GroupIdEnum.RASTER_RGB_CHANNEL_BLUE_CONTRAST_METHOD);
    assertNotNull(constrastMethodGroup);
    MultiOptionGroup constrastMethodGroup2 = (MultiOptionGroup) constrastMethodGroup;
    Box box = Box.createVerticalBox();
    constrastMethodGroup2.createUI(panel.getFieldDataManager(), box, panel, panel.getPanelId());
    constrastMethodGroup2.setOption(GroupIdEnum.RASTER_OVERALL_CONTRAST_METHOD_LOGARITHMIC);
    ChannelSelection channelSelection = createChannelSelection(styleFactory, ContrastMethod.LOGARITHMIC);
    rasterSymbolizer.setChannelSelection(channelSelection);
    testObj.populate(rasterSymbolizer);
    SelectedSymbol.getInstance().setSymbolizer(rasterSymbolizer);
    Controller.getInstance().setPopulating(true);
    panel.populate(SelectedSymbol.getInstance());
    Controller.getInstance().setPopulating(false);
    testObj.updateSymbol(rasterSymbolizer);
    channelSelection = createChannelSelection(styleFactory, ContrastMethod.EXPONENTIAL);
    rasterSymbolizer.setChannelSelection(channelSelection);
    constrastMethodGroup2.setOption(GroupIdEnum.RASTER_OVERALL_CONTRAST_METHOD_EXPONENTIAL);
    testObj.populate(rasterSymbolizer);
    testObj.updateSymbol(rasterSymbolizer);
    channelSelection = createChannelSelection(styleFactory, ContrastMethod.HISTOGRAM);
    rasterSymbolizer.setChannelSelection(channelSelection);
    constrastMethodGroup2.setOption(GroupIdEnum.RASTER_OVERALL_CONTRAST_METHOD_HISTOGRAM);
    testObj.populate(rasterSymbolizer);
    testObj.updateSymbol(rasterSymbolizer);
    channelSelection = createChannelSelection(styleFactory, ContrastMethod.NORMALIZE);
    constrastMethodGroup2.setOption(GroupIdEnum.RASTER_OVERALL_CONTRAST_METHOD_NORMALIZE);
    rasterSymbolizer.setChannelSelection(channelSelection);
    testObj.populate(rasterSymbolizer);
    testObj.updateSymbol(rasterSymbolizer);
    // Error
    channelSelection = createChannelSelectionError(styleFactory, ContrastMethod.NORMALIZE);
    rasterSymbolizer.setChannelSelection(channelSelection);
    testObj.populate(rasterSymbolizer);
    testObj.updateSymbol(rasterSymbolizer);
    // Increase code coverage
    testObj.populate((SelectedSymbol) null);
    testObj.populate((TextSymbolizer) null);
    testObj.populate((PolygonSymbolizer) null);
    testObj.updateSymbol((TextSymbolizer) null);
    testObj.updateSymbol((PolygonSymbolizer) null);
    testObj.preLoadSymbol();
    assertTrue(testObj.isDataPresent());
    testObj.dataChanged(FieldIdEnum.DESCRIPTION);
}
Also used : RasterSymbolizer(org.geotools.styling.RasterSymbolizer) VOGeoServerContrastEnhancementNormalizeBlue(com.sldeditor.ui.detail.vendor.geoserver.raster.VOGeoServerContrastEnhancementNormalizeBlue) StyleFactoryImpl(org.geotools.styling.StyleFactoryImpl) ChannelSelection(org.geotools.styling.ChannelSelection) RasterSymbolizerDetails(com.sldeditor.ui.detail.RasterSymbolizerDetails) Box(javax.swing.Box) GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface) MultiOptionGroup(com.sldeditor.ui.detail.config.base.MultiOptionGroup) Test(org.junit.Test)

Example 34 with GroupConfigInterface

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

the class VOGeoServerContrastEnhancementNormalizeGreyTest method testVOGeoServerContrastEnhancementNormalizeGrey.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.raster.VOGeoServerContrastEnhancementNormalizeGrey#VOGeoServerContrastEnhancementNormalizeGrey(java.lang.Class, com.sldeditor.ui.detail.RasterSymbolizerDetails)}.
 * Test method for
 * {@link com.sldeditor.ui.detail.vendor.geoserver.raster.VOGeoServerContrastEnhancementNormalizeGrey#getContrastEnhancement(com.sldeditor.common.xml.ui.GroupIdEnum, org.geotools.styling.ChannelSelection)}.
 */
@Test
public void testVOGeoServerContrastEnhancementNormalizeGrey() {
    RasterSymbolizerDetails panel = new RasterSymbolizerDetails();
    VOGeoServerContrastEnhancementNormalizeGrey testObj = new VOGeoServerContrastEnhancementNormalizeGrey(panel.getClass(), panel);
    RasterSymbolizer rasterSymbolizer = null;
    testObj.setParentPanel(panel);
    testObj.populate(rasterSymbolizer);
    testObj.updateSymbol(rasterSymbolizer);
    StyleFactoryImpl styleFactory = (StyleFactoryImpl) CommonFactoryFinder.getStyleFactory();
    rasterSymbolizer = styleFactory.createRasterSymbolizer();
    GroupConfigInterface constrastMethodGroup = panel.getGroup(GroupIdEnum.RASTER_RGB_CHANNEL_GREY_CONTRAST_METHOD);
    assertNotNull(constrastMethodGroup);
    MultiOptionGroup constrastMethodGroup2 = (MultiOptionGroup) constrastMethodGroup;
    Box box = Box.createVerticalBox();
    constrastMethodGroup2.createUI(panel.getFieldDataManager(), box, panel, panel.getPanelId());
    constrastMethodGroup2.setOption(GroupIdEnum.RASTER_OVERALL_CONTRAST_METHOD_LOGARITHMIC);
    ChannelSelection channelSelection = createChannelSelection(styleFactory, ContrastMethod.LOGARITHMIC);
    rasterSymbolizer.setChannelSelection(channelSelection);
    testObj.populate(rasterSymbolizer);
    SelectedSymbol.getInstance().setSymbolizer(rasterSymbolizer);
    Controller.getInstance().setPopulating(true);
    panel.populate(SelectedSymbol.getInstance());
    Controller.getInstance().setPopulating(false);
    testObj.updateSymbol(rasterSymbolizer);
    channelSelection = createChannelSelection(styleFactory, ContrastMethod.EXPONENTIAL);
    rasterSymbolizer.setChannelSelection(channelSelection);
    constrastMethodGroup2.setOption(GroupIdEnum.RASTER_OVERALL_CONTRAST_METHOD_EXPONENTIAL);
    testObj.populate(rasterSymbolizer);
    testObj.updateSymbol(rasterSymbolizer);
    channelSelection = createChannelSelection(styleFactory, ContrastMethod.HISTOGRAM);
    rasterSymbolizer.setChannelSelection(channelSelection);
    constrastMethodGroup2.setOption(GroupIdEnum.RASTER_OVERALL_CONTRAST_METHOD_HISTOGRAM);
    testObj.populate(rasterSymbolizer);
    testObj.updateSymbol(rasterSymbolizer);
    channelSelection = createChannelSelection(styleFactory, ContrastMethod.NORMALIZE);
    constrastMethodGroup2.setOption(GroupIdEnum.RASTER_OVERALL_CONTRAST_METHOD_NORMALIZE);
    rasterSymbolizer.setChannelSelection(channelSelection);
    testObj.populate(rasterSymbolizer);
    testObj.updateSymbol(rasterSymbolizer);
    // Error
    channelSelection = createChannelSelectionError(styleFactory, ContrastMethod.NORMALIZE);
    rasterSymbolizer.setChannelSelection(channelSelection);
    testObj.populate(rasterSymbolizer);
    testObj.updateSymbol(rasterSymbolizer);
    // Increase code coverage
    testObj.populate((SelectedSymbol) null);
    testObj.populate((TextSymbolizer) null);
    testObj.populate((PolygonSymbolizer) null);
    testObj.updateSymbol((TextSymbolizer) null);
    testObj.updateSymbol((PolygonSymbolizer) null);
    testObj.preLoadSymbol();
    assertTrue(testObj.isDataPresent());
    testObj.dataChanged(FieldIdEnum.DESCRIPTION);
}
Also used : VOGeoServerContrastEnhancementNormalizeGrey(com.sldeditor.ui.detail.vendor.geoserver.raster.VOGeoServerContrastEnhancementNormalizeGrey) RasterSymbolizer(org.geotools.styling.RasterSymbolizer) StyleFactoryImpl(org.geotools.styling.StyleFactoryImpl) ChannelSelection(org.geotools.styling.ChannelSelection) RasterSymbolizerDetails(com.sldeditor.ui.detail.RasterSymbolizerDetails) Box(javax.swing.Box) GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface) MultiOptionGroup(com.sldeditor.ui.detail.config.base.MultiOptionGroup) Test(org.junit.Test)

Example 35 with GroupConfigInterface

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

the class PointFillDetails method getGraphic.

/**
 * Gets the graphic.
 *
 * @return the graphic
 */
private Graphic getGraphic() {
    AnchorPoint anchor = null;
    Displacement displacement = null;
    Expression symbolType = fieldConfigVisitor.getExpression(FieldIdEnum.SYMBOL_TYPE);
    GroupConfigInterface fillGroup = getGroup(GroupIdEnum.FILL);
    boolean hasFill = fillGroup.isPanelEnabled();
    GroupConfigInterface strokeGroup = getGroup(GroupIdEnum.STROKE);
    boolean hasStroke = (strokeGroup == null) ? false : strokeGroup.isPanelEnabled();
    Expression opacity = fieldConfigVisitor.getExpression(FieldIdEnum.OVERALL_OPACITY);
    Expression size = fieldConfigVisitor.getExpression(FieldIdEnum.SIZE);
    Expression rotation = fieldConfigVisitor.getExpression(FieldIdEnum.ANGLE);
    // 
    // Anchor point
    // 
    GroupConfigInterface anchorPointPanel = getGroup(GroupIdEnum.ANCHORPOINT);
    if (anchorPointPanel.isPanelEnabled()) {
        anchor = (AnchorPoint) getStyleFactory().anchorPoint(fieldConfigVisitor.getExpression(FieldIdEnum.ANCHOR_POINT_H), fieldConfigVisitor.getExpression(FieldIdEnum.ANCHOR_POINT_V));
        // so it doesn't appear in the SLD
        if (DetailsUtilities.isSame(AnchorPoint.DEFAULT, anchor)) {
            anchor = null;
        }
    }
    // 
    // Displacement
    // 
    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(Displacement.DEFAULT, displacement)) {
            displacement = null;
        }
    }
    List<GraphicalSymbol> symbols = symbolTypeFactory.getValue(fieldConfigManager, symbolType, hasFill, hasStroke, selectedFillPanelId);
    boolean overallOpacity = symbolTypeFactory.isOverallOpacity(PointSymbolizer.class, selectedFillPanelId);
    Graphic graphic = getStyleFactory().graphic(symbols, null, size, rotation, anchor, displacement);
    Expression gap = fieldConfigVisitor.getExpression(FieldIdEnum.GAP);
    Expression initialGap = fieldConfigVisitor.getExpression(FieldIdEnum.INITIAL_GAP);
    graphic.setInitialGap(initialGap);
    graphic.setGap(gap);
    if (overallOpacity) {
        graphic.setOpacity(opacity);
    }
    return graphic;
}
Also used : AnchorPoint(org.geotools.styling.AnchorPoint) Expression(org.opengis.filter.expression.Expression) Graphic(org.geotools.styling.Graphic) GraphicalSymbol(org.opengis.style.GraphicalSymbol) GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface) Displacement(org.geotools.styling.Displacement)

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