|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectContentFeatureCollection
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 SimpleFeatureType |
featureType
feature (possibly retyped from feautre source original) type |
protected List |
listeners
Internal listener storage list |
protected 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(FeatureVisitor visitor,
ProgressListener progress)
Visit the contents of a feature collection. |
boolean |
add(SimpleFeature o)
Add object to this collection. |
boolean |
addAll(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<SimpleFeature> iterator)
Clean up after any resources associated with this FeatureIterator in a manner similar to JDO collections. |
void |
close(Iterator close)
Clean up after any resources associated with this itterator in a manner similar to JDO collections. |
boolean |
contains(Object o)
|
boolean |
containsAll(Collection collection)
|
FeatureIterator<SimpleFeature> |
features()
Obtain a FeatureIterator |
Object |
getAttribute(int indedx)
|
Object |
getAttribute(Name name)
|
Object |
getAttribute(String name)
|
int |
getAttributeCount()
|
List<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 |
Object |
getDefaultGeometry()
|
GeometryAttribute |
getDefaultGeometryProperty()
|
AttributeDescriptor |
getDescriptor()
|
SimpleFeatureType |
getFeatureType()
|
String |
getID()
ID used when serializing to GML |
FeatureId |
getIdentifier()
|
Name |
getName()
|
Collection<Property> |
getProperties()
|
Collection<Property> |
getProperties(Name name)
|
Collection<Property> |
getProperties(String name)
|
Property |
getProperty(Name name)
|
Property |
getProperty(String name)
|
SimpleFeatureType |
getSchema()
The schema for the child features of this collection. |
SimpleFeatureType |
getType()
|
Map<Object,Object> |
getUserData()
|
Collection<? extends Property> |
getValue()
|
boolean |
isEmpty()
|
boolean |
isNillable()
|
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(Object o)
|
boolean |
removeAll(Collection collection)
|
void |
removeListener(CollectionListener listener)
Removes a listener for collection events. |
boolean |
retainAll(Collection collection)
|
void |
setAttribute(int index,
Object value)
|
void |
setAttribute(Name name,
Object value)
|
void |
setAttribute(String name,
Object value)
|
void |
setAttributes(List<Object> attributes)
|
void |
setAttributes(Object[] attributes)
|
void |
setDefaultGeometry(Object defaultGeometry)
|
void |
setDefaultGeometryProperty(GeometryAttribute defaultGeometryProperty)
|
void |
setValue(Collection<Property> value)
|
void |
setValue(Object value)
|
int |
size()
|
FeatureCollection<SimpleFeatureType,SimpleFeature> |
sort(SortBy order)
|
FeatureCollection<SimpleFeatureType,SimpleFeature> |
sort(SortBy sort)
collection.subCollection( myFilter ).sort( {"foo","bar"} ); collection.subCollection( myFilter ).sort( "bar" ).sort("foo") |
FeatureCollection<SimpleFeatureType,SimpleFeature> |
subCollection(Filter filter)
FeatureCollection |
Object[] |
toArray()
|
Object[] |
toArray(Object[] array)
|
void |
validate()
|
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ContentFeatureSource featureSource
protected Query query
protected SimpleFeatureType featureType
protected ContentState state
protected List listeners
protected final Set open
Constructor Detail |
---|
protected ContentFeatureCollection(ContentFeatureSource featureSource, Query query)
Method Detail |
---|
public 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<SimpleFeatureType,SimpleFeature>
public void accepts(FeatureVisitor visitor, ProgressListener progress) throws IOException
IOException
public void accepts(FeatureVisitor visitor, ProgressListener progress) throws 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<SimpleFeatureType,SimpleFeature>
visitor
- Closure applied to each feature in turn.progress
- Used to report progress, may be used to interrupt the operation
IOException
public void addListener(CollectionListener listener)
addListener
in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
listener
- The listener to addpublic void removeListener(CollectionListener listener)
removeListener
in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
listener
- The listener to removepublic FeatureIterator<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<SimpleFeatureType,SimpleFeature>
public void close(FeatureIterator<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<SimpleFeatureType,SimpleFeature>
public 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<SimpleFeatureType,SimpleFeature>
public void close(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<SimpleFeatureType,SimpleFeature>
public ReferencedEnvelope getBounds()
FeatureCollection
getBounds
in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
public int size()
size
in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
Collection.size()
public boolean isEmpty()
isEmpty
in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
Collection.isEmpty()
public boolean add(SimpleFeature o)
FeatureCollection
This method is often not impelmented for collections produced as the result of a query.
add
in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
Collection.add(Object)
public boolean addAll(Collection c)
FeatureCollection
This method is often not implemented for collections produced as the results of a query.
addAll
in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
Collection.addAll(Collection)
public boolean addAll(FeatureCollection c)
addAll
in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
FeatureCollection.addAll(Collection)
public void clear()
clear
in interface FeatureCollection<SimpleFeatureType,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<SimpleFeatureType,SimpleFeature>
public FeatureCollection<SimpleFeatureType,SimpleFeature> sort(SortBy order)
public FeatureCollection<SimpleFeatureType,SimpleFeature> sort(SortBy sort)
FeatureCollection
sort
in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
public FeatureCollection<SimpleFeatureType,SimpleFeature> subCollection(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<SimpleFeatureType,SimpleFeature>
FeatureList
public boolean contains(Object o)
contains
in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
Collection.contains(Object)
public boolean containsAll(Collection collection)
containsAll
in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
Collection.containsAll(Collection)
public boolean remove(Object o)
remove
in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
Collection.remove(Object)
public boolean removeAll(Collection collection)
removeAll
in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
Collection.removeAll(Collection)
public boolean retainAll(Collection collection)
retainAll
in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
Collection.retainAll(Collection)
public Object[] toArray()
toArray
in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
Collection.toArray()
public Object[] toArray(Object[] array)
toArray
in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
Collection.toArray(Object[])
public Object getAttribute(String name)
public Object getAttribute(Name name)
public Object getAttribute(int indedx) throws IndexOutOfBoundsException
IndexOutOfBoundsException
public int getAttributeCount()
public List<Object> getAttributes()
public Object getDefaultGeometry()
public SimpleFeatureType getFeatureType()
public SimpleFeatureType getType()
public void setAttribute(String name, Object value)
public void setAttribute(Name name, Object value)
public void setAttribute(int index, Object value) throws IndexOutOfBoundsException
IndexOutOfBoundsException
public void setAttributes(List<Object> attributes)
public void setAttributes(Object[] attributes)
public void setDefaultGeometry(Object defaultGeometry)
public GeometryAttribute getDefaultGeometryProperty()
public FeatureId getIdentifier()
public String getID()
FeatureCollection
getID
in interface FeatureCollection<SimpleFeatureType,SimpleFeature>
public void setDefaultGeometryProperty(GeometryAttribute defaultGeometryProperty)
public Collection<Property> getProperties()
public Collection<Property> getProperties(Name name)
public Collection<Property> getProperties(String name)
public Property getProperty(Name name)
public Property getProperty(String name)
public Collection<? extends Property> getValue()
public void setValue(Collection<Property> value)
public AttributeDescriptor getDescriptor()
public Name getName()
public Map<Object,Object> getUserData()
public boolean isNillable()
public void setValue(Object value)
public void validate()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |