/** * 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; }
/** * 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; }
/** * 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 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); }
/** * 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 DefaultCoverageDescription instance = new DefaultCoverageDescription(); assertNull("Shall be initially empty.", accessor.set(indexOfDeprecated, instance, CoverageContentType.IMAGE, PropertyAccessor.RETURN_PREVIOUS));