/** * 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 DefaultSource}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultSource} instance is created using the * {@linkplain #DefaultSource(Source) 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 DefaultSource castOrCopy(final Source object) { if (object == null || object instanceof DefaultSource) { return (DefaultSource) object; } return new DefaultSource(object); }
/** * Sets the recommended reference to be used for the source data. * * @param newValue the new source citation. */ public void setSourceCitation(final Citation newValue) { checkWritePermission(sourceCitation); sourceCitation = newValue; }
/** * Constructs a new instance initialized with the values from the specified metadata object. * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the * given object are not recursively copied. * * @param object the metadata to copy values from, or {@code null} if none. * * @see #castOrCopy(Source) */ public DefaultSource(final Source object) { super(object); if (object != null) { description = object.getDescription(); sourceReferenceSystem = object.getSourceReferenceSystem(); sourceCitation = object.getSourceCitation(); sourceSteps = copyCollection(object.getSourceSteps(), ProcessStep.class); processedLevel = object.getProcessedLevel(); resolution = object.getResolution(); if (object instanceof DefaultSource) { sourceSpatialResolution = ((DefaultSource) object).getSourceSpatialResolution(); sourceMetadata = copyCollection(((DefaultSource) object).getSourceMetadata(), Citation.class); scope = ((DefaultSource) object).getScope(); } else { setScaleDenominator(object.getScaleDenominator()); setSourceExtents(object.getSourceExtents()); } } }
/** * Create a lineage to marshal. If {@code extension} is {@code false}, then this method uses * only properties defined in ISO 19115-1. If {@code extension} is {@code true}, then this * method adds an ISO 19115-2 property. */ private static DefaultLineage create(final boolean extension) { final DefaultLineage lineage = new DefaultLineage(); final DefaultSource source = new DefaultSource(); source.setDescription(new SimpleInternationalString("Description of source data level.")); lineage.getSources().add(source); if (extension) { source.setProcessedLevel(new DefaultIdentifier("DummyLevel")); } return lineage; }
/** * Information about the spatial, vertical and temporal extent of the source data. * This method stores the values in the {@linkplain #setScope(Scope) scope}. * * @param newValues the new source extents. * * @deprecated As of ISO 19115:2014, moved to {@link DefaultScope#setExtents(Collection)}. */ @Deprecated public void setSourceExtents(final Collection<? extends Extent> newValues) { checkWritePermission(scope); Scope scope = this.scope; if (!(scope instanceof DefaultScope)) { scope = new DefaultScope(scope); setScope(scope); } ((DefaultScope) scope).setExtents(newValues); }
/** * Sets the denominator of the representative fraction on a source map. * This method stores the value in the * {@linkplain #setSourceSpatialResolution(Resolution) source spatial resolution}. * * @param newValue the new scale denominator. * * @deprecated As of ISO 19115:2014, moved to {@link DefaultResolution#setEquivalentScale(RepresentativeFraction)}. */ @Deprecated public void setScaleDenominator(final RepresentativeFraction newValue) { checkWritePermission(); Resolution resolution = null; if (newValue != null) { resolution = sourceSpatialResolution; if (resolution instanceof DefaultResolution) { ((DefaultResolution) resolution).setEquivalentScale(newValue); } else { resolution = new DefaultResolution(newValue); } } /* * Invoke the non-deprecated setter method only if the reference changed, * for consistency with other deprecated setter methods in metadata module. */ if (resolution != sourceSpatialResolution) { setSourceSpatialResolution(resolution); } }
/** * Returns the information about the spatial, vertical and temporal extent of the source data. * This method fetches the values from the {@linkplain #getScope() scope}. * * @return information about the extent of the source data. * * @deprecated As of ISO 19115:2014, moved to {@link DefaultScope#getExtents()}. */ @Override @Deprecated @XmlElement(name = "sourceExtent") @Dependencies("getScope") public Collection<Extent> getSourceExtents() { Scope scope = getScope(); if (!(scope instanceof DefaultScope)) { if (isModifiable()) { scope = new DefaultScope(scope); this.scope = scope; } else { return Collections.singleton(scope.getExtent()); } } return ((DefaultScope) scope).getExtents(); }
/** * 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 DefaultSource castOrCopy(final Source original) { if (original != null && !(original instanceof LE_Source)) { if (original.getProcessedLevel() != null || original.getResolution() != null) { return new LE_Source(original); } } return DefaultSource.castOrCopy(original); } }
/** * Returns the denominator of the representative fraction on a source map. * This method fetches the value from the * {@linkplain #getSourceSpatialResolution() source spatial resolution}. * * @return representative fraction on a source map, or {@code null}. * * @deprecated As of ISO 19115:2014, moved to {@link DefaultResolution#getEquivalentScale()}. */ @Override @Deprecated @XmlElement(name = "scaleDenominator") @Dependencies("getSourceSpatialResolution") public RepresentativeFraction getScaleDenominator() { final Resolution resolution = getSourceSpatialResolution(); return (resolution != null) ? resolution.getEquivalentScale() : null; }
/** * Invoked by JAXB at both marshalling and unmarshalling time. * This attribute has been added by ISO 19115:2014 standard. * If (and only if) marshalling an older standard version, we omit this attribute. */ @XmlElement(name = "sourceMetadata") private Collection<Citation> getSources() { return FilterByVersion.CURRENT_METADATA.accept() ? getSourceMetadata() : null; } }
/** * Returns the information about the spatial, vertical and temporal extent of the source data. * This method fetches the values from the {@linkplain #getScope() scope}. * * @return information about the extent of the source data. * * @deprecated As of ISO 19115:2014, moved to {@link DefaultScope#getExtents()}. */ @Override @Deprecated @Dependencies("getScope") @XmlElement(name = "sourceExtent", namespace = LegacyNamespaces.GMD) public Collection<Extent> getSourceExtents() { if (FilterByVersion.LEGACY_METADATA.accept()) { Scope scope = getScope(); if (scope != null) { if (!(scope instanceof DefaultScope)) { if (super.state() != State.FINAL) { scope = new DefaultScope(scope); this.scope = scope; } else { return Collections.singleton(scope.getExtent()); } } return ((DefaultScope) scope).getExtents(); } } return null; }
/** * Constructs a new instance initialized with the values from the specified metadata object. * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the * given object are not recursively copied. * * @param object the metadata to copy values from, or {@code null} if none. * * @see #castOrCopy(Source) */ public DefaultSource(final Source object) { super(object); if (object != null) { description = object.getDescription(); sourceReferenceSystem = object.getSourceReferenceSystem(); sourceCitation = object.getSourceCitation(); sourceSteps = copyCollection(object.getSourceSteps(), ProcessStep.class); processedLevel = object.getProcessedLevel(); resolution = object.getResolution(); if (object instanceof DefaultSource) { sourceSpatialResolution = ((DefaultSource) object).getSourceSpatialResolution(); sourceMetadata = copyCollection(((DefaultSource) object).getSourceMetadata(), Citation.class); scope = ((DefaultSource) object).getScope(); } else { setScaleDenominator(object.getScaleDenominator()); setSourceExtents(object.getSourceExtents()); } } }
/** * Information about the spatial, vertical and temporal extent of the source data. * This method stores the values in the {@linkplain #setScope(Scope) scope}. * * @param newValues the new source extents. * * @deprecated As of ISO 19115:2014, moved to {@link DefaultScope#setExtents(Collection)}. */ @Deprecated public void setSourceExtents(final Collection<? extends Extent> newValues) { checkWritePermission(); Scope scope = this.scope; if (!(scope instanceof DefaultScope)) { scope = new DefaultScope(scope); setScope(scope); } ((DefaultScope) scope).setExtents(newValues); }
/** * Sets the denominator of the representative fraction on a source map. * This method stores the value in the * {@linkplain #setSourceSpatialResolution(Resolution) source spatial resolution}. * * @param newValue the new scale denominator. * * @deprecated As of ISO 19115:2014, moved to {@link DefaultResolution#setEquivalentScale(RepresentativeFraction)}. */ @Deprecated public void setScaleDenominator(final RepresentativeFraction newValue) { checkWritePermission(sourceSpatialResolution); Resolution resolution = null; if (newValue != null) { resolution = sourceSpatialResolution; if (resolution instanceof DefaultResolution) { ((DefaultResolution) resolution).setEquivalentScale(newValue); } else { resolution = new DefaultResolution(newValue); } } /* * Invoke the non-deprecated setter method only if the reference changed, * for consistency with other deprecated setter methods in metadata module. */ if (resolution != sourceSpatialResolution) { setSourceSpatialResolution(resolution); } }
/** * 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 DefaultSource castOrCopy(final Source original) { if (original != null && !(original instanceof LE_Source)) { if (original.getProcessedLevel() != null || original.getResolution() != null) { return new LE_Source(original); } } return DefaultSource.castOrCopy(original); } }
/** * Returns the denominator of the representative fraction on a source map. * This method fetches the value from the * {@linkplain #getSourceSpatialResolution() source spatial resolution}. * * @return representative fraction on a source map, or {@code null}. * * @deprecated As of ISO 19115:2014, moved to {@link DefaultResolution#getEquivalentScale()}. */ @Override @Deprecated @Dependencies("getSourceSpatialResolution") @XmlElement(name = "scaleDenominator", namespace = LegacyNamespaces.GMD) public RepresentativeFraction getScaleDenominator() { if (FilterByVersion.LEGACY_METADATA.accept()) { final Resolution resolution = getSourceSpatialResolution(); if (resolution != null) { return resolution.getEquivalentScale(); } } return null; }
/** * 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 DefaultSource}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultSource} instance is created using the * {@linkplain #DefaultSource(Source) 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 DefaultSource castOrCopy(final Source object) { if (object == null || object instanceof DefaultSource) { return (DefaultSource) object; } return new DefaultSource(object); }
/** * Sets the spatial resolution expressed as a scale factor, an angle or a level of detail. * * @param newValue the new spatial resolution. * * @since 0.5 */ public void setSourceSpatialResolution(final Resolution newValue) { checkWritePermission(sourceSpatialResolution); sourceSpatialResolution = newValue; }
final InternationalString i18n = trim(description); if (i18n != null) { final DefaultSource source = new DefaultSource(description); if (level != null || feature != null) { DefaultScope scope = new DefaultScope(level);
/** * Sets the type and / or extent of the source. * * @param newValue the new type and / or extent of the source. * * @since 0.5 */ public void setScope(final Scope newValue){ checkWritePermission(scope); scope = newValue; }