Class DefaultResolution
java.lang.Object
org.apache.sis.metadata.AbstractMetadata
org.apache.sis.metadata.ModifiableMetadata
org.apache.sis.metadata.iso.ISOMetadata
org.apache.sis.metadata.iso.identification.DefaultResolution
- All Implemented Interfaces:
Serializable
,Emptiable
,LenientComparable
,IdentifiedObject
,org.opengis.metadata.identification.Resolution
public class DefaultResolution
extends ISOMetadata
implements org.opengis.metadata.identification.Resolution
Level of detail expressed as a scale factor or a ground distance.
The following properties are mandatory or conditional (i.e. mandatory under some circumstances)
in a well-formed metadata according ISO 19115:
ISO 19115 defines
MD_Resolution
├─angularDistance……
Angular sampling measure.
├─distance………………………
Ground sample distance.
├─equivalentScale……
Level of detail expressed as the scale of a comparable hardcopy map or chart.
│ └─denominator……
The number below the line in a vulgar fraction.
├─levelOfDetail…………
Brief textual description of the spatial resolution of the resource.
└─vertical………………………
Vertical sampling distance.Resolution
as an union (in the C/C++ sense):
only one of the properties in this class can be set to a non-empty value.
Setting any property to a non-empty value discard all the other ones.
See the constructor javadoc
for information about which property has precedence on copy operations.
Limitations
- Instances of this class are not synchronized for multi-threading. Synchronization, if needed, is caller's responsibility.
- Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
Serialization support is appropriate for short term storage or RMI between applications running the
same version of Apache SIS. For long term storage, use
XML
instead.
- Since:
- 0.3
- Version:
- 1.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sis.metadata.ModifiableMetadata
ModifiableMetadata.State
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final byte
Enumeration of possible values forproperty
.private static final byte
Enumeration of possible values forproperty
.private static final String[]
The names of the mutually exclusive properties.private byte
Specifies which property is set, or 0 if none.private static final byte
Enumeration of possible values forproperty
.private static final long
Serial number for compatibility with different versions.private static final String[]
The names of the setter methods, for logging purpose only.private static final byte
Enumeration of possible values forproperty
.private Object
Either the scale as aRepresentativeFraction
instance, the distance, the angle, or the level of details as anInternationalString
instance.private static final byte
Enumeration of possible values forproperty
.Fields inherited from class org.apache.sis.metadata.iso.ISOMetadata
identifiers
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an initially empty resolution.DefaultResolution
(org.opengis.metadata.identification.RepresentativeFraction scale) Creates a new resolution initialized to the given scale.DefaultResolution
(org.opengis.metadata.identification.Resolution object) Constructs a new instance initialized with the values from the specified metadata object. -
Method Summary
Modifier and TypeMethodDescriptionstatic DefaultResolution
castOrCopy
(org.opengis.metadata.identification.Resolution object) Returns a SIS metadata implementation with the values of the given arbitrary implementation.Returns the angular sampling measure.Returns the ground sample distance.org.opengis.metadata.identification.RepresentativeFraction
Returns the level of detail expressed as the scale of a comparable hardcopy map or chart.org.opengis.util.InternationalString
Returns a brief textual description of the spatial resolution of the resource.Returns the vertical sampling distance.void
setAngularDistance
(Double newValue) Sets the angular sampling measure.void
setDistance
(Double newValue) Sets the ground sample distance.void
setEquivalentScale
(org.opengis.metadata.identification.RepresentativeFraction newValue) Sets the level of detail expressed as the scale of a comparable hardcopy map or chart.void
setLevelOfDetail
(org.opengis.util.InternationalString newValue) Sets the textual description of the spatial resolution of the resource.private void
setProperty
(byte code, Object newValue) Sets the properties identified by thecode
argument, if non-null.void
setVertical
(Double newValue) Sets the vertical sampling distance.Methods inherited from class org.apache.sis.metadata.iso.ISOMetadata
getIdentifier, getIdentifierMap, getIdentifiers, getStandard, setIdentifier, transitionTo
Methods inherited from class org.apache.sis.metadata.ModifiableMetadata
checkWritePermission, collectionType, copyCollection, copyList, copyMap, copySet, deepCopy, nonNullCollection, nonNullList, nonNullMap, nonNullSet, singleton, state, writeCollection, writeList, writeMap, writeSet
Methods inherited from class org.apache.sis.metadata.AbstractMetadata
asMap, asTreeTable, equals, equals, getInterface, hashCode, isEmpty, prune, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerial number for compatibility with different versions.- See Also:
-
SCALE
private static final byte SCALEEnumeration of possible values forproperty
.- See Also:
-
DISTANCE
private static final byte DISTANCEEnumeration of possible values forproperty
.- See Also:
-
VERTICAL
private static final byte VERTICALEnumeration of possible values forproperty
.- See Also:
-
ANGULAR
private static final byte ANGULAREnumeration of possible values forproperty
.- See Also:
-
TEXT
private static final byte TEXTEnumeration of possible values forproperty
.- See Also:
-
NAMES
The names of the mutually exclusive properties. The index of each name shall be the value of the abovebyte
constants minus one. -
SETTERS
The names of the setter methods, for logging purpose only. -
property
private byte propertySpecifies which property is set, or 0 if none. -
value
Either the scale as aRepresentativeFraction
instance, the distance, the angle, or the level of details as anInternationalString
instance.
-
-
Constructor Details
-
DefaultResolution
public DefaultResolution()Constructs an initially empty resolution. -
DefaultResolution
public DefaultResolution(org.opengis.metadata.identification.RepresentativeFraction scale) Creates a new resolution initialized to the given scale.- Parameters:
scale
- the scale, ornull
if none.- Since:
- 0.4
-
DefaultResolution
public DefaultResolution(org.opengis.metadata.identification.Resolution object) Constructs a new instance initialized with the values from the specified metadata object. This is a shallow copy constructor, because the other metadata contained in the given object are not recursively copied.If more than one of the equivalent scale, distance, vertical, angular distance and level of detail are specified, then the first of those values is taken and the other values are silently discarded.
Note on properties validation: This constructor does not verify the property values of the given metadata (e.g. whether it contains unexpected negative values). This is because invalid metadata exist in practice, and verifying their validity in this copy constructor is often too late. Note that this is not the only hole, as invalid metadata instances can also be obtained by unmarshalling an invalid XML document.- Parameters:
object
- the metadata to copy values from, ornull
if none.- See Also:
-
-
Method Details
-
castOrCopy
Returns a SIS metadata implementation with the values of the given arbitrary implementation. This method performs the first applicable action in the following choices:- If the given object is
null
, then this method returnsnull
. - Otherwise if the given object is already an instance of
DefaultResolution
, then it is returned unchanged. - Otherwise a new
DefaultResolution
instance is created using the copy constructor and returned. Note that this is a shallow copy operation, because the other metadata contained in the given object are not recursively copied.
- Parameters:
object
- the object to get as a SIS implementation, ornull
if none.- Returns:
- a SIS implementation containing the values of the given object (may be the
given object itself), or
null
if the argument was null.
- If the given object is
-
setProperty
Sets the properties identified by thecode
argument, if non-null. This discards any other properties.- Parameters:
code
- the property which is going to be set.newValue
- the new value.
-
getEquivalentScale
public org.opengis.metadata.identification.RepresentativeFraction getEquivalentScale()Returns the level of detail expressed as the scale of a comparable hardcopy map or chart.- Specified by:
getEquivalentScale
in interfaceorg.opengis.metadata.identification.Resolution
- Returns:
- level of detail expressed as the scale of a comparable hardcopy, or
null
.
-
setEquivalentScale
public void setEquivalentScale(org.opengis.metadata.identification.RepresentativeFraction newValue) Sets the level of detail expressed as the scale of a comparable hardcopy map or chart.Effect on other properties
If and only if thenewValue
is non-null, then this method automatically discards all other properties.- Parameters:
newValue
- the new equivalent scale.
-
getDistance
Returns the ground sample distance.- Specified by:
getDistance
in interfaceorg.opengis.metadata.identification.Resolution
- Returns:
- the ground sample distance, or
null
.
-
setDistance
Sets the ground sample distance.Effect on other properties
If and only if thenewValue
is non-null, then this method automatically discards all other properties.- Parameters:
newValue
- the new distance, ornull
.- Throws:
IllegalArgumentException
- if the given value is NaN, zero or negative.
-
getVertical
@UML(identifier="vertical", obligation=CONDITIONAL, specification=ISO_19115) @ValueRange(minimum=0.0, isMinIncluded=false) public Double getVertical()Returns the vertical sampling distance.- Returns:
- the vertical sampling distance, or
null
. - Since:
- 0.5
-
setVertical
Sets the vertical sampling distance.Effect on other properties
If and only if thenewValue
is non-null, then this method automatically discards all other properties.- Parameters:
newValue
- the new distance, ornull
.- Throws:
IllegalArgumentException
- if the given value is NaN, zero or negative.- Since:
- 0.5
-
getAngularDistance
@UML(identifier="angularDistance", obligation=CONDITIONAL, specification=ISO_19115) @ValueRange(minimum=0.0, isMinIncluded=false) public Double getAngularDistance()Returns the angular sampling measure.- Returns:
- the angular sampling measure, or
null
. - Since:
- 0.5
-
setAngularDistance
Sets the angular sampling measure.Effect on other properties
If and only if thenewValue
is non-null, then this method automatically discards all other properties.- Parameters:
newValue
- the new distance, ornull
.- Throws:
IllegalArgumentException
- if the given value is NaN, zero or negative.- Since:
- 0.5
-
getLevelOfDetail
@UML(identifier="levelOfDetail", obligation=CONDITIONAL, specification=ISO_19115) public org.opengis.util.InternationalString getLevelOfDetail()Returns a brief textual description of the spatial resolution of the resource.- Returns:
- textual description of the spatial resolution, or
null
. - Since:
- 0.5
-
setLevelOfDetail
public void setLevelOfDetail(org.opengis.util.InternationalString newValue) Sets the textual description of the spatial resolution of the resource.Effect on other properties
If and only if thenewValue
is non-null, then this method automatically discards all other properties.- Parameters:
newValue
- the new distance.- Since:
- 0.5
-