Class ModifiableLocationType
java.lang.Object
org.apache.sis.referencing.gazetteer.AbstractLocationType
org.apache.sis.referencing.gazetteer.ModifiableLocationType
- All Implemented Interfaces:
LenientComparable
- Direct Known Subclasses:
ModifiableLocationTypeAdapter
Helper class for building the description of a location. Temporary instances of this class can be used
during the construction of spatial reference systems using geographic identifiers.
Since
ModifiableLocationType
instances are modifiable, they should not be published directly.
Instead, unmodifiable snapshots should be published.
The same ModifiableLocationType
instance can be used for many snapshots.
Example:
the following code creates 3 levels of location types: administrative areas, which contain
towns, which themselves contain streets. Note that the
street
location
type has two parents, town
and area
, because a street can be outside any town and
directly under the authority of an administrative area instead.
A string representation of the area
location type is as below:
Inheritance of property values
According ISO 19112:2003, all properties except the collection of parents and children are mandatory. Those mandatory properties are the name, theme, identifications, definition, territory of use and owner. However, in Apache SIS implementation, only the name is truly mandatory; SIS is tolerant to missing value for all other properties. But in the hope to improve ISO compliance, values of undefined properties are inherited from the parents (if any) provided that all parents define the same values.Example:
if an administrative area is in some territory of use,
then all children of the administrative area (namely towns and streets) can
reasonably presumed to be in the same territory of use. That territory can be specified only once
as below:
Then, the towns and streets automatically inherit the same value for that property,
unless they are explicitly given another value.
Limitation
This class is not serializable and is not thread-safe. For thread safety or for serialization, a snapshots of this location type should be taken.- Since:
- 0.8
- Version:
- 0.8
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map
<String, ModifiableLocationType> Child location types (location types which sub-divides this location type).private org.opengis.util.InternationalString
The way in which location instances are defined.Method(s) of uniquely identifying location instances.private final org.opengis.util.InternationalString
Name of the location type.private AbstractParty
Name of organization or class of organization able to create and destroy location instances.private final Map
<String, ModifiableLocationType> Parent location types (location types of which this location type is a sub-division).private org.opengis.metadata.extent.GeographicExtent
Geographic area within which the location type occurs.private org.opengis.util.InternationalString
Property used as the defining characteristic of the location type. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new location type of the given name. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addIdentification
(CharSequence value) Adds a method of uniquely identifying location instances.void
addParent
(ModifiableLocationType parent) Adds the given element to the list of parents.final Collection
<ModifiableLocationType> Returns the child location types (location types which sub-divides this location type).org.opengis.util.InternationalString
Returns the way in which location instances are defined.Collection
<org.opengis.util.InternationalString> Returns the method(s) of uniquely identifying location instances.org.opengis.util.InternationalString
getName()
Returns the name of the location type.getOwner()
Returns the name of organization or class of organization able to create and destroy location instances.final Collection
<ModifiableLocationType> Returns the parent location types (location types of which this location type is a sub-division).Returns the reference system that comprises this location type.org.opengis.metadata.extent.GeographicExtent
Returns the geographic area within which the location type occurs.org.opengis.util.InternationalString
getTheme()
Returns the property used as the defining characteristic of the location type.private <E> E
inherit
(Function<ModifiableLocationType, E> property) If all parents return the same value for the given property, returns that value.void
removeIdentification
(CharSequence value) Removes a method of uniquely identifying location instances.void
removeParent
(ModifiableLocationType parent) Removes the given element from the list of parent.void
setDefinition
(CharSequence value) Sets the way in which location instances are defined.void
setOwner
(CharSequence name) Sets the name of the organization or class of organization able to create and destroy location instances.void
setOwner
(AbstractParty value) Sets the organization or class of organization able to create and destroy location instances.void
setTerritoryOfUse
(String identifier) Sets the name of the geographic area within which the location type occurs.void
setTerritoryOfUse
(org.opengis.metadata.extent.GeographicExtent value) Sets the geographic area within which the location type occurs.void
setTheme
(CharSequence value) Sets the property used as the defining characteristic of the location type.Methods inherited from class org.apache.sis.referencing.gazetteer.AbstractLocationType
checkForCycles, equals, equals, hashCode, snapshot, toString
-
Field Details
-
name
private final org.opengis.util.InternationalString nameName of the location type. -
theme
private org.opengis.util.InternationalString themeProperty used as the defining characteristic of the location type. -
identifications
Method(s) of uniquely identifying location instances. -
definition
private org.opengis.util.InternationalString definitionThe way in which location instances are defined. -
territoryOfUse
private org.opengis.metadata.extent.GeographicExtent territoryOfUseGeographic area within which the location type occurs. -
owner
Name of organization or class of organization able to create and destroy location instances. -
parents
Parent location types (location types of which this location type is a sub-division). -
children
Child location types (location types which sub-divides this location type).
-
-
Constructor Details
-
ModifiableLocationType
Creates a new location type of the given name.- Parameters:
name
- the location type name.
-
-
Method Details
-
getName
public org.opengis.util.InternationalString getName()Returns the name of the location type. This name is specified at construction time and cannot be changed.Examples: “administrative area”, “town”, “locality”, “street”, “property”.- Specified by:
getName
in classAbstractLocationType
- Returns:
- name of the location type.
-
inherit
If all parents return the same value for the given property, returns that value. Otherwise returnsnull
. -
getTheme
public org.opengis.util.InternationalString getTheme()Returns the property used as the defining characteristic of the location type. If no theme has been explicitly set, then this method inherits the value from the parents providing that all parents specify the same theme.- Specified by:
getTheme
in classAbstractLocationType
- Returns:
- property used as the defining characteristic of the location type,
or
null
if no value has been defined or can be inherited. - See Also:
-
setTheme
Sets the property used as the defining characteristic of the location type.Examples: “local administration” for administrative areas, “built environment” for towns or properties, “access” for streets, “electoral”, “postal”.- Parameters:
value
- the new theme, ornull
for inheriting a value from the parents.
-
getIdentifications
Returns the method(s) of uniquely identifying location instances. If no methods have been explicitly set, then this method inherits the values from the parents providing that all parents specify the same methods.Examples: some identification methods are “name”, “code”, “unique street reference number” and “geographic address”. A location using “name” identifications may have the “Spain” geographic identifier, and a location using “postcode” identifications may have the “SW1P 3AD” geographic identifier.The collection returned by this method is unmodifiable. For adding or removing an identification, useaddIdentification(CharSequence)
orremoveIdentification(CharSequence)
.- Specified by:
getIdentifications
in classAbstractLocationType
- Returns:
- method(s) of uniquely identifying location instances, or an empty list if no value has been defined or can be inherited.
- See Also:
-
addIdentification
Adds a method of uniquely identifying location instances.Examples: “name”, “code”, “unique street reference number”, “geographic address”.- Parameters:
value
- the method to add.- Throws:
IllegalArgumentException
- if the given value is already defined.
-
removeIdentification
Removes a method of uniquely identifying location instances.- Parameters:
value
- the method to remove.- Throws:
IllegalArgumentException
- if the given value is not found.
-
getDefinition
public org.opengis.util.InternationalString getDefinition()Returns the way in which location instances are defined. If no definition has been explicitly set, then this method inherits the value from the parents providing that all parents specify the same definition.- Specified by:
getDefinition
in classAbstractLocationType
- Returns:
- the way in which location instances are defined,
or
null
if no value has been defined or can be inherited.
-
setDefinition
Sets the way in which location instances are defined.- Parameters:
value
- the new identification.
-
getTerritoryOfUse
public org.opengis.metadata.extent.GeographicExtent getTerritoryOfUse()Returns the geographic area within which the location type occurs. If no geographic area has been explicitly set, then this method inherits the value from the parents providing that all parents specify the same geographic area.- Specified by:
getTerritoryOfUse
in classAbstractLocationType
- Returns:
- geographic area within which the location type occurs,
or
null
if no value has been defined or can be inherited. - See Also:
-
setTerritoryOfUse
public void setTerritoryOfUse(org.opengis.metadata.extent.GeographicExtent value) Sets the geographic area within which the location type occurs. The given value is typically an instance ofDefaultGeographicBoundingBox
. For an alternative where only the territory name is specified, seesetTerritoryOfUse(String)
.- Parameters:
value
- the new geographic extent.
-
setTerritoryOfUse
Sets the name of the geographic area within which the location type occurs.Examples: the geographic domain for a location type “rivers” might be “North America”.- Parameters:
identifier
- the identifier of the geographic extent.
-
getOwner
Returns the name of organization or class of organization able to create and destroy location instances. If no organization has been explicitly set, then this method inherits the value from the parents providing that all parents specify the same organization.Upcoming API change — generalization
in a future SIS version, the type of returned element may be generalized to theorg.opengis.metadata.citation.Party
interface. This change is pending GeoAPI revision for upgrade from ISO 19115:2003 to ISO 19115:2014.- Specified by:
getOwner
in classAbstractLocationType
- Returns:
- organization or class of organization able to create and destroy location instances,
or
null
if no value has been defined or can be inherited. - See Also:
-
setOwner
Sets the organization or class of organization able to create and destroy location instances. The given value is typically an instance ofDefaultOrganisation
. For an alternative where only the organization name is specified, seesetOwner(CharSequence)
.Upcoming API change — generalization
in a future SIS version, the argument type may be generalized to theorg.opengis.metadata.citation.Party
interface. This change is pending GeoAPI revision for upgrade from ISO 19115:2003 to ISO 19115:2014.- Parameters:
value
- the new owner.
-
setOwner
Sets the name of the organization or class of organization able to create and destroy location instances.- Parameters:
name
- the organization name.
-
getParents
Returns the parent location types (location types of which this location type is a sub-division). A location type can have more than one possible parent. For example, the parent of a location type named “street” could be “locality”, “town” or “administrative area”.The collection returned by this method is unmodifiable. For adding or removing a parent, use
addParent(ModifiableLocationType)
orremoveParent(ModifiableLocationType)
.- Specified by:
getParents
in classAbstractLocationType
- Returns:
- parent location types, or an empty collection if none.
- See Also:
-
getChildren
Returns the child location types (location types which sub-divides this location type). The collection returned by this method is unmodifiable. For adding or removing a child, usechild.addParent(this)
orchild.removeParent(this)
.- Specified by:
getChildren
in classAbstractLocationType
- Returns:
- child location types, or an empty collection if none.
- See Also:
-
addParent
Adds the given element to the list of parents.- Parameters:
parent
- the parent to add.- Throws:
IllegalStateException
- if this location type already have a parent of the same name.IllegalArgumentException
- if the given parent already have a child of the same name than this location type.
-
removeParent
Removes the given element from the list of parent.- Parameters:
parent
- the parent to remove.- Throws:
IllegalArgumentException
- if the given parent has not been found.
-
getReferenceSystem
Returns the reference system that comprises this location type. ForModifiableLocationType
s, the reference system is always null. The reference system is defined when the location types are given to theReferencingByIdentifiers
constructor for example.Upcoming API change — generalization
in a future SIS version, the type of returned element may be generalized to theorg.opengis.referencing.gazetteer.ReferenceSystemUsingIdentifiers
interface. This change is pending GeoAPI revision.- Specified by:
getReferenceSystem
in classAbstractLocationType
- Returns:
null
.- See Also:
-