MobilityDB 1.3
Loading...
Searching...
No Matches
Macros | Functions
rtree_example.c File Reference

A simple program that demonstrates the RTree index for searching MEOS bounding boxes: floatspan, tstzspan, tbox, stbox, and temporal types. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <meos.h>
#include <meos_geo.h>

Macros

#define MAX_LEN_BBOX   128
 
#define NUM_BBOX   10000
 

Functions

static bool contained_span_wrapper (const void *a, const void *b)
 
static bool contained_stbox_wrapper (const void *a, const void *b)
 
static bool contained_tbox_wrapper (const void *a, const void *b)
 
static bool contains_span_wrapper (const void *a, const void *b)
 
static bool contains_stbox_wrapper (const void *a, const void *b)
 
static bool contains_tbox_wrapper (const void *a, const void *b)
 
int main (void)
 
static bool overlaps_span_wrapper (const void *a, const void *b)
 
static bool overlaps_stbox_wrapper (const void *a, const void *b)
 
static bool overlaps_tbox_wrapper (const void *a, const void *b)
 
static int random_int (int min, int max)
 
static void test_floatspan (MeosArray *ids)
 
static void test_stbox (MeosArray *ids)
 
static void test_tbox (MeosArray *ids)
 
static void test_temporal (MeosArray *ids)
 Demonstrate rtree_insert_temporal / rtree_search_temporal with tfloat. More...
 
static void test_tstzspan (MeosArray *ids)
 
static void verify_search (const char *name, const RTree *rtree, RTreeSearchOp op, const void *query, const char *boxes, size_t bboxsize, MeosArray *ids, bool(*predicate)(const void *, const void *))
 Generic test harness: compare R-tree search results against a brute-force scan using the given predicate. More...
 

Detailed Description

A simple program that demonstrates the RTree index for searching MEOS bounding boxes: floatspan, tstzspan, tbox, stbox, and temporal types.

The program tests all bounding box types with OVERLAPS, CONTAINS, and CONTAINED_BY operations, inserting random boxes into the index and verifying search results against a brute-force scan. It also demonstrates the temporal convenience functions (rtree_insert_temporal, rtree_search_temporal) using tfloat sequences.

The program can be built as follows

gcc -Wall -g -I/usr/local/include -o rtree_example rtree_example.c -L/usr/local/lib -lmeos -lproj