public ChannelSelection build() { if (unset) { return null; } ChannelSelection result; if (gray.isUnset()) { result = sf.channelSelection(red.build(), green.build(), blue.build()); } else { result = sf.channelSelection(gray.build()); } if (parent == null) { reset(); } return result; }
private Style createCoverageStyle(String bandName) { StyleFactory sf = CommonFactoryFinder.getStyleFactory(null); FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null); ContrastEnhancement ce = sf.contrastEnhancement(ff.literal(1.0), ContrastMethod.NORMALIZE); SelectedChannelType sct = sf.createSelectedChannelType(bandName, ce); RasterSymbolizer sym = sf.getDefaultRasterSymbolizer(); ChannelSelection sel = sf.channelSelection(sct); sym.setChannelSelection(sel); return SLD.wrapSymbolizers(sym); }
private Style createEnvCoverageStyle(String bandName) { StyleFactory sf = CommonFactoryFinder.getStyleFactory(null); FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null); ContrastEnhancement ce = sf.contrastEnhancement( ff.function("env", ff.literal("gamma"), ff.literal(1)), ContrastMethod.NORMALIZE); SelectedChannelType sct = sf.createSelectedChannelType(bandName, ce); RasterSymbolizer sym = sf.getDefaultRasterSymbolizer(); ChannelSelection sel = sf.channelSelection(sct); sym.setChannelSelection(sel); return SLD.wrapSymbolizers(sym); }
@Test public void testGrayBandSelection() throws Exception { StyleFactory factory = CommonFactoryFinder.getStyleFactory(); RasterSymbolizer r = factory.createRasterSymbolizer(); ChannelSelection sel = factory.channelSelection( factory.createSelectedChannelType( "foo", factory.createContrastEnhancement())); r.setChannelSelection(sel); StringWriter out = new StringWriter(); Ysld.encode(sld(r), out); YamlMap obj = new YamlMap(YamlUtil.getSafeYaml().load(out.toString())); YamlMap channelMap = obj.seq("feature-styles") .map(0) .seq("rules") .map(0) .seq("symbolizers") .map(0) .map("raster") .map("channels"); assertThat(channelMap, yHasEntry("gray")); assertThat(channelMap, not(yHasEntry("red"))); assertThat(channelMap, not(yHasEntry("green"))); assertThat(channelMap, not(yHasEntry("blue"))); assertThat(channelMap.map("gray"), yHasEntry("name", equalTo("foo"))); assertThat(channelMap.map("gray"), not(yHasEntry("contrast-enhancement"))); }
RasterSymbolizer r = styleFactory.createRasterSymbolizer(); ChannelSelection sel = styleFactory.channelSelection( styleFactory.createSelectedChannelType( "foo",
RasterSymbolizer r = styleFactory.createRasterSymbolizer(); ChannelSelection sel = styleFactory.channelSelection( styleFactory.createSelectedChannelType( "foo", styleFactory.createContrastEnhancement()),
RasterSymbolizer r = factory.createRasterSymbolizer(); ChannelSelection sel = factory.channelSelection( factory.createSelectedChannelType( "foo", factory.createContrastEnhancement()),
private Style createEnvMinMaxCoverageStyle(String bandName) { StyleFactory sf = CommonFactoryFinder.getStyleFactory(null); FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null); ContrastEnhancement ce = sf.contrastEnhancement(ff.literal(1.0), ContrastMethod.NORMALIZE); ce.addOption("algorithm", ff.literal("StretchToMinimumMaximum")); ce.addOption("minValue", ff.function("env", ff.literal("range_min"), ff.literal(0))); ce.addOption("maxValue", ff.function("env", ff.literal("range_max"), ff.literal(220))); SelectedChannelType sct = sf.createSelectedChannelType(bandName, ce); RasterSymbolizer sym = sf.getDefaultRasterSymbolizer(); ChannelSelection sel = sf.channelSelection(sct); sym.setChannelSelection(sel); return SLD.wrapSymbolizers(sym); } }
sct[i] = sf.createSelectedChannelType(String.valueOf(channelNum[i]), ce); ChannelSelection sel = sf.channelSelection(sct[RED], sct[GREEN], sct[BLUE]); sym.setChannelSelection(sel);
ChannelSelection sel = sf.channelSelection(sct[RED], sct[GREEN], sct[BLUE]); sym.setChannelSelection(sel);