.create(
"name",
JAI.create("ImageRead", TestData.file(this,"smalldem.tif")),
envelope,new GridSampleDimension[]{new GridSampleDimension("dem")},null,null);
SubchainStyleVisitorCoverageProcessingAdapter rsh = new RasterSymbolizerHelper(gc, null);
final RasterSymbolizer rs = extractRasterSymbolizer(sld);
rsh.visit(rs);
testRasterSymbolizerHelper(rsh);
////
//
// Test using stylebuilder
//
////
gc = CoverageFactoryFinder.getGridCoverageFactory(null)
.create(
"name",
JAI.create("ImageRead", TestData.file(this,"smalldem.tif")),
new GeneralEnvelope(new double[] { -90, -180 },
new double[] { 90, 180 }));
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();
chTypeGray.setChannelName("1");
chSel.setGrayChannel(chTypeGray);
rsb_1.setChannelSelection(chSel);
rsb_1.setOpacity(sldBuilder.literalExpression(1.0));
final ColorMap cm = sldBuilder.createColorMap(
new String[] { // labels
"category",
"category",
"category"
},
new double[] { // quantities
0.1,
50.0,
200.0
},
new Color[] { // colors with alpha
new Color(255,0,0,255),
new Color(0,255,0,40),
new Color(0,0,255,125)
},
ColorMap.TYPE_RAMP);
rsb_1.setColorMap(cm);
// visit the RasterSymbolizer
rsh.visit(rsb_1);
testRasterSymbolizerHelper(rsh);