GEOS  3.3.3
SIRtree.h
1 /**********************************************************************
2  * $Id: SIRtree.h 2961 2010-03-29 12:17:37Z mloskot $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2006 Refractions Research Inc.
8  *
9  * This is free software; you can redistribute and/or modify it under
10  * the terms of the GNU Lesser General Public Licence as published
11  * by the Free Software Foundation.
12  * See the COPYING file for more information.
13  *
14  **********************************************************************/
15 
16 #ifndef GEOS_INDEX_STRTREE_SIRTREE_H
17 #define GEOS_INDEX_STRTREE_SIRTREE_H
18 
19 #include <geos/export.h>
20 
21 #include <geos/index/strtree/AbstractSTRtree.h> // for inheritance
22 #include <geos/index/strtree/Interval.h> // for inline
23 
24 #include <vector>
25 #include <memory>
26 
27 namespace geos {
28 namespace index { // geos::index
29 namespace strtree { // geos::index::strtree
30 
42 class GEOS_DLL SIRtree: public AbstractSTRtree {
45 
46 public:
47 
51  SIRtree();
52 
57  SIRtree(std::size_t nodeCapacity);
58 
59  virtual ~SIRtree();
60 
61  void insert(double x1, double x2, void* item);
62 
67  std::vector<void*>* query(double x1, double x2)
68  {
69  std::vector<void*>* results = new std::vector<void*>();
70  Interval interval(std::min(x1, x2), std::max(x1, x2));
71  AbstractSTRtree::query(&interval, *results);
72  return results;
73  }
74 
78  std::vector<void*>* query(double x) { return query(x,x); }
79 
80 
81 protected:
82 
83  class SIRIntersectsOp:public AbstractSTRtree::IntersectsOp {
84  public:
85  bool intersects(const void* aBounds, const void* bBounds);
86  };
87 
92  std::auto_ptr<BoundableList> createParentBoundables(
93  BoundableList* childBoundables, int newLevel);
94 
95  AbstractNode* createNode(int level);
96 
97  IntersectsOp* getIntersectsOp() {return intersectsOp;};
98 
99  std::auto_ptr<BoundableList> sortBoundables(const BoundableList* input);
100 
101 private:
102 
103  IntersectsOp* intersectsOp;
104 };
105 
106 
107 } // namespace geos::index::strtree
108 } // namespace geos::index
109 } // namespace geos
110 
111 #endif // GEOS_INDEX_STRTREE_SIRTREE_H
112 
113 /**********************************************************************
114  * $Log$
115  * Revision 1.2 2006/06/12 10:49:43 strk
116  * unsigned int => size_t
117  *
118  * Revision 1.1 2006/03/21 10:47:34 strk
119  * indexStrtree.h split
120  *
121  **********************************************************************/
122