public class IdentifiedObjectFinder extends Object
ID[…]
" or "AUTHORITY[…]
"
element in Well Known Text.
The steps for using IdentifiedObjectFinder
are:
GeodeticAuthorityFactory.newIdentifiedObjectFinder()
.find(IdentifiedObject)
or findSingleton(IdentifiedObject)
method.IdentifiedObjectFinder
instance can be reused for consecutive searches.IdentifiedObjectFinder
are not guaranteed to be thread-safe even if the underlying factory
is thread-safe. If concurrent searches are desired, then a new instance should be created for each thread.GeodeticAuthorityFactory.newIdentifiedObjectFinder()
,
IdentifiedObjects.newFinder(String)
Defined in the sis-referencing
module
Modifier and Type | Class and Description |
---|---|
static class |
IdentifiedObjectFinder.Domain
The domain of the search (for example whether to include deprecated objects in the search).
|
Modifier and Type | Field and Description |
---|---|
protected AuthorityFactory |
factory
The factory to use for creating objects.
|
Modifier | Constructor and Description |
---|---|
protected |
IdentifiedObjectFinder(AuthorityFactory factory)
Creates a finder using the specified factory.
|
Modifier and Type | Method and Description |
---|---|
Set<IdentifiedObject> |
find(IdentifiedObject object)
Lookups objects which are approximatively equal to the specified object.
|
IdentifiedObject |
findSingleton(IdentifiedObject object)
Lookups only one object which is approximatively equal to the specified object.
|
protected Set<String> |
getCodeCandidates(IdentifiedObject object)
Returns a set of authority codes that may identify the same object than the specified one.
|
IdentifiedObjectFinder.Domain |
getSearchDomain()
Returns the domain of the search (for example whether to include deprecated objects in the search).
|
boolean |
isIgnoringAxes()
Returns
true if the search should ignore coordinate system axes. |
void |
setIgnoringAxes(boolean ignore)
Sets whether the search should ignore coordinate system axes.
|
void |
setSearchDomain(IdentifiedObjectFinder.Domain domain)
Sets the domain of the search (for example whether to include deprecated objects in the search).
|
protected final AuthorityFactory factory
protected IdentifiedObjectFinder(AuthorityFactory factory)
GeodeticAuthorityFactory.newIdentifiedObjectFinder()
instead.factory
- the factory to scan for the identified objects.GeodeticAuthorityFactory.newIdentifiedObjectFinder()
public IdentifiedObjectFinder.Domain getSearchDomain()
DECLARATION
, only a fast lookup based on embedded identifiers and names will be performed.
Otherwise an exhaustive full scan against all registered objects will be performed (may be slow).
The default value is IdentifiedObjectFinder.Domain.VALID_DATASET
.
public void setSearchDomain(IdentifiedObjectFinder.Domain domain)
IdentifiedObjectFinder.Domain.VALID_DATASET
.domain
- the domain of the search.public boolean isIgnoringAxes()
true
if the search should ignore coordinate system axes.
The default value is false
.true
if the search should ignore coordinate system axes.public void setIgnoringAxes(boolean ignore)
true
, then the search will compare only the coordinate system type
and dimension. The axis names, orientation and units will be ignored. For example the find(…)
method may return a Coordinate Reference System object with (latitude, longitude)
axes even if the given object had (longitude, latitude) axes.ignore
- true
if the search should ignore coordinate system axes.public Set<IdentifiedObject> find(IdentifiedObject object) throws FactoryException
ComparisonMode.APPROXIMATIVE
are returned.object
- the object looked up.FactoryException
- if an error occurred while creating an object.public IdentifiedObject findSingleton(IdentifiedObject object) throws FactoryException
find(IdentifiedObject)
, then examine the returned Set
as below:
null
.object
and all other elements have different axis order,
then this method returns the single element having the same axis order.null
.object
- the object looked up.null
if none or ambiguous.FactoryException
- if an error occurred while creating an object.protected Set<String> getCodeCandidates(IdentifiedObject object) throws FactoryException
This method is invoked by the default find(IdentifiedObject)
method implementation.
The caller iterates through the returned codes, instantiate the objects and compare them with
the specified one in order to determine which codes are really applicable.
The iteration stops as soon as a match is found (in other words, if more than one object is equals
to the specified one, then the find(…)
method selects the first one in iteration order).
getAuthorityCodes(type)
where type
is the interface specified at construction type.
Subclasses should override this method in order to return a smaller set, if they can.object
- the object looked up.FactoryException
- if an error occurred while fetching the set of code candidates.Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.