001: /*
002: * The Unified Mapping Platform (JUMP) is an extensible, interactive GUI
003: * for visualizing and manipulating spatial features with geometry and attributes.
004: *
005: * Copyright (C) 2003 Vivid Solutions
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License
009: * as published by the Free Software Foundation; either version 2
010: * of the License, or (at your option) any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
015: * GNU General Public License for more details.
016: *
017: * You should have received a copy of the GNU General Public License
018: * along with this program; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
020: *
021: * For more information, contact:
022: *
023: * Vivid Solutions
024: * Suite #1A
025: * 2328 Government Street
026: * Victoria BC V8T 5G5
027: * Canada
028: *
029: * (250)385-6040
030: * www.vividsolutions.com
031: */
032:
033: package com.vividsolutions.jump.feature;
034:
035: import java.util.*;
036:
037: import com.vividsolutions.jts.geom.Envelope;
038:
039: /**
040: * A collection of Features, with a special method for querying the Features
041: * that lie within a given Envelope.
042: */
043: public interface FeatureCollection {
044: /**
045: * Returns information about this FeatureCollection
046: * @return the types of the attributes of the features in this collection
047: */
048: FeatureSchema getFeatureSchema();
049:
050: /**
051: * Returns the bounds of this collection.
052: * @return the smallest Envelope enclosing all the Features in this collection
053: */
054: Envelope getEnvelope();
055:
056: /**
057: * Returns the number of features in this collection.
058: * @return the number of features in this collection
059: */
060: int size();
061:
062: /**
063: * Returns whether this collection has no features.
064: * @return whether or not the size of this collection is 0
065: */
066: boolean isEmpty();
067:
068: /**
069: * Returns an unmodifiable List of the features in this collection
070: * @return a read-only view of all the features
071: */
072: List getFeatures();
073:
074: /**
075: * Returns an Iterator over the features
076: * @return an Iterator over the features
077: */
078: Iterator iterator();
079:
080: /**
081: * A quick search for features, using an envelope comparison.
082: * @param envelope the envelope to query against
083: * @return features whose envelopes intersect the given envelope
084: */
085: List query(Envelope envelope);
086:
087: /**
088: * Adds a feature to this collection.
089: * @param feature a Feature to add to the end of this collection
090: */
091: void add(Feature feature);
092:
093: /**
094: * Adds multiple features to this collection. To be preferred over #add for
095: * adding multiple features, because in some systems (like the JUMP Workbench)
096: * fewer events will be fired.
097: */
098: void addAll(Collection features);
099:
100: /**
101: * Removes multiple features from this collection. To be preferred over #remove for
102: * removing multiple features, because in some systems (like the JUMP Workbench)
103: * fewer events will be fired.
104: */
105: void removeAll(Collection features);
106:
107: /**
108: * Removes a feature from this collection.
109: * @param feature a Feature to remove from this collection
110: */
111: void remove(Feature feature);
112:
113: /**
114: * Removes all features from this collection.
115: */
116: void clear();
117:
118: /**
119: * Removes the features which intersect the given envelope
120: * @return the removed features
121: */
122: Collection remove(Envelope env);
123: }
|