00001 /********************************************************************** 00002 * $Id: spatialIndex.h,v 1.4 2004/10/26 17:46:18 strk Exp $ 00003 * 00004 * GEOS - Geometry Engine Open Source 00005 * http://geos.refractions.net 00006 * 00007 * Copyright (C) 2001-2002 Vivid Solutions Inc. 00008 * 00009 * This is free software; you can redistribute and/or modify it under 00010 * the terms of the GNU Lesser General Public Licence as published 00011 * by the Free Software Foundation. 00012 * See the COPYING file for more information. 00013 * 00014 ********************************************************************** 00015 * $Log: spatialIndex.h,v $ 00016 * Revision 1.4 2004/10/26 17:46:18 strk 00017 * Removed slash-stars in comments to remove annoying compiler warnings. 00018 * 00019 * Revision 1.3 2004/07/27 16:35:46 strk 00020 * Geometry::getEnvelopeInternal() changed to return a const Envelope *. 00021 * This should reduce object copies as once computed the envelope of a 00022 * geometry remains the same. 00023 * 00024 * Revision 1.2 2004/07/19 13:19:31 strk 00025 * Documentation fixes 00026 * 00027 * Revision 1.1 2004/07/02 13:20:42 strk 00028 * Header files moved under geos/ dir. 00029 * 00030 * Revision 1.6 2004/04/19 15:14:45 strk 00031 * Added missing virtual destructor in SpatialIndex class. 00032 * Memory leaks fixes. Const and throw specifications added. 00033 * 00034 * Revision 1.5 2004/03/25 02:23:55 ybychkov 00035 * All "index/" packages upgraded to JTS 1.4 00036 * 00037 * Revision 1.4 2003/11/07 01:23:42 pramsey 00038 * Add standard CVS headers licence notices and copyrights to all cpp and h 00039 * files. 00040 * 00041 * 00042 **********************************************************************/ 00043 00044 00045 #ifndef GEOS_INDEX_H 00046 #define GEOS_INDEX_H 00047 00048 #include <memory> 00049 #include <geos/platform.h> 00050 #include <geos/geom.h> 00051 00052 using namespace std; 00053 00054 namespace geos { 00055 00056 /* 00057 * The basic insertion and query operations supported by classes 00058 * implementing spatial index algorithms. 00059 * <p> 00060 * A spatial index typically provides a primary filter for range rectangle queries. A 00061 * secondary filter is required to test for exact intersection. Of course, this 00062 * secondary filter may consist of other tests besides intersection, such as 00063 * testing other kinds of spatial relationships. 00064 * 00065 */ 00066 class SpatialIndex { 00067 public: 00068 virtual ~SpatialIndex() {}; 00069 00070 /* 00071 * Adds a spatial item with an extent specified by the given Envelope 00072 * to the index 00073 */ 00074 virtual void insert(const Envelope *itemEnv, void *item)=0; 00075 00076 /* 00077 * Queries the index for all items whose extents intersect the given search {@link Envelope} 00078 * Note that some kinds of indexes may also return objects which do not in fact 00079 * intersect the query envelope. 00080 * 00081 * @param searchEnv the envelope to query for 00082 * @return a list of the items found by the query 00083 */ 00084 virtual vector<void*>* query(const Envelope *searchEnv)=0; 00085 00086 }; 00087 } 00088 00089 #endif 00090