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);
}
}
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);
}
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);
}
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);
}
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;
}
Aggregations