~ubuntu-branches/ubuntu/trusty/postgis/trusty-security

« back to all changes in this revision

Viewing changes to lwgeom/lwgeom_rtree.h

  • Committer: Bazaar Package Importer
  • Author(s): Francesco Paolo Lovergine
  • Date: 2009-12-11 13:10:34 UTC
  • mfrom: (1.1.9 upstream) (5.2.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20091211131034-wmsz69wxvt95pe5r
Tags: 1.4.0-2
* Upload to unstable.
* Better parameterized debian/rules against postgis $(VERSION).
* Added dblatex and libcunit1-dev among build-deps.
* Added postgis_comments.sql to contrib/ SQL templates.
* Dropping 8.3 support, no more supported for squeeze.
  (closes: #559587)
* Do not stop on error in postrm if the target dir does not exist.
  (closes: #560409)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef _LWGEOM_RTREE_H
2
 
#define _LWGEOM_RTREE_H
3
 
 
4
 
typedef struct
5
 
{
6
 
        double min;
7
 
        double max;
8
 
} INTERVAL;
9
 
 
10
 
/* Returns 1 if min < value <= max, 0 otherwise */
11
 
uint32 isContained(INTERVAL *interval, double value);
12
 
/* Creates an interval given the min and max values, in whatever order. */
13
 
INTERVAL *createInterval(double value1, double value2);
14
 
/* Creates an interval with the total extents of the two given intervals. */
15
 
INTERVAL *mergeIntervals(INTERVAL *inter1, INTERVAL *inter2);
16
 
 
17
 
/*
18
 
 * The following struct and methods are used for a 1D RTree implementation, 
19
 
 * described at:
20
 
 *  http://lin-ear-th-inking.blogspot.com/2007/06/packed-1-dimensional-r-tree.html
21
 
 */
22
 
typedef struct rtree_node
23
 
{
24
 
        INTERVAL *interval;
25
 
        struct rtree_node *leftNode;
26
 
        struct rtree_node *rightNode;
27
 
        LWLINE* segment;
28
 
} RTREE_NODE;
29
 
 
30
 
/* Creates an interior node given the children. */
31
 
RTREE_NODE *createInteriorNode(RTREE_NODE *left, RTREE_NODE *right);
32
 
/* Creates a leaf node given the pointer to the start point of the segment. */
33
 
RTREE_NODE *createLeafNode(POINTARRAY *pa, int startPoint);
34
 
/* 
35
 
 * Creates an rtree given a pointer to the point array. 
36
 
 * Must copy the point array. 
37
 
 */
38
 
RTREE_NODE *createTree(POINTARRAY *pointArray);
39
 
/* Frees the tree. */
40
 
void freeTree(RTREE_NODE *root);
41
 
/* Retrieves a collection of line segments given the root and crossing value. */
42
 
LWMLINE *findLineSegments(RTREE_NODE *root, double value);
43
 
/* Merges two multilinestrings into a single multilinestring. */
44
 
LWMLINE *mergeMultiLines(LWMLINE *line1, LWMLINE *line2);
45
 
 
46
 
typedef struct
47
 
{
48
 
        char type;
49
 
        RTREE_NODE **ringIndices;
50
 
        int ringCount;
51
 
        int polyCount;
52
 
        uchar *poly;
53
 
} RTREE_POLY_CACHE;
54
 
 
55
 
/* 
56
 
 * Creates a new cachable index if needed, or returns the current cache if
57
 
 * it is applicable to the current polygon.
58
 
 */
59
 
RTREE_POLY_CACHE *retrieveCache(LWGEOM *lwgeom, uchar *serializedPoly, RTREE_POLY_CACHE *currentCache);
60
 
RTREE_POLY_CACHE *createCache(void);
61
 
/* Frees the cache. */
62
 
void populateCache(RTREE_POLY_CACHE *cache, LWGEOM *lwgeom, uchar *serializedPoly);
63
 
void clearCache(RTREE_POLY_CACHE *cache);
64
 
 
65
 
#endif /* !defined _LIBLWGEOM_H */