@Override public void setTo( org.geotools.styling.ChannelSelection sel, org.geotools.styling.SelectedChannelType chan) { org.geotools.styling.SelectedChannelType channels[] = sel.getRGBChannels(); channels[1] = chan; sel.setRGBChannels(channels); } },
@Override public void setTo( org.geotools.styling.ChannelSelection sel, org.geotools.styling.SelectedChannelType chan) { org.geotools.styling.SelectedChannelType channels[] = sel.getRGBChannels(); channels[0] = chan; sel.setRGBChannels(channels); } },
@Override public void setTo( org.geotools.styling.ChannelSelection sel, org.geotools.styling.SelectedChannelType chan) { org.geotools.styling.SelectedChannelType channels[] = sel.getRGBChannels(); channels[2] = chan; sel.setRGBChannels(channels); } };
protected ChannelSelection copy(ChannelSelection channelSelection) { if (channelSelection == null) return null; SelectedChannelType[] channels = copy(channelSelection.getSelectedChannels()); ChannelSelection copy = sf.createChannelSelection(channels); copy.setGrayChannel(copy(channelSelection.getGrayChannel())); copy.setRGBChannels(copy(channelSelection.getRGBChannels())); return copy; }
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { ChannelSelection cs = styleFactory.createChannelSelection(null); if (node.hasChild("GrayChannel")) { cs.setGrayChannel((SelectedChannelType) node.getChildValue("GrayChannel")); } else { SelectedChannelType[] rgb = new SelectedChannelType[] { (SelectedChannelType) node.getChildValue("RedChannel"), (SelectedChannelType) node.getChildValue("GreenChannel"), (SelectedChannelType) node.getChildValue("BlueChannel") }; cs.setRGBChannels(rgb); } return cs; } }
@Override public void handle(YamlObject<?> obj, YamlParseContext context) { YamlMap map = obj.map(); if (map.has(Band.GRAY.key)) { if (map.has(Band.RED.key) || map.has(Band.GREEN.key) || map.has(Band.BLUE.key)) throw new IllegalArgumentException("grey and RGB can not be combined"); SelectedChannelType gray = factory.style.selectedChannelType((String) null, null); selection.setGrayChannel(gray); parse(Band.GRAY, gray, map, context); } else { if (!(map.has(Band.RED.key) && map.has(Band.GREEN.key) && map.has(Band.BLUE.key))) throw new IllegalArgumentException("all of red green and blue must be preset"); SelectedChannelType red = factory.style.selectedChannelType((String) null, null); SelectedChannelType green = factory.style.selectedChannelType((String) null, null); SelectedChannelType blue = factory.style.selectedChannelType((String) null, null); selection.setRGBChannels(red, green, blue); parse(Band.RED, red, map, context); parse(Band.GREEN, green, map, context); parse(Band.BLUE, blue, map, context); } } }
@Override public void setTo( org.geotools.styling.ChannelSelection sel, org.geotools.styling.SelectedChannelType chan) { org.geotools.styling.SelectedChannelType channels[] = sel.getRGBChannels(); channels[1] = chan; sel.setRGBChannels(channels); } },
@Override public void setTo( org.geotools.styling.ChannelSelection sel, org.geotools.styling.SelectedChannelType chan) { org.geotools.styling.SelectedChannelType channels[] = sel.getRGBChannels(); channels[2] = chan; sel.setRGBChannels(channels); } };
@Override public void setTo( org.geotools.styling.ChannelSelection sel, org.geotools.styling.SelectedChannelType chan) { org.geotools.styling.SelectedChannelType channels[] = sel.getRGBChannels(); channels[0] = chan; sel.setRGBChannels(channels); } },
channels[i].setContrastEnhancement(cntEnh); chSel.setRGBChannels(chTypeRed, chTypeGreen, chTypeBlue);
chTypeBlue.setChannelName("1"); chSel.setRGBChannels(chTypeRed, chTypeGreen, chTypeBlue);
chTypeGreen.setChannelName("3"); chSel.setRGBChannels(chTypeRed, chTypeBlue, chTypeGreen);
private RasterSymbolizer createClippingChannelSelectionSymbolizer(int min, int max) { StyleBuilder sldBuilder = new StyleBuilder(); RasterSymbolizer symbolizer = sldBuilder.createRasterSymbolizer(); final ChannelSelection chSel = new ChannelSelectionImpl(); final SelectedChannelType chTypeRed = new SelectedChannelTypeImpl(); final SelectedChannelType chTypeBlue = new SelectedChannelTypeImpl(); final SelectedChannelType chTypeGreen = new SelectedChannelTypeImpl(); SelectedChannelType[] channels = new SelectedChannelType[] {chTypeRed, chTypeGreen, chTypeBlue}; // Assign a different contrast method for each channel // by offsetting min and max of 20 on each channel // and assigning channels number with increments of 2 for (int i = 0; i < 3; i++) { final ContrastEnhancement cntEnh = new ContrastEnhancementImpl(); final ContrastMethodStrategy method = new NormalizeContrastMethodStrategy(); method.addOption( "algorithm", sldBuilder.literalExpression( ContrastEnhancementType.NORMALIZE_CLIP_TO_ZERO_NAME)); method.addOption("minValue", sldBuilder.literalExpression(min + (20 * i))); method.addOption("maxValue", sldBuilder.literalExpression(max + (20 * i))); cntEnh.setMethod(method); channels[i].setChannelName(Integer.toString((i * 2) + 1)); channels[i].setContrastEnhancement(cntEnh); } chSel.setRGBChannels(chTypeRed, chTypeGreen, chTypeBlue); symbolizer.setChannelSelection(chSel); symbolizer.setOpacity(sldBuilder.literalExpression(1.0)); return symbolizer; }
chTypeGreen.setChannelName("3"); chSel.setRGBChannels(chTypeRed, chTypeBlue, chTypeGreen);
chTypeBlue.setChannelName("2"); chTypeGreen.setChannelName("3"); chSel.setRGBChannels(chTypeRed, chTypeBlue, chTypeGreen); rsb_1.setChannelSelection(chSel); rsb_1.setOpacity(sldBuilder.literalExpression(1.0));
protected ChannelSelection copy(ChannelSelection channelSelection) { if( channelSelection == null ) return null; SelectedChannelType[] channels = copy( channelSelection.getSelectedChannels() ); ChannelSelection copy = sf.createChannelSelection( channels); copy.setGrayChannel( copy( channelSelection.getGrayChannel() )); copy.setRGBChannels( copy( channelSelection.getRGBChannels() )); return copy; }
/** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { ChannelSelection cs = styleFactory.createChannelSelection(null); if (node.hasChild("GrayChannel")) { cs.setGrayChannel((SelectedChannelType) node.getChildValue("GrayChannel")); } else { SelectedChannelType[] rgb = new SelectedChannelType[] { (SelectedChannelType) node.getChildValue("RedChannel"), (SelectedChannelType) node.getChildValue("GreenChannel"), (SelectedChannelType) node.getChildValue("BlueChannel") }; cs.setRGBChannels(rgb); } return cs; } }
/** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { if ((node.getChild("RedChannel") == null) || (node.getChild("BlueChannel") == null) || (node.getChild("GreenChannel") == null) || (node.getChild("GrayChannel") == null)) { String msg = "All of Red,Blue,Green,Gray must be specified"; throw new RuntimeException(msg); } SelectedChannelType[] rgb = new SelectedChannelType[] { (SelectedChannelType) node.getChildValue("RedChannel"), (SelectedChannelType) node.getChildValue("GreenChannel"), (SelectedChannelType) node.getChildValue("BlueChannel") }; SelectedChannelType gray = (SelectedChannelType) node.getChildValue("GrayChannel"); ChannelSelection cs = styleFactory.createChannelSelection(null); cs.setGrayChannel(gray); cs.setRGBChannels(rgb); return cs; } }
@Override public void handle(YamlObject<?> obj, YamlParseContext context) { YamlMap map = obj.map(); if (map.has(Band.GRAY.key)) { if (map.has(Band.RED.key) || map.has(Band.GREEN.key) || map.has(Band.BLUE.key)) throw new IllegalArgumentException("grey and RGB can not be combined"); SelectedChannelType gray = factory.style.selectedChannelType((String) null, null); selection.setGrayChannel(gray); parse(Band.GRAY, gray, map, context); } else { if (!(map.has(Band.RED.key) && map.has(Band.GREEN.key) && map.has(Band.BLUE.key))) throw new IllegalArgumentException("all of red green and blue must be preset"); SelectedChannelType red = factory.style.selectedChannelType((String) null, null); SelectedChannelType green = factory.style.selectedChannelType((String) null, null); SelectedChannelType blue = factory.style.selectedChannelType((String) null, null); selection.setRGBChannels(red, green, blue); parse(Band.RED, red, map, context); parse(Band.GREEN, green, map, context); parse(Band.BLUE, blue, map, context); } } }
blue.setChannelName("1"); cs.setRGBChannels(new SelectedChannelType[] {red, green, blue}); symbolizer.setChannelSelection(cs);