Class PreGeneralizedFeatureSource
- Object
-
- PreGeneralizedFeatureSource
-
- All Implemented Interfaces:
FeatureSource<SimpleFeatureType,SimpleFeature>
,SimpleFeatureSource
public class PreGeneralizedFeatureSource extends Object implements SimpleFeatureSource
- Author:
- Christian Mueller
Feature source for a feature type with pregeneralized geometries
This featue store does business as usual with the exception described here
PreGeneralizedDataStore
-
-
Field Summary
Fields Modifier and Type Field Description protected PreGeneralizedDataStore
dataStore
protected GeneralizationInfo
info
protected FeatureListenerManager
listenerManager
protected Logger
log
protected Repository
repository
-
Constructor Summary
Constructors Constructor Description PreGeneralizedFeatureSource(GeneralizationInfo info, Repository repository, PreGeneralizedDataStore dataStore)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFeatureListener(FeatureListener listener)
Registers a listening object that will be notified of changes to thisFeatureSource
.ReferencedEnvelope
getBounds()
Get the spatial bounds of the feature data.ReferencedEnvelope
getBounds(Query query)
Get the spatial bounds of the features that would be returned by the givenQuery
.int
getCount(Query query)
Gets the number of the features that would be returned by the givenQuery
, taking into account any settings for max features and start index set on theQuery
.DataAccess<SimpleFeatureType,SimpleFeature>
getDataStore()
Returns the data source, as aDataAccess
object, providing thisFeatureSource
.FeatureReader<SimpleFeatureType,SimpleFeature>
getFeatureReader(Query query, Transaction transaction)
SimpleFeatureCollection
getFeatures()
Retrieves all features in the form of aFeatureCollection
.SimpleFeatureCollection
getFeatures(Query query)
Retrieves features, in the form of aFeatureCollection
, based on aQuery
.SimpleFeatureCollection
getFeatures(Filter filter)
Retrieves features, in the form of aFeatureCollection
, based on an OGCFilter
.ResourceInfo
getInfo()
Returns information describing thisFeatureSource
which may include title, description and spatial parameters.Name
getName()
Returns the name of the features (strictly, the name of theAttributeDescriptor
for the features) accessible through thisFeatureSource
.protected Query
getProxyObject(Query query, SimpleFeatureSource fs, Generalization di)
QueryCapabilities
getQueryCapabilities()
Enquire what what query capabilities thisFeatureSource
natively supports.SimpleFeatureType
getSchema()
Retrieves the schema (feature type) that will apply to features retrieved from thisFeatureSource
.Set<RenderingHints.Key>
getSupportedHints()
Returns the set of hints that thisFeatureSource
supports viaQuery
requests.protected void
logDistanceInfo(Generalization di)
void
removeFeatureListener(FeatureListener listener)
Removes an object from thisFeatureSource's
listeners.void
reset()
-
-
-
Field Detail
-
listenerManager
protected FeatureListenerManager listenerManager
-
repository
protected Repository repository
-
info
protected GeneralizationInfo info
-
dataStore
protected PreGeneralizedDataStore dataStore
-
log
protected Logger log
-
-
Constructor Detail
-
PreGeneralizedFeatureSource
public PreGeneralizedFeatureSource(GeneralizationInfo info, Repository repository, PreGeneralizedDataStore dataStore)
-
-
Method Detail
-
reset
public void reset()
-
addFeatureListener
public void addFeatureListener(FeatureListener listener)
Description copied from interface:FeatureSource
Registers a listening object that will be notified of changes to thisFeatureSource
.- Specified by:
addFeatureListener
in interfaceFeatureSource<SimpleFeatureType,SimpleFeature>
- Parameters:
listener
- the new listener
-
getBounds
public ReferencedEnvelope getBounds() throws IOException
Description copied from interface:FeatureSource
Get the spatial bounds of the feature data. This is equivalent to callinggetBounds(Query.ALL)
.It is possible that this method will return null if the calculation of bounds is judged to be too costly by the implementing class. In this case, you might call
getFeatures().getBounds()
instead.- Specified by:
getBounds
in interfaceFeatureSource<SimpleFeatureType,SimpleFeature>
- Returns:
- The bounding envelope of the feature data; or
null
if the bounds are unknown or too costly to calculate. - Throws:
IOException
- on any errors calculating the bounds
-
getBounds
public ReferencedEnvelope getBounds(Query query) throws IOException
Description copied from interface:FeatureSource
Get the spatial bounds of the features that would be returned by the givenQuery
.It is possible that this method will return null if the calculation of bounds is judged to be too costly by the implementing class. In this case, you might call
getFeatures(query).getBounds()
instead.- Specified by:
getBounds
in interfaceFeatureSource<SimpleFeatureType,SimpleFeature>
- Parameters:
query
- the query to select features- Returns:
- The bounding envelope of the feature data; or
null
if the bounds are unknown or too costly to calculate. - Throws:
IOException
- on any errors calculating the bounds
-
getCount
public int getCount(Query query) throws IOException
Description copied from interface:FeatureSource
Gets the number of the features that would be returned by the givenQuery
, taking into account any settings for max features and start index set on theQuery
.It is possible that this method will return
-1
if the calculation of number of features is judged to be too costly by the implementing class. In this case, you might callgetFeatures(query).size()
instead.Example use:
int count = featureSource.getCount(); if( count == -1 ){ count = featureSource.getFeatures( "typeName", count ).size(); }
- Specified by:
getCount
in interfaceFeatureSource<SimpleFeatureType,SimpleFeature>
- Parameters:
query
- the query to select features- Returns:
- the numer of features that would be returned by the
Query
; or-1
if this cannot be calculated. - Throws:
IOException
- if there are errors getting the count
-
getDataStore
public DataAccess<SimpleFeatureType,SimpleFeature> getDataStore()
Description copied from interface:FeatureSource
Returns the data source, as aDataAccess
object, providing thisFeatureSource
.- Specified by:
getDataStore
in interfaceFeatureSource<SimpleFeatureType,SimpleFeature>
- Returns:
- the data source providing this
FeatureSource
-
getFeatures
public SimpleFeatureCollection getFeatures() throws IOException
Description copied from interface:FeatureSource
Retrieves all features in the form of aFeatureCollection
.The following statements are equivalent:
featureSource.getFeatures(); featureSource.getFeatures(Filter.INCLUDE); featureSource.getFeatures(Query.ALL);
- Specified by:
getFeatures
in interfaceFeatureSource<SimpleFeatureType,SimpleFeature>
- Specified by:
getFeatures
in interfaceSimpleFeatureSource
- Returns:
- features retrieved by the
Query
- Throws:
IOException
- if the underlying data source cannot be accessed.
-
getFeatures
public SimpleFeatureCollection getFeatures(Filter filter) throws IOException
Description copied from interface:FeatureSource
Retrieves features, in the form of aFeatureCollection
, based on an OGCFilter
.- Specified by:
getFeatures
in interfaceFeatureSource<SimpleFeatureType,SimpleFeature>
- Specified by:
getFeatures
in interfaceSimpleFeatureSource
- Parameters:
filter
- the filter to select features; must not benull
(use Filter.INCLUDE instead)- Returns:
- features retrieved by the
Filter
- Throws:
IOException
- if the underlying data source cannot be accessed.- See Also:
Filter
-
getFeatures
public SimpleFeatureCollection getFeatures(Query query) throws IOException
Description copied from interface:FeatureSource
Retrieves features, in the form of aFeatureCollection
, based on aQuery
.- Specified by:
getFeatures
in interfaceFeatureSource<SimpleFeatureType,SimpleFeature>
- Specified by:
getFeatures
in interfaceSimpleFeatureSource
- Parameters:
query
- DataAccess query for requested information, such as typeName, maxFeatures and filter.- Returns:
- features retrieved by the
Query
- Throws:
IOException
- if the underlying data source cannot be accessed.- See Also:
Query
-
getFeatureReader
public FeatureReader<SimpleFeatureType,SimpleFeature> getFeatureReader(Query query, Transaction transaction) throws IOException
- Throws:
IOException
-
getInfo
public ResourceInfo getInfo()
Description copied from interface:FeatureSource
Returns information describing thisFeatureSource
which may include title, description and spatial parameters. Note that in the returnedResourceInfo
object, the distinction between feature name and schema (feature type) name applies as discussed for FeatureSource.getName().- Specified by:
getInfo
in interfaceFeatureSource<SimpleFeatureType,SimpleFeature>
-
getName
public Name getName()
Description copied from interface:FeatureSource
Returns the name of the features (strictly, the name of theAttributeDescriptor
for the features) accessible through thisFeatureSource
.The value returned by this method can be different to that returned by
featureSource.getSchema().getType().getName()
. This is because there is a distinction between the name applied to features and the name of a feature type. When working withSimpleFeature
andSimpleFeatureType
, for example with a shapefile data source, it is common practice for feature and feature type names to be the same. However, this is not the case more generally. For instance, a database can contain two tables with the same structure. The feature name will refer to the table while the feature type name refers to the schema (table structure).- Specified by:
getName
in interfaceFeatureSource<SimpleFeatureType,SimpleFeature>
- Returns:
- the name of the features accessible through this
FeatureSource
-
getQueryCapabilities
public QueryCapabilities getQueryCapabilities()
Description copied from interface:FeatureSource
Enquire what what query capabilities thisFeatureSource
natively supports. For example, whether queries can return sorted results.- Specified by:
getQueryCapabilities
in interfaceFeatureSource<SimpleFeatureType,SimpleFeature>
- Returns:
- the native query capabilities of this
FeatureSource
-
getSchema
public SimpleFeatureType getSchema()
Description copied from interface:FeatureSource
Retrieves the schema (feature type) that will apply to features retrieved from thisFeatureSource
.For a homogeneous data source such as a shapefile or a database table, this schema be that of all features. For a heterogeneous data source, e.g. a GML document, the schema returned is the lowest common denominator across all features.
- Specified by:
getSchema
in interfaceFeatureSource<SimpleFeatureType,SimpleFeature>
- Returns:
- the schema that will apply to features retrieved from this
FeatureSource
-
getSupportedHints
public Set<RenderingHints.Key> getSupportedHints()
Description copied from interface:FeatureSource
Returns the set of hints that thisFeatureSource
supports viaQuery
requests.Note: the existence of a specific hint does not guarantee that it will always be honored by the implementing class.
- Specified by:
getSupportedHints
in interfaceFeatureSource<SimpleFeatureType,SimpleFeature>
- Returns:
- a set of
RenderingHints#Key
objects; may be empty but nevernull
- See Also:
Hints.FEATURE_DETACHED
,Hints.JTS_GEOMETRY_FACTORY
,Hints.JTS_COORDINATE_SEQUENCE_FACTORY
,Hints.JTS_PRECISION_MODEL
,Hints.JTS_SRID
,Hints.GEOMETRY_DISTANCE
,Hints.FEATURE_2D
-
removeFeatureListener
public void removeFeatureListener(FeatureListener listener)
Description copied from interface:FeatureSource
Removes an object from thisFeatureSource's
listeners.- Specified by:
removeFeatureListener
in interfaceFeatureSource<SimpleFeatureType,SimpleFeature>
- Parameters:
listener
- the listener to remove
-
getProxyObject
protected Query getProxyObject(Query query, SimpleFeatureSource fs, Generalization di)
-
logDistanceInfo
protected void logDistanceInfo(Generalization di)
-
-