/** * Returns a SIS metadata implementation with the values of the given arbitrary implementation. * This method performs the first applicable action in the following choices: * * <ul> * <li>If the given object is {@code null}, then this method returns {@code null}.</li> * <li>Otherwise if the given object is already an instance of * {@code DefaultBand}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultBand} instance is created using the * {@linkplain #DefaultBand(Band) copy constructor} * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other * metadata contained in the given object are not recursively copied.</li> * </ul> * * @param object the object to get as a SIS implementation, or {@code null} if none. * @return a SIS implementation containing the values of the given object (may be the * given object itself), or {@code null} if the argument was null. */ public static DefaultBand castOrCopy(final Band object) { if (object == null || object instanceof DefaultBand) { return (DefaultBand) object; } return new DefaultBand(object); }
/** * Sets designation of criterion for defining maximum and minimum wavelengths for a spectral band. * * @param newValue the new band definition. */ public void setBandBoundaryDefinition(final BandDefinition newValue) { checkWritePermission(); bandBoundaryDefinition = newValue; }
/** * Creates a band for the given minimum and maximum wavelengths, in centimetres. */ private static DefaultBand createBand(final double min, final double max) { final DefaultBand band = new DefaultBand(); band.setMinValue(min); band.setMaxValue(max); band.setUnits(Units.CENTIMETRE); return band; }
/** * Returns the band at the given index, creating it if needed. * If the given index is out of range, then this method logs a warning and returns {@code null}. * * @param key the key without its band number. Used only for formatting warning messages. * @param index the band index. */ private DefaultBand band(final String key, int index) { if (index < 1 || index > BAND_NAMES.length) { listeners.warning(errors().getString(Errors.Keys.UnexpectedValueInElement_2, key + index, index), null); return null; } DefaultBand band = bands[--index]; if (band == null) { band = new DefaultBand(); band.setDescription(new SimpleInternationalString(BAND_NAMES[index])); band.setPeakResponse((double) WAVELENGTHS[index]); band.setBoundUnits(Units.NANOMETRE); bands[index] = band; } return band; }
final DefaultBand db = band(key, band); if (db != null) { db.getNames().add(new DefaultIdentifier(value)); final DefaultBand db = band(key, band); if (db != null) { db.setMinValue(v); final DefaultBand db = band(key, band); if (db != null) { db.setMaxValue(v);
if (object instanceof DefaultBand) { final DefaultBand c = (DefaultBand) object; boundMin = c.getBoundMin(); boundMax = c.getBoundMax(); boundUnits = c.getBoundUnits();
/** * Returns a SIS metadata implementation with the values of the given arbitrary implementation. * This method performs the first applicable action in the following choices: * * <ul> * <li>If the given object is {@code null}, then this method returns {@code null}.</li> * <li>Otherwise if the given object is an instance of {@code SampleDimension}, then this method * delegates to the {@code castOrCopy(…)} method of the corresponding SIS subclass.</li> * <li>Otherwise if the given object is already an instance of * {@code DefaultRangeDimension}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultRangeDimension} instance is created using the * {@linkplain #DefaultRangeDimension(RangeDimension) copy constructor} * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other * metadata contained in the given object are not recursively copied.</li> * </ul> * * @param object the object to get as a SIS implementation, or {@code null} if none. * @return a SIS implementation containing the values of the given object (may be the * given object itself), or {@code null} if the argument was null. */ public static DefaultRangeDimension castOrCopy(final RangeDimension object) { if (object instanceof Band) { return DefaultBand.castOrCopy((Band) object); } // Intentionally tested after the sub-interfaces. if (object == null || object instanceof DefaultRangeDimension) { return (DefaultRangeDimension) object; } return new DefaultRangeDimension(object); }
/** * Returns the band at the given index, creating it if needed. * If the given index is out of range, then this method logs a warning and returns {@code null}. * * @param key the key without its band number. Used only for formatting warning messages. * @param index the band index. */ private DefaultBand band(final String key, int index) { if (index < 1 || index > BAND_NAMES.length) { listeners.warning(errors().getString(Errors.Keys.UnexpectedValueInElement_2, key + index, index), null); return null; } DefaultBand band = bands[--index]; if (band == null) { band = new DefaultBand(); band.setDescription(new SimpleInternationalString(BAND_NAMES[index])); band.setPeakResponse((double) WAVELENGTHS[index]); band.setBoundUnits(Units.NANOMETRE); bands[index] = band; } return band; }
final DefaultBand db = band(key, band); if (db != null) { db.getNames().add(new DefaultIdentifier(value)); final DefaultBand db = band(key, band); if (db != null) { db.setMinValue(v); final DefaultBand db = band(key, band); if (db != null) { db.setMaxValue(v);
if (object instanceof DefaultBand) { final DefaultBand c = (DefaultBand) object; boundMin = c.getBoundMin(); boundMax = c.getBoundMax(); boundUnits = c.getBoundUnits();
/** * Returns a SIS metadata implementation with the values of the given arbitrary implementation. * This method performs the first applicable action in the following choices: * * <ul> * <li>If the given object is {@code null}, then this method returns {@code null}.</li> * <li>Otherwise if the given object is an instance of {@code SampleDimension}, then this method * delegates to the {@code castOrCopy(…)} method of the corresponding SIS subclass.</li> * <li>Otherwise if the given object is already an instance of * {@code DefaultRangeDimension}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultRangeDimension} instance is created using the * {@linkplain #DefaultRangeDimension(RangeDimension) copy constructor} * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other * metadata contained in the given object are not recursively copied.</li> * </ul> * * @param object the object to get as a SIS implementation, or {@code null} if none. * @return a SIS implementation containing the values of the given object (may be the * given object itself), or {@code null} if the argument was null. */ public static DefaultRangeDimension castOrCopy(final RangeDimension object) { if (object instanceof Band) { return DefaultBand.castOrCopy((Band) object); } // Intentionally tested after the sub-interfaces. if (object == null || object instanceof DefaultRangeDimension) { return (DefaultRangeDimension) object; } return new DefaultRangeDimension(object); }
/** * Returns a SIS metadata implementation with the values of the given arbitrary implementation. * This method performs the first applicable action in the following choices: * * <ul> * <li>If the given object is {@code null}, then this method returns {@code null}.</li> * <li>Otherwise if the given object is already an instance of * {@code DefaultBand}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultBand} instance is created using the * {@linkplain #DefaultBand(Band) copy constructor} * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other * metadata contained in the given object are not recursively copied.</li> * </ul> * * @param object the object to get as a SIS implementation, or {@code null} if none. * @return a SIS implementation containing the values of the given object (may be the * given object itself), or {@code null} if the argument was null. */ public static DefaultBand castOrCopy(final Band object) { if (object == null || object instanceof DefaultBand) { return (DefaultBand) object; } return new DefaultBand(object); }
/** * Sets a new units in which sensor wavelengths are expressed. * * @param newValue the new unit. * * @since 0.5 */ public void setBoundUnits(final Unit<Length> newValue) { checkWritePermission(); boundUnits = newValue; }
/** * Wraps the given metadata into a SIS implementation that can be marshalled, * using the {@code "gmi"} namespace if necessary. * * @param original the original metadata provided by the user. * @return the metadata to marshall. */ public static DefaultBand castOrCopy(final Band original) { if (original != null && !(original instanceof MI_Band)) { if (original.getBandBoundaryDefinition() != null || original.getNominalSpatialResolution() != null || original.getTransferFunctionType() != null || original.getTransmittedPolarization() != null || original.getDetectedPolarization() != null) { return new MI_Band(original); } } return DefaultBand.castOrCopy(original); } }
/** * Sets the polarization of the radiation transmitted. * * @param newValue the new transmitted polarization. */ public void setTransmittedPolarization(final PolarizationOrientation newValue) { checkWritePermission(); transmittedPolarization = newValue; }
/** * Wraps the given metadata into a SIS implementation that can be marshalled, * using the {@code "gmi"} namespace if necessary. * * @param original the original metadata provided by the user. * @return the metadata to marshall. */ public static DefaultBand castOrCopy(final Band original) { if (original != null && !(original instanceof MI_Band)) { if (original.getBandBoundaryDefinition() != null || original.getNominalSpatialResolution() != null || original.getTransferFunctionType() != null || original.getTransmittedPolarization() != null || original.getDetectedPolarization() != null) { return new MI_Band(original); } } return DefaultBand.castOrCopy(original); } }
/** * Sets the polarization of the radiation detected. * * @param newValue the new detected polarization. */ public void setDetectedPolarization(final PolarizationOrientation newValue) { checkWritePermission(); detectedPolarization = newValue; } }
/** * Sets the polarization of the radiation detected. * * @param newValue the new detected polarization. */ public void setDetectedPolarization(final PolarizationOrientation newValue) { checkWritePermission(detectedPolarization); detectedPolarization = newValue; } }
/** * Sets designation of criterion for defining maximum and minimum wavelengths for a spectral band. * * @param newValue the new band definition. */ public void setBandBoundaryDefinition(final BandDefinition newValue) { checkWritePermission(bandBoundaryDefinition); bandBoundaryDefinition = newValue; }
/** * Sets a new units in which sensor wavelengths are expressed. * * @param newValue the new unit. * * @since 0.5 */ public void setBoundUnits(final Unit<Length> newValue) { checkWritePermission(boundUnits); boundUnits = newValue; }