// - Opacity: 1.0
// - ChannelSelection: Gray {Contrast Enh: Histogram}
//
// ////////////////////////////////////////////////////////////////////
java.net.URL surl = TestData.url(this, "1band_Float32_test1.sld");
SLDParser stylereader = new SLDParser(sf, surl);
StyledLayerDescriptor sld = stylereader.parseSLD();
// the RasterSymbolizer Helper
SubchainStyleVisitorCoverageProcessingAdapter rsh = new RasterSymbolizerHelper(gc, null);
RasterSymbolizer rs_1 = extractRasterSymbolizer(sld);
// visit the RasterSymbolizer
rsh.visit(rs_1);
testRasterSymbolizerHelper(rsh);
// ////////////////////////////////////////////////////////////////////
//
// Test #2: [StyleBuilder]
// - Opacity: 1.0
// - ChannelSelection: Gray {Contrast Enh: Histogram}
//
// ////////////////////////////////////////////////////////////////////
gc = CoverageFactoryFinder.getGridCoverageFactory(null)
.create(
"name",
JAI.create("ImageRead", new File(TestData.url(this, "small_1band_Byte.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 chTypeGray = new SelectedChannelTypeImpl();
final ContrastEnhancement cntEnh = new ContrastEnhancementImpl();
//this will convert to byte!!!
cntEnh.setMethod(ContrastMethod.HISTOGRAM);
chTypeGray.setChannelName("1");
chTypeGray.setContrastEnhancement(cntEnh);
chSel.setGrayChannel(chTypeGray);
rsb_1.setChannelSelection(chSel);
// visit the RasterSymbolizer
rsh.visit(rsb_1);
final RenderedImage im=((GridCoverage2D) rsh.getOutput()).getRenderedImage();
Assert.assertTrue(im.getSampleModel().getDataType()==0);
testRasterSymbolizerHelper(rsh);
// ////////////////////////////////////////////////////////////////////
//
// Test #3: [SLD]
// - Opacity: 1.0
// - ChannelSelection: Gray {Contrast Enh: Histogram}
// - ColorMap
//
// ////////////////////////////////////////////////////////////////////
// the GridCoverage
gc = CoverageFactoryFinder.getGridCoverageFactory(null)
.create(
"name",
JAI.create("ImageRead", new File(TestData.url(this, "small_1band_Byte.tif").toURI())),
new GeneralEnvelope(new double[] { -90, -180 },
new double[] { 90, 180 }));
surl = TestData.url(this, "1band_Float32_test2.sld");
stylereader = new SLDParser(sf, surl);
sld = stylereader.parseSLD();
// the RasterSymbolizer Helper
rsh = new RasterSymbolizerHelper(gc, null);
// build the RasterSymbolizer
rs_1 = extractRasterSymbolizer(sld);