|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.data.store.ContentFeatureCollection
public class ContentFeatureCollection
A FeatureCollection that completly delegates to a backing FetaureSource.
Nested Class Summary | |
---|---|
static class |
ContentFeatureCollection.WrappingFeatureIterator
|
static class |
ContentFeatureCollection.WrappingIterator
|
Field Summary | |
---|---|
protected ContentFeatureSource |
featureSource
feature store the collection originated from. |
protected org.opengis.feature.simple.SimpleFeatureType |
featureType
feature (possibly retyped from feautre source original) type |
protected java.util.List |
listeners
Internal listener storage list |
protected java.util.Set |
open
Set of open resource iterators |
protected Query |
query
|
protected ContentState |
state
state of the feature source |
Constructor Summary | |
---|---|
protected |
ContentFeatureCollection(ContentFeatureSource featureSource,
Query query)
|
Method Summary | |
---|---|
void |
accepts(FeatureVisitor visitor,
ProgressListener progress)
Accepts a visitor, which then visits each feature in the collection. |
void |
accepts(org.opengis.feature.FeatureVisitor visitor,
org.opengis.util.ProgressListener progress)
Visit the contents of a feature collection. |
boolean |
add(org.opengis.feature.simple.SimpleFeature o)
Add object to this collection. |
boolean |
addAll(java.util.Collection c)
Add all the objects to the collection. |
boolean |
addAll(FeatureCollection c)
|
void |
addListener(CollectionListener listener)
Adds a listener for collection events. |
void |
clear()
|
void |
close(FeatureIterator<org.opengis.feature.simple.SimpleFeature> iterator)
Clean up after any resources associated with this FeatureIterator in a manner similar to JDO collections. |
void |
close(java.util.Iterator close)
Clean up after any resources associated with this itterator in a manner similar to JDO collections. |
boolean |
contains(java.lang.Object o)
|
boolean |
containsAll(java.util.Collection collection)
|
FeatureIterator<org.opengis.feature.simple.SimpleFeature> |
features()
Obtain a FeatureIterator |
java.lang.Object |
getAttribute(int indedx)
|
java.lang.Object |
getAttribute(org.opengis.feature.type.Name name)
|
java.lang.Object |
getAttribute(java.lang.String name)
|
int |
getAttributeCount()
|
java.util.List<java.lang.Object> |
getAttributes()
|
ReferencedEnvelope |
getBounds()
Get the total bounds of this collection which is calculated by doing a union of the bounds of each feature inside of it |
java.lang.Object |
getDefaultGeometry()
|
org.opengis.feature.GeometryAttribute |
getDefaultGeometryProperty()
|
org.opengis.feature.type.AttributeDescriptor |
getDescriptor()
|
org.opengis.feature.simple.SimpleFeatureType |
getFeatureType()
|
java.lang.String |
getID()
ID used when serializing to GML |
org.opengis.filter.identity.FeatureId |
getIdentifier()
|
org.opengis.feature.type.Name |
getName()
|
java.util.Collection<org.opengis.feature.Property> |
getProperties()
|
java.util.Collection<org.opengis.feature.Property> |
getProperties(org.opengis.feature.type.Name name)
|
java.util.Collection<org.opengis.feature.Property> |
getProperties(java.lang.String name)
|
org.opengis.feature.Property |
getProperty(org.opengis.feature.type.Name name)
|
org.opengis.feature.Property |
getProperty(java.lang.String name)
|
org.opengis.feature.simple.SimpleFeatureType |
getSchema()
The schema for the child features of this collection. |
org.opengis.feature.simple.SimpleFeatureType |
getType()
|
java.util.Map<java.lang.Object,java.lang.Object> |
getUserData()
|
java.util.Collection<? extends org.opengis.feature.Property> |
getValue()
|
boolean |
isEmpty()
|
boolean |
isNillable()
|
java.util.Iterator |
iterator()
An iterator over this collection, which must be closed after use. |
void |
purge()
Close any outstanding resources released by this resources. |
boolean |
remove(java.lang.Object o)
|
boolean |
removeAll(java.util.Collection collection)
|
void |
removeListener(CollectionListener listener)
Removes a listener for collection events. |
boolean |
retainAll(java.util.Collection collection)
|
void |
setAttribute(int index,
java.lang.Object value)
|
void |
setAttribute(org.opengis.feature.type.Name name,
java.lang.Object value)
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
|
void |
setAttributes(java.util.List<java.lang.Object> attributes)
|
void |
setAttributes(java.lang.Object[] attributes)
|
void |
setDefaultGeometry(java.lang.Object defaultGeometry)
|
void |
setDefaultGeometryProperty(org.opengis.feature.GeometryAttribute defaultGeometryProperty)
|
void |
setValue(java.util.Collection<org.opengis.feature.Property> value)
|
void |
setValue(java.lang.Object value)
|
int |
size()
|
FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> |
sort(SortBy order)
|
FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> |
sort(org.opengis.filter.sort.SortBy sort)
collection.subCollection( myFilter ).sort( {"foo","bar"} ); collection.subCollection( myFilter ).sort( "bar" ).sort("foo") |
FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> |
subCollection(org.opengis.filter.Filter filter)
FeatureCollection |
java.lang.Object[] |
toArray()
|
java.lang.Object[] |
toArray(java.lang.Object[] array)
|
void |
validate()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ContentFeatureSource featureSource
protected Query query
protected org.opengis.feature.simple.SimpleFeatureType featureType
protected ContentState state
protected java.util.List listeners
protected final java.util.Set open
Constructor Detail |
---|
protected ContentFeatureCollection(ContentFeatureSource featureSource, Query query)
Method Detail |
---|
public org.opengis.feature.simple.SimpleFeatureType getSchema()
FeatureCollection
There is a difference between getFeatureType() and getSchema()represents the LCD FeatureType that best represents the contents of this collection.
The method getSchema() is named for compatability with the geotools 2.0 API. In the Geotools 2.2 time frame we should be able to replace this method with a careful check of getFeatureType() and its attributes.
getSchema
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
public void accepts(FeatureVisitor visitor, ProgressListener progress) throws java.io.IOException
java.io.IOException
public void accepts(org.opengis.feature.FeatureVisitor visitor, org.opengis.util.ProgressListener progress) throws java.io.IOException
FeatureCollection
The order of traversal is dependent on the FeatureCollection implementation; some collections are able to make efficient use of an internal index in order to quickly visit features located in the same region.
accepts
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
visitor
- Closure applied to each feature in turn.progress
- Used to report progress, may be used to interrupt the operation
java.io.IOException
public void addListener(CollectionListener listener)
addListener
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
listener
- The listener to addpublic void removeListener(CollectionListener listener)
removeListener
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
listener
- The listener to removepublic FeatureIterator<org.opengis.feature.simple.SimpleFeature> features()
FeatureCollection
The implementation of Collection must adhere to the rules of
fail-fast concurrent modification. In addition (to allow for
resource backed collections, the close( Iterator )
method must be called.
This is almost equivalent to:
getAttribute(getFeatureType().getAttributeType(0).getName()).iterator();
.
Iterator<Feature>
FeatureIterator iterator=collection.features();
try {
while( iterator.hasNext() ){
Feature feature = iterator.next();
System.out.println( feature.getID() );
}
}
finally {
collection.close( iterator );
}
GML Note: The contents of this iterator are considered to be defined by featureMember tags (and/or the single allowed FeatureMembers tag). Please see getFeatureType for more details.
features
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
public void close(FeatureIterator<org.opengis.feature.simple.SimpleFeature> iterator)
FeatureCollection
Iterator iterator = collection.iterator();
try {
for( Iterator i=collection.iterator(); i.hasNext();){
Feature feature = i.hasNext();
System.out.println( feature.getID() );
}
}
finally {
collection.close( iterator );
}
close
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
public java.util.Iterator iterator()
FeatureCollection
Collection is not guaranteed to be ordered in any manner.
The implementation of Collection must adhere to the rules of
fail-fast concurrent modification. In addition (to allow for
resource backed collections, the close( Iterator )
method must be called.
Example (safe) use:
Iterator iterator = collection.iterator();
try {
while( iterator.hasNext();){
Feature feature = (Feature) iterator.hasNext();
System.out.println( feature.getID() );
}
}
finally {
collection.close( iterator );
}
iterator
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
public void close(java.util.Iterator close)
FeatureCollection
Iterator iterator = collection.iterator();
try {
for( Iterator i=collection.iterator(); i.hasNext();){
Feature feature = (Feature) i.hasNext();
System.out.println( feature.getID() );
}
}
finally {
collection.close( iterator );
}
close
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
public ReferencedEnvelope getBounds()
FeatureCollection
getBounds
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
public int size()
size
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Collection.size()
public boolean isEmpty()
isEmpty
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Collection.isEmpty()
public boolean add(org.opengis.feature.simple.SimpleFeature o)
FeatureCollection
This method is often not impelmented for collections produced as the result of a query.
add
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Collection.add(Object)
public boolean addAll(java.util.Collection c)
FeatureCollection
This method is often not implemented for collections produced as the results of a query.
addAll
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Collection.addAll(Collection)
public boolean addAll(FeatureCollection c)
addAll
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
FeatureCollection.addAll(Collection)
public void clear()
clear
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Collection.clear()
public void purge()
FeatureCollection
This method should be used with great caution, it is however available to allow the use of the ResourceCollection with algorthims that are unaware of the need to close iterators after use.
Example of using a normal Collections utility method:
Collections.sort( collection );
collection.purge();
purge
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
public FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> sort(SortBy order)
public FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> sort(org.opengis.filter.sort.SortBy sort)
FeatureCollection
sort
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
public FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature> subCollection(org.opengis.filter.Filter filter)
FeatureCollection
The contents of the returned FeatureCollection
This method is used cut down on the number of filter based methods
required for a useful FeatureCollection
Example Use:
The results of subCollection:
The above recommended use is agreement with the Collections API precident of
List.subList( start, end ).
collection.subCollection( filter ).clear();
subCollection
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
FeatureList
public boolean contains(java.lang.Object o)
contains
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Collection.contains(Object)
public boolean containsAll(java.util.Collection collection)
containsAll
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Collection.containsAll(Collection)
public boolean remove(java.lang.Object o)
remove
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Collection.remove(Object)
public boolean removeAll(java.util.Collection collection)
removeAll
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Collection.removeAll(Collection)
public boolean retainAll(java.util.Collection collection)
retainAll
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Collection.retainAll(Collection)
public java.lang.Object[] toArray()
toArray
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Collection.toArray()
public java.lang.Object[] toArray(java.lang.Object[] array)
toArray
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
Collection.toArray(Object[])
public java.lang.Object getAttribute(java.lang.String name)
public java.lang.Object getAttribute(org.opengis.feature.type.Name name)
public java.lang.Object getAttribute(int indedx) throws java.lang.IndexOutOfBoundsException
java.lang.IndexOutOfBoundsException
public int getAttributeCount()
public java.util.List<java.lang.Object> getAttributes()
public java.lang.Object getDefaultGeometry()
public org.opengis.feature.simple.SimpleFeatureType getFeatureType()
public org.opengis.feature.simple.SimpleFeatureType getType()
public void setAttribute(java.lang.String name, java.lang.Object value)
public void setAttribute(org.opengis.feature.type.Name name, java.lang.Object value)
public void setAttribute(int index, java.lang.Object value) throws java.lang.IndexOutOfBoundsException
java.lang.IndexOutOfBoundsException
public void setAttributes(java.util.List<java.lang.Object> attributes)
public void setAttributes(java.lang.Object[] attributes)
public void setDefaultGeometry(java.lang.Object defaultGeometry)
public org.opengis.feature.GeometryAttribute getDefaultGeometryProperty()
public org.opengis.filter.identity.FeatureId getIdentifier()
public java.lang.String getID()
FeatureCollection
getID
in interface FeatureCollection<org.opengis.feature.simple.SimpleFeatureType,org.opengis.feature.simple.SimpleFeature>
public void setDefaultGeometryProperty(org.opengis.feature.GeometryAttribute defaultGeometryProperty)
public java.util.Collection<org.opengis.feature.Property> getProperties()
public java.util.Collection<org.opengis.feature.Property> getProperties(org.opengis.feature.type.Name name)
public java.util.Collection<org.opengis.feature.Property> getProperties(java.lang.String name)
public org.opengis.feature.Property getProperty(org.opengis.feature.type.Name name)
public org.opengis.feature.Property getProperty(java.lang.String name)
public java.util.Collection<? extends org.opengis.feature.Property> getValue()
public void setValue(java.util.Collection<org.opengis.feature.Property> value)
public org.opengis.feature.type.AttributeDescriptor getDescriptor()
public org.opengis.feature.type.Name getName()
public java.util.Map<java.lang.Object,java.lang.Object> getUserData()
public boolean isNillable()
public void setValue(java.lang.Object value)
public void validate()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |