File Coverage

/usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux/CPP/geos.x/i/geos/index/SpatialIndex.h
Criterion Covered Total %
statement 1 2 50.0
branch 0 2 0.0
condition n/a
subroutine n/a
pod n/a
total 1 4 25.0


line stmt bran cond sub pod time code
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_SPATIALINDEX_H
16             #define GEOS_INDEX_SPATIALINDEX_H
17              
18             #include
19              
20             #include
21              
22             // Forward declarations
23             namespace geos {
24             namespace geom {
25             class Envelope;
26             }
27             namespace index {
28             class ItemVisitor;
29             }
30             }
31              
32             namespace geos {
33             namespace index {
34              
35             /** \brief
36             * Abstract class defines basic insertion and query operations supported by
37             * classes implementing spatial index algorithms.
38             *
39             * A spatial index typically provides a primary filter for range rectangle queries. A
40             * secondary filter is required to test for exact intersection. Of course, this
41             * secondary filter may consist of other tests besides intersection, such as
42             * testing other kinds of spatial relationships.
43             *
44             * Last port: index/SpatialIndex.java rev. 1.11 (JTS-1.7)
45             *
46             */
47 6           class GEOS_DLL SpatialIndex {
48             public:
49              
50 0 0         virtual ~SpatialIndex() {}
51              
52             /** \brief
53             * Adds a spatial item with an extent specified by the given Envelope
54             * to the index
55             *
56             * @param itemEnv
57             * Envelope of the item, ownership left to caller.
58             * TODO: Reference hold by this class ?
59             *
60             * @param item
61             * Opaque item, ownership left to caller.
62             * Reference hold by this class.
63             */
64             virtual void insert(const geom::Envelope *itemEnv, void *item) = 0;
65              
66             /** \brief
67             * Queries the index for all items whose extents intersect the given search Envelope
68             *
69             * Note that some kinds of indexes may also return objects which do not in fact
70             * intersect the query envelope.
71             *
72             * @param searchEnv the envelope to query for
73             * @return a list of the items found by the query in a newly allocated vector
74             */
75             //virtual std::vector* query(const geom::Envelope *searchEnv)=0;
76             virtual void query(const geom::Envelope* searchEnv, std::vector&) = 0;
77              
78             /** \brief
79             * Queries the index for all items whose extents intersect the given search Envelope
80             * and applies an ItemVisitor to them.
81             *
82             * Note that some kinds of indexes may also return objects which do not in fact
83             * intersect the query envelope.
84             *
85             * @param searchEnv the envelope to query for
86             * @param visitor a visitor object to apply to the items found
87             */
88             virtual void query(const geom::Envelope *searchEnv, ItemVisitor& visitor) = 0;
89              
90             /** \brief
91             * Removes a single item from the tree.
92             *
93             * @param itemEnv the Envelope of the item to remove
94             * @param item the item to remove
95             * @return true if the item was found
96             */
97             virtual bool remove(const geom::Envelope* itemEnv, void* item) = 0;
98              
99             };
100              
101              
102             } // namespace geos.index
103             } // namespace geos
104              
105             #endif // GEOS_INDEX_SPATIALINDEX_H
106