// the RasterSymbolizer Helper
rsh_StyleBuilder = 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();
cntEnh.setMethod(ContrastMethod.HISTOGRAM);;
//cntEnh.setType(type);
//cntEnh.setGammaValue(sldBuilder.literalExpression(0.50));
chTypeGray.setChannelName("1");
chTypeGray.setContrastEnhancement(cntEnh);
chSel.setGrayChannel(chTypeGray);
rsb_1.setChannelSelection(chSel);
rsb_1.setOpacity(sldBuilder.literalExpression(1.0));
rsb_1.setOverlap(sldBuilder.literalExpression("AVERAGE"));
// visit the RasterSymbolizer
rsh_StyleBuilder.visit(rsb_1);
testRasterSymbolizerHelper(rsh_StyleBuilder);
// ////////////////////////////////////////////////////////////////////
//
// Test #3: [SLD]
// - Opacity: 1.0
// - ChannelSelection: Gray {Contrast Enh: Logarithmic}
//
// ////////////////////////////////////////////////////////////////////
gc = CoverageFactoryFinder.getGridCoverageFactory(null)
.create(
"name",
JAI.create("ImageRead", new File(TestData.url(this, "hs.tif").toURI())),
new GeneralEnvelope(new double[] { -90, -180 },
new double[] { 90, 180 }),new GridSampleDimension[]{new GridSampleDimension("test1BandByte_SLD")},null,null);
surl = TestData.url(this, "logarithmic.sld");
stylereader = new SLDParser(sf, surl);
sld = stylereader.parseSLD();
// the RasterSymbolizer Helper
rsh_SLD = new RasterSymbolizerHelper(gc, null);
// build the RasterSymbolizer
final RasterSymbolizer rs_2 = extractRasterSymbolizer(sld);
// visit the RasterSymbolizer
rsh_SLD.visit(rs_2);
testRasterSymbolizerHelper(rsh_SLD);
// ////////////////////////////////////////////////////////////////////
//
// Test #4: [StyleBuilder]
// - Opacity: 1.0
// - ChannelSelection: Gray {Contrast Enh: Logarithmic}
//
// ////////////////////////////////////////////////////////////////////
gc = CoverageFactoryFinder.getGridCoverageFactory(null)
.create(
"name",
JAI.create("ImageRead", new File(TestData.url(this, "hs.tif").toURI())),
new GeneralEnvelope(new double[] { -90, -180 },
new double[] { 90, 180 }));
// the RasterSymbolizer Helper
rsh_StyleBuilder = new RasterSymbolizerHelper(gc, null);
// build the RasterSymbolizer
sldBuilder = new StyleBuilder();
// the RasterSymbolizer Helper
rsh_StyleBuilder = new RasterSymbolizerHelper(gc, null);
final RasterSymbolizer rsb_2 = sldBuilder.createRasterSymbolizer();
final ChannelSelection chSel_2 = new ChannelSelectionImpl();
final SelectedChannelType chTypeGray_2 = new SelectedChannelTypeImpl();
final ContrastEnhancement cntEnh_2 = new ContrastEnhancementImpl();
cntEnh_2.setLogarithmic();
//cntEnh.setType(type);
//cntEnh.setGammaValue(sldBuilder.literalExpression(0.50));
chTypeGray_2.setChannelName("1");
chTypeGray_2.setContrastEnhancement(cntEnh_2);
chSel_2.setGrayChannel(chTypeGray_2);
rsb_2.setChannelSelection(chSel_2);
rsb_2.setOpacity(sldBuilder.literalExpression(1.0));
// visit the RasterSymbolizer
rsh_StyleBuilder.visit(rsb_2);
testRasterSymbolizerHelper(rsh_StyleBuilder);
// ////////////////////////////////////////////////////////////////////
//
// Test #5: [SLD]
// - Opacity: 1.0
// - ChannelSelection: Gray {Contrast Enh: Hyperbolic}
//
// ////////////////////////////////////////////////////////////////////
gc = CoverageFactoryFinder.getGridCoverageFactory(null)
.create(
"name",
JAI.create("ImageRead", new File(TestData.url(this, "hs.tif").toURI())),
new GeneralEnvelope(new double[] { -90, -180 },
new double[] { 90, 180 }),new GridSampleDimension[]{new GridSampleDimension("test1BandByte_SLD")},null,null);
surl = TestData.url(this, "exponential.sld");
stylereader = new SLDParser(sf, surl);
sld = stylereader.parseSLD();
// the RasterSymbolizer Helper
rsh_SLD = new RasterSymbolizerHelper(gc, null);
// build the RasterSymbolizer
final RasterSymbolizer rs_3 = extractRasterSymbolizer(sld);
// visit the RasterSymbolizer
rsh_SLD.visit(rs_3);
testRasterSymbolizerHelper(rsh_SLD);
// ////////////////////////////////////////////////////////////////////
//
// Test #6: [StyleBuilder]
// - Opacity: 1.0
// - ChannelSelection: Gray {Contrast Enh: Hyperbolic}
//
// ////////////////////////////////////////////////////////////////////
gc = CoverageFactoryFinder.getGridCoverageFactory(null)
.create(
"name",
JAI.create("ImageRead", new File(TestData.url(this, "hs.tif").toURI())),
new GeneralEnvelope(new double[] { -90, -180 },
new double[] { 90, 180 }),new GridSampleDimension[]{new GridSampleDimension("test1BandByte_SLD")},null,null);
// the RasterSymbolizer Helper
rsh_StyleBuilder = new RasterSymbolizerHelper(gc, null);
// build the RasterSymbolizer
sldBuilder = new StyleBuilder();
// the RasterSymbolizer Helper
rsh_StyleBuilder = new RasterSymbolizerHelper(gc, null);
final RasterSymbolizer rsb_3 = sldBuilder.createRasterSymbolizer();
final ChannelSelection chSel_3 = new ChannelSelectionImpl();
final SelectedChannelType chTypeGray_3 = new SelectedChannelTypeImpl();
final ContrastEnhancement cntEnh_3 = new ContrastEnhancementImpl();
cntEnh_3.setExponential();
//cntEnh.setType(type);
//cntEnh.setGammaValue(sldBuilder.literalExpression(0.50));
chTypeGray_3.setChannelName("1");
chTypeGray_3.setContrastEnhancement(cntEnh_3);
chSel_3.setGrayChannel(chTypeGray_3);
rsb_3.setChannelSelection(chSel_3);
rsb_3.setOpacity(sldBuilder.literalExpression(1.0));
rsb_3.setOverlap(sldBuilder.literalExpression("AVERAGE"));