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); }
public void visit(ChannelSelection cs) { if (cs == null) return; start("ChannelSelection"); final SelectedChannelType[] sct = cs.getSelectedChannels(); for (int i = 0; i < sct.length && sct != null; i++) visit(sct[i]); end("ChannelSelection"); }
/** * Returns an int[] containing the indices of the coverage bands that are used for the * symbolizer's selection channels * * @param symbolizer The input symbolizer * @return the band indices array (null if no channel selection was present in symbolizer) */ public static int[] getBandIndicesFromSelectionChannels(RasterSymbolizer symbolizer) { int[] bandIndices = null; ChannelSelection channelSelection = symbolizer.getChannelSelection(); if (channelSelection != null) { SelectedChannelType[] channels = channelSelection.getSelectedChannels(); if (channels != null) { bandIndices = new int[channels.length]; for (int i = 0; i < channels.length; i++) { // Note that in channel selection, channels start at index 1 bandIndices[i] = channels[i].getChannelName().evaluate(null, Integer.class) - 1; } } } return bandIndices; } }
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; }
/** * Takes into account that the band selection has been delegated down to the reader by producing * a new channel selection * * @param symbolizer * @return */ public static RasterSymbolizer setupSymbolizerForBandsSelection(RasterSymbolizer symbolizer) { ChannelSelection selection = symbolizer.getChannelSelection(); final SelectedChannelType[] originalChannels = selection.getSelectedChannels(); if (originalChannels != null) { int i = 0; SelectedChannelType[] channels = new SelectedChannelType[originalChannels.length]; for (SelectedChannelType originalChannel : originalChannels) { // Remember, channel indices start from 1 SelectedChannelTypeImpl channel = new SelectedChannelTypeImpl(); channel.setChannelName(Integer.toString(i + 1)); channel.setContrastEnhancement(originalChannel.getContrastEnhancement()); channels[i] = channel; i++; } ChannelSelectionUpdateStyleVisitor channelsUpdateVisitor = new ChannelSelectionUpdateStyleVisitor(channels); symbolizer.accept(channelsUpdateVisitor); return (RasterSymbolizer) channelsUpdateVisitor.getCopy(); } return symbolizer; }
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); }
public void visit(ChannelSelection cs) { if(cs==null) return; start("ChannelSelection"); final SelectedChannelType[] sct = cs.getSelectedChannels(); for (int i = 0; i < sct.length && sct != null; i++) visit(sct[i]); end("ChannelSelection"); }
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; }