|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Highlevel API for Features from a specific Query.
The can opperate as as a kind of Prepaired Query. It is a Query that knows enough information to be rerun. We may wish to rename this class as QueryResults.
Differences from FeatureCollection:
Ideas:
Method Summary | |
FeatureCollection |
collection()
Deprecated. please consider explicitly constructing a feaure collection |
com.vividsolutions.jts.geom.Envelope |
getBounds()
Returns the bounding box of this FeatureResults. |
int |
getCount()
Deprecated. Please use FeatureCollection.size() instead |
FeatureType |
getSchema()
Returns the FeatureType of the contents of this collection. |
FeatureReader |
reader()
Deprecated. please use FeatureCollections.features() to obtain a FeatureIterator |
Method Detail |
public FeatureType getSchema() throws java.io.IOException
Please note that for a collection with a mixed contents the FeatureType may be degenerate (ie very generic). For many applications (like shapefiles or tables) the FeatureType can safely be used to describe all the Features in the result set.
java.io.IOException
- if their is a problem getting the FeatureType.public FeatureReader reader() throws java.io.IOException
java.io.IOException
- DOCUMENT ME!public com.vividsolutions.jts.geom.Envelope getBounds()
This opperation may be expensive. Consider
FeatureSource.getBounds( Query )
as an alternative.
public Envelope getBounds() throws IOException {
Envelope newBBox = new Envelope();
Envelope internal;
Feature feature;
for (FeatureReader r = reader(); r.hasNext();) {
feature = r.next();
internal = feature.getDefaultGeometry().getEnvelopeInternal();
newBBox.expandToInclude(internal);
}
return newBBox;
}
public int getCount() throws java.io.IOException
This opperation may be expensive. Consider FeatureSource.getCount(
Query )
as an alternative.
public int getCount() throws IOException {
int count = 0;
for (FeatureReader r = reader(); r.hasNext(); count++) {
r.next();
}
return count;
}
java.io.IOException
- If there are problems getting the countpublic FeatureCollection collection() throws java.io.IOException
This method is logically the same as:
public FeatureCollection collection() throws IOException {
FeatureCollection collection = FeatureCollections.newCollection()
for (FeatureReader r = reader(); r.hasNext();) {
collection.add( r.next() );
}
return collection;
}
java.io.IOException
- If any problems occur aquiring Features
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |