StyledLayerDescriptor sld = stylereader.parseSLD();
// the RasterSymbolizer Helper
SubchainStyleVisitorCoverageProcessingAdapter rsh = new RasterSymbolizerHelper(gc, null);
// build the RasterSymbolizer
final RasterSymbolizer rs_1 = extractRasterSymbolizer(sld);
// visit the RasterSymbolizer
rsh.visit(rs_1);
testRasterSymbolizerHelper(rsh);
// ////////////////////////////////////////////////////////////////////
//
// Test #1: [StyleBuilder]
// - Opacity: 1.0
// - ChannelSelection: RGB
// - Contrast Enh: Histogram
//
// ////////////////////////////////////////////////////////////////////
gc = CoverageFactoryFinder.getGridCoverageFactory(null)
.create(
"name",
JAI.create("ImageRead", new File(TestData.url(this, "small_4bands_UInt16.tif").toURI())),
new GeneralEnvelope(new double[] { -90, -180 },new double[] { 90, 180 }));
// the RasterSymbolizer Helper
rsh = new RasterSymbolizerHelper(gc, null);
// build the RasterSymbolizer
StyleBuilder sldBuilder = new StyleBuilder();
// the RasterSymbolizer Helper
rsh = new RasterSymbolizerHelper(gc, null);
final RasterSymbolizer rsb_1 = sldBuilder.createRasterSymbolizer();
final ChannelSelection chSel = new ChannelSelectionImpl();
final SelectedChannelType chTypeRed = new SelectedChannelTypeImpl();
final SelectedChannelType chTypeBlue = new SelectedChannelTypeImpl();
final SelectedChannelType chTypeGreen = new SelectedChannelTypeImpl();
final ContrastEnhancement cntEnh = new ContrastEnhancementImpl();
cntEnh.setMethod(ContrastMethod.HISTOGRAM);;
//cntEnh.setGammaValue(sldBuilder.literalExpression(0.50));
chTypeRed.setChannelName("1");
chTypeBlue.setChannelName("2");
chTypeGreen.setChannelName("3");
chSel.setRGBChannels(chTypeRed, chTypeBlue, chTypeGreen);
rsb_1.setChannelSelection(chSel);
rsb_1.setOpacity(sldBuilder.literalExpression(1.0));
rsb_1.setContrastEnhancement(cntEnh);
rsb_1.setOverlap(sldBuilder.literalExpression("AVERAGE"));
// visit the RasterSymbolizer
rsh.visit(rsb_1);
testRasterSymbolizerHelper(rsh);