00001 /********************************************************************** 00002 * $Id: spatialIndex.h,v 1.3 2004/07/27 16:35:46 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.3 2004/07/27 16:35:46 strk 00017 * Geometry::getEnvelopeInternal() changed to return a const Envelope *. 00018 * This should reduce object copies as once computed the envelope of a 00019 * geometry remains the same. 00020 * 00021 * Revision 1.2 2004/07/19 13:19:31 strk 00022 * Documentation fixes 00023 * 00024 * Revision 1.1 2004/07/02 13:20:42 strk 00025 * Header files moved under geos/ dir. 00026 * 00027 * Revision 1.6 2004/04/19 15:14:45 strk 00028 * Added missing virtual destructor in SpatialIndex class. 00029 * Memory leaks fixes. Const and throw specifications added. 00030 * 00031 * Revision 1.5 2004/03/25 02:23:55 ybychkov 00032 * All "index/*" packages upgraded to JTS 1.4 00033 * 00034 * Revision 1.4 2003/11/07 01:23:42 pramsey 00035 * Add standard CVS headers licence notices and copyrights to all cpp and h 00036 * files. 00037 * 00038 * 00039 **********************************************************************/ 00040 00041 00042 #ifndef GEOS_INDEX_H 00043 #define GEOS_INDEX_H 00044 00045 #include <memory> 00046 #include <geos/platform.h> 00047 #include <geos/geom.h> 00048 00049 using namespace std; 00050 00051 namespace geos { 00052 00053 /* 00054 * The basic insertion and query operations supported by classes 00055 * implementing spatial index algorithms. 00056 * <p> 00057 * A spatial index typically provides a primary filter for range rectangle queries. A 00058 * secondary filter is required to test for exact intersection. Of course, this 00059 * secondary filter may consist of other tests besides intersection, such as 00060 * testing other kinds of spatial relationships. 00061 * 00062 */ 00063 class SpatialIndex { 00064 public: 00065 virtual ~SpatialIndex() {}; 00066 00067 /* 00068 * Adds a spatial item with an extent specified by the given Envelope 00069 * to the index 00070 */ 00071 virtual void insert(const Envelope *itemEnv, void *item)=0; 00072 00073 /* 00074 * Queries the index for all items whose extents intersect the given search {@link Envelope} 00075 * Note that some kinds of indexes may also return objects which do not in fact 00076 * intersect the query envelope. 00077 * 00078 * @param searchEnv the envelope to query for 00079 * @return a list of the items found by the query 00080 */ 00081 virtual vector<void*>* query(const Envelope *searchEnv)=0; 00082 00083 }; 00084 } 00085 00086 #endif 00087