1
// Spatial Index Library
3
// Copyright (C) 2002 Navel Ltd.
5
// This library is free software; you can redistribute it and/or
6
// modify it under the terms of the GNU Lesser General Public
7
// License as published by the Free Software Foundation; either
8
// version 2.1 of the License, or (at your option) any later version.
10
// This library is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
// Lesser General Public License for more details.
15
// You should have received a copy of the GNU Lesser General Public
16
// License along with this library; if not, write to the Free Software
17
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
#ifndef __spatialindex_rtree_index_h
23
#define __spatialindex_rtree_index_h
25
namespace SpatialIndex
29
class Index : public Node
35
Index( RTree* pTree, long id, unsigned long level );
37
virtual NodePtr chooseSubtree( const Region& mbr, unsigned long level, std::stack<long>& pathBuffer );
38
virtual NodePtr findLeaf( const Region& mbr, long id, std::stack<long>& pathBuffer );
40
virtual void split( unsigned long dataLength, byte* pData, Region& mbr, long id, NodePtr& left, NodePtr& right );
42
long findLeastEnlargement( const Region& ) const;
43
long findLeastOverlap( const Region& ) const;
45
void adjustTree( Node*, std::stack<long>& );
46
void adjustTree( Node*, Node*, std::stack<long>&, byte* overflowTable );
58
static int compareEntries( const void* pv1, const void* pv2 )
60
OverlapEntry* pe1 = * ( OverlapEntry** ) pv1;
61
OverlapEntry* pe2 = * ( OverlapEntry** ) pv2;
63
if ( pe1->m_enlargement < pe2->m_enlargement ) return -1;
64
if ( pe1->m_enlargement > pe2->m_enlargement ) return 1;
71
friend class BulkLoader;
76
#endif /*__spatialindex_rtree_index_h*/