/** * 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 DefaultImageDescription}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultImageDescription} instance is created using the * {@linkplain #DefaultImageDescription(ImageDescription) 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 DefaultImageDescription castOrCopy(final ImageDescription object) { if (object == null || object instanceof DefaultImageDescription) { return (DefaultImageDescription) object; } return new DefaultImageDescription(object); }
/** * Invoked by JAXB at unmarshalling time. */ @SuppressWarnings("unused") private void setProcessingLevel(final Identifier newValue) { setProcessingLevelCode(newValue); } }
/** * Sets the indication of whether or not triangulation has been performed upon the image. * * @param newValue the new triangulation indicator. */ public void setTriangulationIndicator(final Boolean newValue) { checkWritePermission(); triangulationIndicator = newValue; }
/** * Creates a metadata sample with 3 content information of different kind. */ private static DefaultMetadata createSample1() { final DefaultFeatureCatalogueDescription features = new DefaultFeatureCatalogueDescription(); final DefaultCoverageDescription coverage = new DefaultCoverageDescription(); final DefaultImageDescription image = new DefaultImageDescription(); final DefaultMetadata metadata = new DefaultMetadata(); features.setFeatureCatalogueCitations(Collections.singleton(new DefaultCitation("Shapefile"))); features.setIncludedWithDataset(Boolean.TRUE); metadata.getContentInfo().add(features); coverage.setProcessingLevelCode(new DefaultIdentifier("Level 1")); metadata.getContentInfo().add(coverage); image.setImagingCondition(ImagingCondition.CLOUD); image.setCloudCoverPercentage(0.8); metadata.getContentInfo().add(image); metadata.getLanguages().add(Locale.JAPANESE); metadata.getCharacterSets().add(StandardCharsets.UTF_16); return metadata; }
final DefaultImageDescription contentInfo = new DefaultImageDescription(); contentInfo.setCloudCoverPercentage(50.0); metadata.setContentInfo(singleton(contentInfo));
/** * Tests the formatting of a {@link DefaultImageDescription} object. */ @Test public void testImageDescription() { final DefaultImageDescription image = new DefaultImageDescription(); image.setAttributeGroups(Arrays.asList( new DefaultAttributeGroup(null, createBand(0.25, 0.26)), new DefaultAttributeGroup(null, createBand(0.28, 0.29)) )); final String text = format.format(image.asTreeTable()); assertMultilinesEquals( "Image description\n" + " ├─Attribute group (1 of 2)\n" + " │ └─Attribute\n" + " │ ├─Max value………………… 0.26\n" + " │ ├─Min value………………… 0.25\n" + " │ └─Units…………………………… centimetre\n" + " └─Attribute group (2 of 2)\n" + " └─Attribute\n" + " ├─Max value………………… 0.29\n" + " ├─Min value………………… 0.28\n" + " └─Units…………………………… centimetre\n", text); }
/** * Creates a metadata sample with content information of different kind in a different order * than the one created by {@link #createSample1()}. */ private static DefaultMetadata createSample2() { final DefaultFeatureCatalogueDescription features = new DefaultFeatureCatalogueDescription(); final DefaultImageDescription image = new DefaultImageDescription(); final DefaultMetadata metadata = new DefaultMetadata(); image.setProcessingLevelCode(new DefaultIdentifier("Level 2")); metadata.getContentInfo().add(image); features.setFeatureCatalogueCitations(Collections.singleton(new DefaultCitation("GPX file"))); features.setIncludedWithDataset(Boolean.TRUE); metadata.getContentInfo().add(features); metadata.getLanguages().add(Locale.FRENCH); return metadata; }
/** * Sets the area of the dataset obscured by clouds, expressed as a percentage of the spatial extent. * This method does nothing if the given value is {@link Double#NaN}. * * <p>This method is available only if {@link #newCoverage(boolean)} has been invoked * with the {@code electromagnetic} parameter set to {@code true}. Storage location is:</p> * * <ul> * <li>{@code metadata/contentInfo/cloudCoverPercentage}</li> * </ul> * * @param value the new cloud percentage, or {@code NaN} for no-operation. * @throws IllegalArgumentException if the given value is out of range. */ public final void setCloudCoverPercentage(final double value) { if (!Double.isNaN(value)) { ((DefaultImageDescription) coverageDescription()).setCloudCoverPercentage(shared(value)); } }
/** * 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 {@link ImageDescription}, 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 DefaultCoverageDescription}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultCoverageDescription} instance is created using the * {@linkplain #DefaultCoverageDescription(CoverageDescription) 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 DefaultCoverageDescription castOrCopy(final CoverageDescription object) { if (object instanceof ImageDescription) { return DefaultImageDescription.castOrCopy((ImageDescription) object); } // Intentionally tested after the sub-interfaces. if (object == null || object instanceof DefaultCoverageDescription) { return (DefaultCoverageDescription) object; } return new DefaultCoverageDescription(object); }
/** * An attribute which was defined in {@code ImageDescription} by ISO 19115:2003, * and which moved to the parent class in ISO 19115:2014 revision. We handle the * two versions separately for proper attribute ordering, and for avoiding this * attribute to be written for subtypes other than {@code ImageDescription}. */ @XmlElement(name = "processingLevelCode", namespace = LegacyNamespaces.GMD) private Identifier getProcessingLevel() { return FilterByVersion.LEGACY_METADATA.accept() ? getProcessingLevelCode() : null; }
/** * Sets the area of the dataset obscured by clouds, expressed as a percentage of the spatial extent. * This method does nothing if the given value is {@link Double#NaN}. * * <p>This method is available only if {@link #newCoverage(boolean)} has been invoked * with the {@code electromagnetic} parameter set to {@code true}. Storage location is:</p> * * <ul> * <li>{@code metadata/contentInfo/cloudCoverPercentage}</li> * </ul> * * @param value the new cloud percentage, or {@code NaN} for no-operation. * @throws IllegalArgumentException if the given value is out of range. */ public final void setCloudCoverPercentage(final double value) { if (!Double.isNaN(value)) { ((DefaultImageDescription) coverageDescription()).setCloudCoverPercentage(shared(value)); } }
/** * 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 {@link ImageDescription}, 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 DefaultCoverageDescription}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultCoverageDescription} instance is created using the * {@linkplain #DefaultCoverageDescription(CoverageDescription) 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 DefaultCoverageDescription castOrCopy(final CoverageDescription object) { if (object instanceof ImageDescription) { return DefaultImageDescription.castOrCopy((ImageDescription) object); } // Intentionally tested after the sub-interfaces. if (object == null || object instanceof DefaultCoverageDescription) { return (DefaultCoverageDescription) object; } return new DefaultCoverageDescription(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 DefaultImageDescription}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultImageDescription} instance is created using the * {@linkplain #DefaultImageDescription(ImageDescription) 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 DefaultImageDescription castOrCopy(final ImageDescription object) { if (object == null || object instanceof DefaultImageDescription) { return (DefaultImageDescription) object; } return new DefaultImageDescription(object); }
/** * Sets the indication of whether or not the radiometric calibration information for generating * the radiometrically calibrated standard data product is available. * * @param newValue {@code true} if radiometric calibration data are available. */ public void setRadiometricCalibrationDataAvailable(final Boolean newValue) { checkWritePermission(radiometricCalibrationDataAvailable); radiometricCalibrationDataAvailable = 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 DefaultImageDescription castOrCopy(final ImageDescription original) { if (original != null && !(original instanceof MI_ImageDescription)) { if (!isNullOrEmpty(original.getRangeElementDescriptions())) { return new MI_ImageDescription(original); } } return DefaultImageDescription.castOrCopy(original); } }
/** * Creates the coverage description object if it does not already exists, then returns it. * * @return the coverage description (never {@code null}). * @see #newCoverage(boolean) */ private DefaultCoverageDescription coverageDescription() { if (coverageDescription == null) { coverageDescription = electromagnetic ? new DefaultImageDescription() : new DefaultCoverageDescription(); } return coverageDescription; }
/** * Sets the indication of whether or not the radiometric calibration information for generating * the radiometrically calibrated standard data product is available. * * @param newValue {@code true} if radiometric calibration data are available. */ public void setRadiometricCalibrationDataAvailable(final Boolean newValue) { checkWritePermission(); radiometricCalibrationDataAvailable = 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 DefaultImageDescription castOrCopy(final ImageDescription original) { if (original != null && !(original instanceof MI_ImageDescription)) { if (!isNullOrEmpty(original.getRangeElementDescriptions())) { return new MI_ImageDescription(original); } } return DefaultImageDescription.castOrCopy(original); } }
/** * Creates the coverage description object if it does not already exists, then returns it. * * @return the coverage description (never {@code null}). * @see #newCoverage(boolean) */ private DefaultCoverageDescription coverageDescription() { if (coverageDescription == null) { coverageDescription = electromagnetic ? new DefaultImageDescription() : new DefaultCoverageDescription(); } return coverageDescription; }
/** * Sets the conditions that affected the image. * * @param newValue the new imaging condition. */ public void setImagingCondition(final ImagingCondition newValue) { checkWritePermission(); imagingCondition = newValue; }