use of org.geotools.styling.ContrastEnhancement in project sldeditor by robward-scisys.
the class VOGeoServerContrastEnhancementNormalize method updateSymbol.
/*
* (non-Javadoc)
*
* @see
* com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface#updateSymbol(org.geotools.
* styling.RasterSymbolizer)
*/
@Override
public void updateSymbol(RasterSymbolizer rasterSymbolizer) {
if (parentPanel != null) {
GroupConfigInterface group = parentPanel.getGroup(GroupIdEnum.RASTER_CHANNELSELECTION);
if (group != null) {
if (group.isPanelEnabled()) {
MultiOptionGroup contrastEnhancementGroup = (MultiOptionGroup) group;
ChannelSelection channelSelection = rasterSymbolizer.getChannelSelection();
OptionGroup selectedOption = contrastEnhancementGroup.getSelectedOptionGroup();
ContrastEnhancement contrastEnhancement = getContrastEnhancement(selectedOption.getId(), channelSelection);
if (contrastEnhancement != null) {
extractNormalizeVendorOption(contrastEnhancement);
}
}
}
}
}
use of org.geotools.styling.ContrastEnhancement in project sldeditor by robward-scisys.
the class VOGeoServerContrastEnhancementNormalize method populate.
/*
* (non-Javadoc)
*
* @see
* com.sldeditor.ui.detail.vendor.geoserver.VendorOptionInterface#populate(org.geotools.styling.
* RasterSymbolizer)
*/
@Override
public void populate(RasterSymbolizer rasterSymbolizer) {
if (rasterSymbolizer != null) {
ContrastEnhancement contrastEnhancement = getContrastEnhancement(rasterSymbolizer);
if (contrastEnhancement != null) {
Map<String, Expression> options = contrastEnhancement.getOptions();
if ((options != null) && !options.isEmpty()) {
if (contrastEnhancement.getMethod().equals(ContrastMethod.NORMALIZE)) {
String algorithm = options.get(ALGORITHM_OPTION).toString();
fieldConfigVisitor.populateComboBoxField(algorithmFieldId, algorithm);
int minValue = 0;
try {
Expression expression = options.get(MIN_VALUE_OPTION);
minValue = Integer.valueOf(expression.toString());
} catch (Exception e) {
// Ignore number format conversions
ConsoleManager.getInstance().error(this, "Vendor Option - minValue not valid");
}
fieldConfigVisitor.populateIntegerField(minValueFieldId, minValue);
int maxValue = 0;
try {
Expression expression = options.get(MAX_VALUE_OPTION);
maxValue = Integer.valueOf(expression.toString());
} catch (Exception e) {
// Ignore number format conversions
ConsoleManager.getInstance().error(this, "Vendor Option - maxValue not valid");
}
fieldConfigVisitor.populateIntegerField(maxValueFieldId, maxValue);
}
}
}
}
}
use of org.geotools.styling.ContrastEnhancement in project sldeditor by robward-scisys.
the class VOGeoServerContrastEnhancementNormalizeBlueTest method createChannelSelectionError.
/**
* Creates the channel selection error object.
*
* @param styleFactory the style factory
* @param contrastMethod the contrast method
* @return the channel selection
*/
private ChannelSelection createChannelSelectionError(StyleFactoryImpl styleFactory, ContrastMethod contrastMethod) {
ContrastEnhancement contrastEnhancement = (ContrastEnhancement) styleFactory.contrastEnhancement(null, contrastMethod.name());
FilterFactory ff = CommonFactoryFinder.getFilterFactory();
Map<String, Expression> options = contrastEnhancement.getOptions();
options.put("algorithm", ff.literal("TestStretchToMinimumMaximum"));
options.put("minValue", ff.literal("1.0"));
options.put("maxValue", ff.literal("5.0"));
SelectedChannelType channelType = styleFactory.createSelectedChannelType("channel name", contrastEnhancement);
SelectedChannelType[] channels = new SelectedChannelType[3];
channels[0] = channelType;
channels[1] = channelType;
channels[2] = channelType;
ChannelSelection channelSelection = styleFactory.createChannelSelection(channels);
return channelSelection;
}
use of org.geotools.styling.ContrastEnhancement in project sldeditor by robward-scisys.
the class VOGeoServerContrastEnhancementNormalizeGreenTest method createChannelSelection.
/**
* Creates the channel selection object.
*
* @param styleFactory the style factory
* @param contrastMethod the contrast method
* @return the channel selection
*/
private ChannelSelection createChannelSelection(StyleFactoryImpl styleFactory, ContrastMethod contrastMethod) {
ContrastEnhancement contrastEnhancement = (ContrastEnhancement) styleFactory.contrastEnhancement(null, contrastMethod.name());
FilterFactory ff = CommonFactoryFinder.getFilterFactory();
Map<String, Expression> options = contrastEnhancement.getOptions();
options.put("algorithm", ff.literal("StretchToMinimumMaximum"));
options.put("minValue", ff.literal("1"));
options.put("maxValue", ff.literal("5"));
SelectedChannelType channelType = styleFactory.createSelectedChannelType("channel name", contrastEnhancement);
SelectedChannelType[] channels = new SelectedChannelType[3];
channels[0] = channelType;
channels[1] = channelType;
channels[2] = channelType;
ChannelSelection channelSelection = styleFactory.createChannelSelection(channels);
return channelSelection;
}
use of org.geotools.styling.ContrastEnhancement in project sldeditor by robward-scisys.
the class VOGeoServerContrastEnhancementNormalizeGreenTest method createChannelSelectionError.
/**
* Creates the channel selection error object.
*
* @param styleFactory the style factory
* @param contrastMethod the contrast method
* @return the channel selection
*/
private ChannelSelection createChannelSelectionError(StyleFactoryImpl styleFactory, ContrastMethod contrastMethod) {
ContrastEnhancement contrastEnhancement = (ContrastEnhancement) styleFactory.contrastEnhancement(null, contrastMethod.name());
FilterFactory ff = CommonFactoryFinder.getFilterFactory();
Map<String, Expression> options = contrastEnhancement.getOptions();
options.put("algorithm", ff.literal("TestStretchToMinimumMaximum"));
options.put("minValue", ff.literal("1.0"));
options.put("maxValue", ff.literal("5.0"));
SelectedChannelType channelType = styleFactory.createSelectedChannelType("channel name", contrastEnhancement);
SelectedChannelType[] channels = new SelectedChannelType[3];
channels[0] = channelType;
channels[1] = channelType;
channels[2] = channelType;
ChannelSelection channelSelection = styleFactory.createChannelSelection(channels);
return channelSelection;
}
Aggregations