|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface FeatureSource<T extends FeatureType,F extends Feature>
Highlevel API for Features from a specific location.
Individual Shapefiles, databases tables , etc. are referenced through this interface. Compare and constrast with DataStore.
Differences from DataStore:
Method Summary | |
---|---|
void |
addFeatureListener(FeatureListener listener)
Adds a listener to the list that's notified each time a change to the FeatureStore occurs. |
ReferencedEnvelope |
getBounds()
Gets the bounding box of this datasource. |
ReferencedEnvelope |
getBounds(Query query)
Gets the bounding box of the features that would be returned by this query. |
int |
getCount(Query query)
Gets the number of the features that would be returned by this query. |
DataAccess<T,F> |
getDataStore()
Access to the DataStore implementing this FeatureStore. |
FeatureCollection<T,F> |
getFeatures()
Loads all features from the datasource into the return FeatureResults. |
FeatureCollection<T,F> |
getFeatures(Filter filter)
Loads features from the datasource into the returned FeatureResults, based on the passed filter. |
FeatureCollection<T,F> |
getFeatures(Query query)
Loads features from the datasource into the returned FeatureResults, based on the passed query. |
ResourceInfo |
getInfo()
Information describing the contents of this resoruce. |
Name |
getName()
Returns the qualified name for the Features this FeatureSource serves. |
QueryCapabilities |
getQueryCapabilities()
Returns and indication of what query capabilities this FeatureSource supports natively. |
T |
getSchema()
Retrieves the featureType that features extracted from this datasource will be created with. |
Set<RenderingHints.Key> |
getSupportedHints()
Returns the set of hints this FeatureSource is able to support. |
void |
removeFeatureListener(FeatureListener listener)
Removes a listener from the list that's notified each time a change to the FeatureStore occurs. |
Method Detail |
---|
Name getName()
Note this is different from getSchema().getType().getName()
(that
is, the feature type name), this name specifies the
AttributeDescriptor name
for the
Features served by this source. So,
FeatureSoruce.getName() == FeatureSource.getFeatures().next().getAttributeDescriptor().getName()
.
Though it's a common practice when dealing with SimpleFeatureType
and SimpleFeature
to assume they're equal. There's no conflict
(as per the dynamic typing system the org.opengis.feature
package
defines) in a Feature and its type sharing the same name, as well as in a
GML schema an element declaration and a type definition may be named the
same. Yet, the distinction becomes important as we get rid of that
assumption and thus allow to reuse a type definition for different
FeatureSoruces, decoupling the descriptor (homologous to the Feature
element declaration in a GML schema) from its type definition.
So, even if implementors are allowed to delegate to
getSchema().getName()
if they want to call the fatures and their
type the same, client code asking a
DataAccess.getFeatureSource(Name)
shall use this name to request
for a FeatureSource, rather than the type name, as used in pre 2.5
versions of GeoTools. For example, if we have a FeatureSource named
Roads
and its type is named Roads_Type
, the
DataAccess
shall be queried through Roads
, not
Roads_Type
.
ResourceInfo getInfo()
Please note that for FeatureContent:
DataAccess<T,F> getDataStore()
QueryCapabilities getQueryCapabilities()
void addFeatureListener(FeatureListener listener)
listener
- FeatureListenervoid removeFeatureListener(FeatureListener listener)
listener
- FeatureListenerFeatureCollection<T,F> getFeatures(Query query) throws IOException
query
- a datasource query object. It encapsulates requested
information, such as typeName, maxFeatures and filter.
IOException
- For all data source errors.Query
FeatureCollection<T,F> getFeatures(Filter filter) throws IOException
filter
- An OpenGIS filter; specifies which features to retrieve.
null is not allowed, use Filter.INCLUDE instead.
IOException
- For all data source errors.FeatureCollection<T,F> getFeatures() throws IOException
Filter.INCLUDE can also be used to get all features. Calling this function
is equivalent to using Query.ALL
IOException
- For all data source errors.T getSchema()
The schema returned is the LCD supported by all available Features. In the common case of shapfiles and database table this schema will match that of every feature available. In the degenerate GML case this will simply reflect the gml:AbstractFeatureType.
ReferencedEnvelope getBounds() throws IOException
With getBounds(Query) this becomes a convenience method for getBounds(Query.ALL), that is the bounds for all features contained here.
If getBounds() returns null
due to expense consider using
getFeatures().getBounds()
as a an alternative.
IOException
- if there are errors getting the bounding box.ReferencedEnvelope getBounds(Query query) throws IOException
To retrieve the bounds of the DataSource please use getBounds(
Query.ALL )
.
This method is needed if we are to stream features to a gml out, since a
FeatureCollection
If getBounds(Query) returns null
due to expense consider
using getFeatures(Query).getBounds()
as a an alternative.
query
- Contains the Filter, and optionally MaxFeatures and StartIndex to
find the bounds for.
IOException
- DOCUMENT ME!int getCount(Query query) throws IOException
If getBounds(Query) returns -1
due to expense consider
using getFeatures(Query).getCount()
as a an alternative.
This method should take into account the Query's maxFeatures
and startIndex
, if present, in order to
consistently return the number of features the query would return.
query
- Contains the Filter, and optionally MaxFeatures and StartIndex to
find the count for.
-1
if count is too expensive to calculate or any errors or occur.
IOException
- if there are errors getting the countSet<RenderingHints.Key> getSupportedHints()
FeatureSource
is able to support.
Hints are to be specified in the Query
, for each data access where they
may be required.
Depending on the actual value provide by the user, the FeatureSource
may decide not to honor the hint.
RenderingHints#Key
objects (eventually empty, never null).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |