/****************************************************************************
* rtbasic.h :
* header file for basic RTree classes.
*
* Change Log :
* 09-17-1997 Initial version, Liujian Qian
*
* $Id: rtbasic.h,v 1.3 1998/07/19 19:03:30 qian Exp $
***************************************************************************/
#ifndef _RTBASIC_H_
#define _RTBASIC_H_
#include "gadt_rect.h"
#include "gdatapipe.h"
///
//root page's id is always 1.
//the first page (with page no. 0) in the rtree
//index file, however, contains global info.
//
#define RT_ROOT_PAGE 1
//impossibly high
#define RT_MAX_LEVEL 16
///
// the size of an RT page; 8192 bytes default
//
#define RTPAGE_SZ 8192
///
// maximum number of entries in a rt node
//
#define MAX_ETS (RTPAGE_SZ/(4*8+12))
///
// Each RTree node is stored in one page, identified by a page id
//
typedef long PageID;
///
// the penalty defined as the enlargement in MBR caused by the
// insertion of a new entry into a node
//
typedef double RPenalty;
///
// Each entry in a RTree node consists of a pair of
// (RKey, RPtr), where RKey is a (minimum bounding) rectangle
//
typedef GRect RKey;
class REntry;
/**
this class defines RTree searching predicates.
This class is used to construct search predicates for RTree.
It consists of an "operator" (op), and a window (rectangle) that
is to be compared with the entries in the index.
An entry "e" in the RTree index satisfies the predicate if the
expression (const_key OP e) evaluates to be true.
The supported types of operators are:
EQUALS: for exact match (based on MBRs)
OVERLAPS: true if the window overlaps with the entry
The two types of queries below are not very useful for RTrees
but are provided anyway; but the result may not be correct.
CONTAINS: return entries that contains the window
WITHIN: return entries that are within the window
Note that the entries in the RTree use the minimum bounding
rectangle as the abstraction of real spatial objects. As such
the results returned by a search should be further examined to see
if the predicate holds true with the real representation of the
object. In some literature, this further examination is called
"refinement", while the procedure of searching the RTree is called
the "filtering" step.
*/
class RPred
{
public:
/**
*/
enum Op { BAD=-1, EQUALS=0, OVERLAPS=1, CONTAINS=2, WITHIN=3 };
/**
* the operator to be performed on candidate records
*/
Op op;
/**
* querying window
*/
RKey window;
/**
*/
NOP RPred (Op o=BAD) : op(o) {};
/**
*/
NOP RPred (Op o, RKey key) : op(o), window(key) {};
/**
*/
RPred& operator=(const RPred& p)
{
op = p.op, window = p.window;
return *this;
}
};
#endif
Documentation generated by lqian@lqian-sun on Wed Jul 14 09:36:10 EDT 1999