@Override protected ChannelSelection copy(ChannelSelection channelSelection) { if (channels.length != 3) { return sf.createChannelSelection(new SelectedChannelType[] {channels[0]}); } else { return sf.createChannelSelection(channels); } }
private ChannelSelection createChannelSelection() { if (rgb == null) { return sf.createChannelSelection( new SelectedChannelType[] {gray}); } else { return sf.createChannelSelection(rgb); } } };
public void visit(ChannelSelection cs) { // get the channels final SelectedChannelType sct[] = copy(cs.getSelectedChannels()); final ChannelSelection copy = sf.createChannelSelection(sct); if (STRICT && !copy.equals(cs)) { throw new IllegalStateException( "Was unable to duplicate provided ChannelSelection:" + cs); } pages.push(copy); }
/** Internal parse method - made protected for unit testing */ protected ChannelSelection parseChannelSelection(Node root) { List<SelectedChannelType> channels = new ArrayList<SelectedChannelType>(); NodeList children = root.getChildNodes(); final int length = children.getLength(); for (int i = 0; i < length; i++) { Node child = children.item(i); if ((child == null) || (child.getNodeType() != Node.ELEMENT_NODE)) { continue; } String childName = child.getLocalName(); if (childName == null) { childName = child.getNodeName(); } else if (childName.equalsIgnoreCase("GrayChannel")) { channels.add(parseSelectedChannel(child)); } else if (childName.equalsIgnoreCase("RedChannel")) { channels.add(parseSelectedChannel(child)); } else if (childName.equalsIgnoreCase("GreenChannel")) { channels.add(parseSelectedChannel(child)); } else if (childName.equalsIgnoreCase("BlueChannel")) { channels.add(parseSelectedChannel(child)); } } ChannelSelection dap = factory.createChannelSelection( channels.toArray(new SelectedChannelType[channels.size()])); return dap; }
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; }
private RasterSymbolizer buildChannelSelectingSymbolizer(int band) { StyleBuilder sb = new StyleBuilder(); RasterSymbolizer symbolizer = sb.createRasterSymbolizer(); StyleFactory sf = sb.getStyleFactory(); symbolizer.setChannelSelection( sf.createChannelSelection( new SelectedChannelType[] { sf.createSelectedChannelType( String.valueOf(band), (ContrastEnhancement) null) })); return symbolizer; }
private ChannelSelection createChannelSelection() { if (rgb == null) { return sf.createChannelSelection(new SelectedChannelType[]{gray}); } else { return sf.createChannelSelection(rgb); } } };
/** * * <!-- 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; } }
public void visit(ChannelSelection cs) { //get the channels final SelectedChannelType sct[] = copy(cs.getSelectedChannels()); final ChannelSelection copy = sf.createChannelSelection(sct); if (STRICT && !copy.equals(cs)) { throw new IllegalStateException("Was unable to duplicate provided ChannelSelection:" + cs); } pages.push(copy); }
/** * Build a Symbolizer with ENV function ChannelName * * @param envVar * @param band * @return */ private RasterSymbolizer buildEnvChannelSelectingSymbolizer(String envVar, int band) { StyleBuilder sb = new StyleBuilder(); RasterSymbolizer symbolizer = sb.createRasterSymbolizer(); StyleFactory sf = sb.getStyleFactory(); final FilterFactory ff = CommonFactoryFinder.getFilterFactory(null); symbolizer.setChannelSelection( sf.createChannelSelection( new SelectedChannelType[] { sf.createSelectedChannelType( ff.function("env", ff.literal(envVar), ff.literal(band)), (ContrastEnhancement) null) })); return symbolizer; }
/** Internal parse method - made protected for unit testing */ protected ChannelSelection parseChannelSelection(Node root) { List<SelectedChannelType> channels = new ArrayList<SelectedChannelType>(); NodeList children = root.getChildNodes(); final int length = children.getLength(); for (int i = 0; i < length; i++) { Node child = children.item(i); if ((child == null) || (child.getNodeType() != Node.ELEMENT_NODE)) { continue; } String childName = child.getLocalName(); if (childName == null) { childName = child.getNodeName(); } else if (childName.equalsIgnoreCase("GrayChannel")) { channels.add(parseSelectedChannel(child)); } else if (childName.equalsIgnoreCase("RedChannel")) { channels.add(parseSelectedChannel(child)); } else if (childName.equalsIgnoreCase("GreenChannel")) { channels.add(parseSelectedChannel(child)); } else if (childName.equalsIgnoreCase("BlueChannel")) { channels.add(parseSelectedChannel(child)); } } ChannelSelection dap = factory.createChannelSelection((SelectedChannelType[]) channels .toArray(new SelectedChannelType[channels.size()])); return dap; }
ChannelSelection dap = factory.createChannelSelection((SelectedChannelType[])channels.toArray(new SelectedChannelType[channels.size()]));
/** * Create a Style to display the specified band of the GeoTIFF image * as a greyscale layer. * <p> * This method is a helper for createGreyScale() and is also called directly * by the displayLayers() method when the application first starts. * * @param band the image band to use for the greyscale display * * @return a new Style instance to render the image in greyscale */ private Style createGreyscaleStyle(int band) { ContrastEnhancement ce = sf.createContrastEnhancement(); SelectedChannelType sct = sf.createSelectedChannelType(String.valueOf(band), ce); RasterSymbolizer sym = sf.getDefaultRasterSymbolizer(); ChannelSelection sel = sf.createChannelSelection(new SelectedChannelType[]{sct}); sym.setChannelSelection(sel); sym.setOpacity(new OpacityExp(0.5)); return SLD.wrapSymbolizers(sym); }
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; } }