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

# SIRtree.h

    00001 /**********************************************************************
    00002  * $Id: SIRtree.h 1971 2007-02-07 00:34:26Z 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/index/strtree/AbstractSTRtree.h> // for inheritance
    00020 #include <geos/index/strtree/Interval.h> // for inline
    00021
    00022 #include <vector>
    00023 #include <memory>
    00024
    00025 namespace geos {
    00026 namespace index { // geos::index
    00027 namespace strtree { // geos::index::strtree
    00028
    00040 class SIRtree: public AbstractSTRtree {
    00041 using AbstractSTRtree::insert;
    00042 using AbstractSTRtree::query;
    00043
    00044 public:
    00045
    00049         SIRtree();
    00050
    00055         SIRtree(size_t nodeCapacity);
    00056
    00057         virtual ~SIRtree();
    00058
    00059         void insert(double x1, double x2, void* item);
    00060
    00065         std::vector<void*>* query(double x1, double x2)
    00066         {
    00067                 std::vector<void*>* results = new std::vector<void*>();
    00068                 Interval interval(std::min(x1, x2), std::max(x1, x2));
    00069                 AbstractSTRtree::query(&interval, *results);
    00070                 return results;
    00071         }
    00072
    00076         std::vector<void*>* query(double x) { return query(x,x); }
    00077
    00078
    00079 protected:
    00080
    00081         class SIRIntersectsOp:public AbstractSTRtree::IntersectsOp {
    00082         public:
    00083                 bool intersects(const void* aBounds, const void* bBounds);
    00084         };
    00085
    00090         std::auto_ptr<BoundableList> createParentBoundables(
    00091                         BoundableList* childBoundables, int newLevel);
    00092
    00093         AbstractNode* createNode(int level);
    00094
    00095         IntersectsOp* getIntersectsOp() {return intersectsOp;};
    00096
    00097         std::auto_ptr<BoundableList> sortBoundables(const BoundableList* input);
    00098
    00099 private:
    00100
    00101         IntersectsOp* intersectsOp;
    00102 };
    00103
    00104
    00105 } // namespace geos::index::strtree
    00106 } // namespace geos::index
    00107 } // namespace geos
    00108
    00109 #endif // GEOS_INDEX_STRTREE_SIRTREE_H
    00110
    00111 /**********************************************************************
    00112  * $Log$
    00113  * Revision 1.2  2006/06/12 10:49:43  strk
    00114  * unsigned int => size_t
    00115  *
    00116  * Revision 1.1  2006/03/21 10:47:34  strk
    00117  * indexStrtree.h split
    00118  *
    00119  **********************************************************************/
    00120