Class FeatureDataset
- java.lang.Object
-
- org.locationtech.jts.jump.feature.FeatureDataset
-
- All Implemented Interfaces:
Serializable,FeatureCollection
public class FeatureDataset extends Object implements FeatureCollection, Serializable
Default implementation of FeatureCollection.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FeatureDataset(Collection newFeatures, FeatureSchema featureSchema)Creates a FeatureDataset, initialized with a group of Features.FeatureDataset(FeatureSchema featureSchema)Creates a FeatureDataset.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Feature feature)Adds a feature to this collection.voidaddAll(Collection features)Adds multiple features to this collection.voidclear()Removes all features from this collection.booleancontains(Feature feature)Returns whether or not this Feature is in this collectionorg.locationtech.jts.geom.EnvelopegetEnvelope()Because the envelope is cached, the envelope may be incorrect if you later change a Feature's geometry using Feature#setGeometry.FeaturegetFeature(int index)Returns the Feature at the given index (zero-based).ListgetFeatures()Returns an unmodifiable List of the features in this collectionFeatureSchemagetFeatureSchema()Returns information about this FeatureCollectionvoidinvalidateEnvelope()Clears the cached envelope of this FeatureDataset's Features.booleanisEmpty()Returns whether this collection has no features.Iteratoriterator()Returns an Iterator over the featuresListquery(org.locationtech.jts.geom.Envelope envelope)A quick search for features, using an envelope comparison.Collectionremove(org.locationtech.jts.geom.Envelope env)Removes the features which intersect the given envelopevoidremove(Feature feature)Removes a feature from this collection.voidremoveAll(Collection features)Removes multiple features from this collection.intsize()Returns the number of features in this collection.
-
-
-
Constructor Detail
-
FeatureDataset
public FeatureDataset(Collection newFeatures, FeatureSchema featureSchema)
Creates a FeatureDataset, initialized with a group of Features.- Parameters:
newFeatures- an initial group of features to add to this FeatureDatasetfeatureSchema- the types of the attributes of the features in this collection
-
FeatureDataset
public FeatureDataset(FeatureSchema featureSchema)
Creates a FeatureDataset.- Parameters:
featureSchema- the types of the attributes of the features in this collection
-
-
Method Detail
-
getFeature
public Feature getFeature(int index)
Returns the Feature at the given index (zero-based).
-
getFeatureSchema
public FeatureSchema getFeatureSchema()
Description copied from interface:FeatureCollectionReturns information about this FeatureCollection- Specified by:
getFeatureSchemain interfaceFeatureCollection- Returns:
- the types of the attributes of the features in this collection
-
getEnvelope
public org.locationtech.jts.geom.Envelope getEnvelope()
Because the envelope is cached, the envelope may be incorrect if you later change a Feature's geometry using Feature#setGeometry.- Specified by:
getEnvelopein interfaceFeatureCollection- Returns:
- the smallest Envelope enclosing all the Features in this collection
-
getFeatures
public List getFeatures()
Description copied from interface:FeatureCollectionReturns an unmodifiable List of the features in this collection- Specified by:
getFeaturesin interfaceFeatureCollection- Returns:
- a read-only view of all the features
-
isEmpty
public boolean isEmpty()
Description copied from interface:FeatureCollectionReturns whether this collection has no features.- Specified by:
isEmptyin interfaceFeatureCollection- Returns:
- whether or not the size of this collection is 0
-
query
public List query(org.locationtech.jts.geom.Envelope envelope)
Description copied from interface:FeatureCollectionA quick search for features, using an envelope comparison.- Specified by:
queryin interfaceFeatureCollection- Parameters:
envelope- the envelope to query against- Returns:
- a List containing the features whose envelopes intersect the given envelope
-
add
public void add(Feature feature)
Description copied from interface:FeatureCollectionAdds a feature to this collection.- Specified by:
addin interfaceFeatureCollection- Parameters:
feature- a Feature to add to the end of this collection
-
contains
public boolean contains(Feature feature)
Returns whether or not this Feature is in this collection- Returns:
- true if this feature is in this collection, as determined using Feature#equals
-
remove
public Collection remove(org.locationtech.jts.geom.Envelope env)
Removes the features which intersect the given envelope- Specified by:
removein interfaceFeatureCollection- Returns:
- the removed features
-
remove
public void remove(Feature feature)
Description copied from interface:FeatureCollectionRemoves a feature from this collection.- Specified by:
removein interfaceFeatureCollection- Parameters:
feature- a Feature to remove from this collection
-
clear
public void clear()
Removes all features from this collection.- Specified by:
clearin interfaceFeatureCollection
-
size
public int size()
Description copied from interface:FeatureCollectionReturns the number of features in this collection.- Specified by:
sizein interfaceFeatureCollection- Returns:
- the number of features in this collection
-
iterator
public Iterator iterator()
Description copied from interface:FeatureCollectionReturns an Iterator over the features- Specified by:
iteratorin interfaceFeatureCollection- Returns:
- an Iterator over the features
-
invalidateEnvelope
public void invalidateEnvelope()
Clears the cached envelope of this FeatureDataset's Features. Call this method when a Feature's Geometry is modified.
-
addAll
public void addAll(Collection features)
Description copied from interface:FeatureCollectionAdds multiple features to this collection. To be preferred over #add for adding multiple features, because in some systems (like the JUMP Workbench) fewer events will be fired.- Specified by:
addAllin interfaceFeatureCollection
-
removeAll
public void removeAll(Collection features)
Description copied from interface:FeatureCollectionRemoves multiple features from this collection. To be preferred over #remove for removing multiple features, because in some systems (like the JUMP Workbench) fewer events will be fired.- Specified by:
removeAllin interfaceFeatureCollection
-
-