- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

# SIRtree.h

    00001 /**********************************************************************
    00002  * $Id: SIRtree.h 2556 2009-06-06 22:22:28Z strk $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2006 Refractions Research 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
    00016 #ifndef GEOS_INDEX_STRTREE_SIRTREE_H
    00017 #define GEOS_INDEX_STRTREE_SIRTREE_H
    00018
    00019 #include <geos/export.h>
    00020
    00021 #include <geos/index/strtree/AbstractSTRtree.h> // for inheritance
    00022 #include <geos/index/strtree/Interval.h> // for inline
    00023
    00024 #include <vector>
    00025 #include <memory>
    00026
    00027 namespace geos {
    00028 namespace index { // geos::index
    00029 namespace strtree { // geos::index::strtree
    00030
    00042 class GEOS_DLL SIRtree: public AbstractSTRtree {
    00043 using AbstractSTRtree::insert;
    00044 using AbstractSTRtree::query;
    00045
    00046 public:
    00047
    00051         SIRtree();
    00052
    00057         SIRtree(size_t nodeCapacity);
    00058
    00059         virtual ~SIRtree();
    00060
    00061         void insert(double x1, double x2, void* item);
    00062
    00067         std::vector<void*>* query(double x1, double x2)
    00068         {
    00069                 std::vector<void*>* results = new std::vector<void*>();
    00070                 Interval interval(std::min(x1, x2), std::max(x1, x2));
    00071                 AbstractSTRtree::query(&interval, *results);
    00072                 return results;
    00073         }
    00074
    00078         std::vector<void*>* query(double x) { return query(x,x); }
    00079
    00080
    00081 protected:
    00082
    00083         class SIRIntersectsOp:public AbstractSTRtree::IntersectsOp {
    00084         public:
    00085                 bool intersects(const void* aBounds, const void* bBounds);
    00086         };
    00087
    00092         std::auto_ptr<BoundableList> createParentBoundables(
    00093                         BoundableList* childBoundables, int newLevel);
    00094
    00095         AbstractNode* createNode(int level);
    00096
    00097         IntersectsOp* getIntersectsOp() {return intersectsOp;};
    00098
    00099         std::auto_ptr<BoundableList> sortBoundables(const BoundableList* input);
    00100
    00101 private:
    00102
    00103         IntersectsOp* intersectsOp;
    00104 };
    00105
    00106
    00107 } // namespace geos::index::strtree
    00108 } // namespace geos::index
    00109 } // namespace geos
    00110
    00111 #endif // GEOS_INDEX_STRTREE_SIRTREE_H
    00112
    00113 /**********************************************************************
    00114  * $Log$
    00115  * Revision 1.2  2006/06/12 10:49:43  strk
    00116  * unsigned int => size_t
    00117  *
    00118  * Revision 1.1  2006/03/21 10:47:34  strk
    00119  * indexStrtree.h split
    00120  *
    00121  **********************************************************************/
    00122