GEOS: SIRtree.h Source File

GEOS 3.5.0

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

- File List

SIRtree.h
1 /**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2006 Refractions Research Inc.
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
12 *
13 **********************************************************************/
14
15 #ifndef GEOS_INDEX_STRTREE_SIRTREE_H
16 #define GEOS_INDEX_STRTREE_SIRTREE_H
17
18 #include <geos/export.h>
19
20 #include <geos/index/strtree/AbstractSTRtree.h> // for inheritance
21 #include <geos/index/strtree/Interval.h> // for inline
22
23 #include <vector>
24 #include <memory>
25
26 namespace geos {
27 namespace index { // geos::index
28 namespace strtree { // geos::index::strtree
29
41 class GEOS_DLL SIRtree: public AbstractSTRtree {
42 using AbstractSTRtree::insert;
43 using AbstractSTRtree::query;
44
45 public:
46
50 SIRtree();
51
56 SIRtree(std::size_t nodeCapacity);
57
58 virtual ~SIRtree();
59
60 void insert(double x1, double x2, void* item);
61
66 std::vector<void*>* query(double x1, double x2)
67 {
68 std::vector<void*>* results = new std::vector<void*>();
69 Interval interval(std::min(x1, x2), std::max(x1, x2));
70 AbstractSTRtree::query(&interval, *results);
71 return results;
72 }
73
77 std::vector<void*>* query(double x) { return query(x,x); }
78
79
80 protected:
81
82 class SIRIntersectsOp:public AbstractSTRtree::IntersectsOp {
83 public:
84 bool intersects(const void* aBounds, const void* bBounds);
85 };
86
91 std::auto_ptr<BoundableList> createParentBoundables(
92 BoundableList* childBoundables, int newLevel);
93
94 AbstractNode* createNode(int level);
95
96 IntersectsOp* getIntersectsOp() {return intersectsOp;}
97
98 std::auto_ptr<BoundableList> sortBoundables(const BoundableList* input);
99
100 private:
101
102 IntersectsOp* intersectsOp;
103 };
104
105
106 } // namespace geos::index::strtree
107 } // namespace geos::index
108 } // namespace geos
109
110 #endif // GEOS_INDEX_STRTREE_SIRTREE_H
geos::index::strtree::Interval
A contiguous portion of 1D-space. Used internally by SIRtree.
Definition: strtree/Interval.h:28
geos::index::strtree::SIRtree::query
std::vector< void * > * query(double x1, double x2)
Definition: SIRtree.h:66
geos::index::strtree::SIRtree::query
std::vector< void * > * query(double x)
Definition: SIRtree.h:77
geos::index::strtree::AbstractSTRtree
Base class for STRtree and SIRtree.
Definition: AbstractSTRtree.h:132
geos::index::strtree::AbstractSTRtree::query
void query(const void *searchBounds, std::vector< void * > &foundItems)
Also builds the tree, if necessary.
geos::index::strtree::SIRtree::getIntersectsOp
IntersectsOp * getIntersectsOp()
Definition: SIRtree.h:96
geos::index::strtree::AbstractSTRtree::IntersectsOp
A test for intersection between two bounds, necessary because subclasses of AbstractSTRtree have diff...
Definition: AbstractSTRtree.h:166
geos::index::strtree::AbstractSTRtree::insert
virtual void insert(const void *bounds, void *item)
Also builds the tree, if necessary.
geos
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
geos::index::strtree::SIRtree
One-dimensional version of an STR-packed R-tree.
Definition: SIRtree.h:41
geos::index::strtree::AbstractNode
A node of the STR tree.
Definition: AbstractNode.h:42
geos::index::strtree::BoundableList
std::vector< Boundable * > BoundableList
A list of boundables. TODO: use a list.
Definition: AbstractSTRtree.h:44