public void visit(SelectedChannelType sct) { final SelectedChannelType copy = sf.createSelectedChannelType( sct.getChannelName(), copy(sct.getContrastEnhancement())); if (STRICT && !copy.equals(sct)) { throw new IllegalStateException( "Was unable to duplicate provided SelectedChannelType:" + sct); } pages.push(copy); }
public void visit(SelectedChannelType sct) { // ///////////////////////////////////////////////////////////////////// // // If a SelectedChannelType was provided, let's try to parse it. // // ///////////////////////////////////////////////////////////////////// if (sct != null) { try { bandIndex = sct.getChannelName().evaluate(null, Integer.class); } catch (NumberFormatException e) { // something bad happened final IllegalArgumentException iee = new IllegalArgumentException( Errors.format( ErrorKeys.BAD_BAND_NUMBER_$1, Integer.valueOf(bandIndex))); iee.initCause(e); throw iee; } return; } // ///////////////////////////////////////////////////////////////////// // // If no SelectedChannelType was provided, let's just forward the // source. // // ///////////////////////////////////////////////////////////////////// // do nothing }
public void visit(SelectedChannelType sct) { element("SourceChannelName", sct.getChannelName()); final ContrastEnhancement ce = sct.getContrastEnhancement(); if (ce != null) ce.accept(this); }
public SelectedChannelTypeBuilder reset(SelectedChannelType selectedChannelType) { if (selectedChannelType == null) { return reset(); } contrastEnhancement.reset(selectedChannelType.getContrastEnhancement()); channelName = selectedChannelType.getChannelName(); unset = false; return this; }
protected SelectedChannelType copy(SelectedChannelType selectedChannelType) { if (selectedChannelType == null) return null; ContrastEnhancement enhancement = copy(selectedChannelType.getContrastEnhancement()); Expression name = (Expression) selectedChannelType.getChannelName().accept(copyFilter, null); SelectedChannelType copy = sf.createSelectedChannelType(name, enhancement); return copy; }
/** * 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; } }
@Override protected void encode(SelectedChannelType channel) { push(band.key); put("name", channel.getChannelName().evaluate(null, String.class)); if (!emptyContrastEnhancement(channel.getContrastEnhancement())) { inline(new ContrastEnhancementEncoder(channel.getContrastEnhancement())); } } }
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { if (value != null && value instanceof SelectedChannelType) { selected = (SelectedChannelType) value; but.setText(selected.getChannelName()); } else { selected = null; } return but; }
@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JLabel lbl = (JLabel) super.getTableCellRendererComponent(table, text, isSelected, hasFocus, row, column); SelectedChannelType s = (SelectedChannelType) value; lbl.setText(s.getChannelName()); return lbl; } }
LOGGER.fine("Channel " + i + " was " + channel.getChannelName());
@Override public void populate(SelectedChannelType channelType) { if (channelType != null) { Expression channelName = channelType.getChannelName(); fieldConfigVisitor.populateField(this.fieldId, channelName); } }
public void setBand(final SelectedChannelType grayChannel) { if (grayChannel != null) this.grayChannelName = grayChannel.getChannelName().evaluate(null, String.class); if (grayChannelName == null) this.grayChannelName = LegendUtils.DEFAULT_CHANNEL_NAME; }
@Override public void populate(SelectedChannelType channelType) { if (channelType != null) { Expression channelName = channelType.getChannelName(); fieldConfigVisitor.populateTextField(this.fieldId, channelName.toString()); } }
public void visit(SelectedChannelType sct) { final SelectedChannelType copy = sf.createSelectedChannelType(sct.getChannelName(), copy(sct.getContrastEnhancement())); if (STRICT && !copy.equals(sct)) { throw new IllegalStateException("Was unable to duplicate provided SelectedChannelType:" + sct); } pages.push(copy); }
.equalsIgnoreCase( postBandSelectionChannel .getChannelName() .evaluate(null, String.class))); assertTrue(method.name().equalsIgnoreCase(ContrastMethod.NORMALIZE.name()));
public void setEdited(SelectedChannelType channel) { this.channel = channel; if (channel != null) { guiName.setText(channel.getChannelName()); guiContrast.setEdited(channel.getContrastEnhancement()); } }
/** * Test to ensure that updating the channels duplicates the raster sybmolizer with the new rgb * channels */ public void testSetRasterRGBChannels() { RasterSymbolizer rs = sb.createRasterSymbolizer(); Style s = sb.createStyle(rs); SelectedChannelType red = sf.createSelectedChannelType("red", sf.createContrastEnhancement(ff.literal(0.2))); SelectedChannelType green = sf.createSelectedChannelType( "green", sf.createContrastEnhancement(ff.literal(0.4))); SelectedChannelType blue = sf.createSelectedChannelType("blue", sf.createContrastEnhancement(ff.literal(0.7))); SLD.setChannelSelection(s, new SelectedChannelType[] {red, green, blue}, null); assertNull(SLD.rasterSymbolizer(s).getChannelSelection().getGrayChannel()); assertNotNull(SLD.rasterSymbolizer(s).getChannelSelection().getRGBChannels()); SelectedChannelType[] selectedChannels = SLD.rasterSymbolizer(s).getChannelSelection().getRGBChannels(); assertEquals("red", selectedChannels[0].getChannelName().evaluate(null, String.class)); assertEquals("green", selectedChannels[1].getChannelName().evaluate(null, String.class)); assertEquals("blue", selectedChannels[2].getChannelName().evaluate(null, String.class)); assertNotSame(SLD.rasterSymbolizer(s), rs); } }
protected SelectedChannelType copy(SelectedChannelType selectedChannelType) { if( selectedChannelType == null ) return null; ContrastEnhancement enhancement = copy( selectedChannelType.getContrastEnhancement() ); String name = selectedChannelType.getChannelName(); SelectedChannelType copy = sf.createSelectedChannelType( name, enhancement); return copy; }
public void visit(SelectedChannelType sct) { element("SourceChannelName", sct.getChannelName()); final ContrastEnhancement ce = sct.getContrastEnhancement(); if (ce != null) ce.accept(this); }
@Override protected void encode(SelectedChannelType channel) { push(band.key); put("name", channel.getChannelName().evaluate(null, String.class)); if (!emptyContrastEnhancement(channel.getContrastEnhancement())) { inline(new ContrastEnhancementEncoder(channel.getContrastEnhancement())); } } }