PostGIS  2.5.2dev-r@@SVN_REVISION@@
lwtree.h
Go to the documentation of this file.
1 /**********************************************************************
2  *
3  * PostGIS - Spatial Types for PostgreSQL
4  * http://postgis.net
5  *
6  * PostGIS is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * PostGIS is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with PostGIS. If not, see <http://www.gnu.org/licenses/>.
18  *
19  **********************************************************************
20  *
21  * Copyright (C) 2009-2012 Paul Ramsey <pramsey@cleverelephant.ca>
22  *
23  **********************************************************************/
24 
25 #define RECT_NODE_SIZE 8
26 
27 typedef enum
28 {
32 
33 typedef enum
34 {
39 
40 typedef enum
41 {
47 
48 typedef struct
49 {
50  const POINTARRAY *pa;
52  int seg_num;
54 
55 struct rect_node;
56 
57 typedef struct
58 {
59  int num_nodes;
61  struct rect_node *nodes[RECT_NODE_SIZE];
62  int sorted;
64 
65 typedef struct rect_node
66 {
68  unsigned char geom_type;
69  double xmin;
70  double xmax;
71  double ymin;
72  double ymax;
73  double d;
74  union {
77  };
78 } RECT_NODE;
79 
81 {
82  double threshold;
83  double min_dist;
84  double max_dist;
88 
94 
99 
103 double rect_tree_distance_tree(RECT_NODE *n1, RECT_NODE *n2, double threshold);
104 
108 void rect_tree_free(RECT_NODE *node);
109 
110 int rect_tree_contains_point(RECT_NODE *tree, const POINT2D *pt);
112 LWGEOM * rect_tree_to_lwgeom(const RECT_NODE *tree);
113 char * rect_tree_to_wkt(const RECT_NODE *node);
114 void rect_tree_printf(const RECT_NODE *node, int depth);
RECT_NODE_SEG_TYPE
Definition: lwtree.h:40
const POINTARRAY * pa
Definition: lwtree.h:50
int rect_tree_contains_point(RECT_NODE *tree, const POINT2D *pt)
Definition: lwtree.c:398
RECT_NODE_SEG_TYPE seg_type
Definition: lwtree.h:51
unsigned char geom_type
Definition: lwtree.h:68
RECT_NODE_TYPE type
Definition: lwtree.h:67
RECT_NODE_LEAF l
Definition: lwtree.h:76
RECT_NODE_RING_TYPE ring_type
Definition: lwtree.h:60
double xmax
Definition: lwtree.h:70
LWGEOM * rect_tree_to_lwgeom(const RECT_NODE *tree)
Definition: lwtree.c:679
int rect_tree_intersects_tree(RECT_NODE *tree1, RECT_NODE *tree2)
Test if two RECT_NODE trees intersect one another.
Definition: lwtree.c:990
#define RECT_NODE_SIZE
Definition: lwtree.h:25
double ymax
Definition: lwtree.h:72
double d
Definition: lwtree.h:73
struct rect_node RECT_NODE
void rect_tree_printf(const RECT_NODE *node, int depth)
Definition: lwtree.c:709
RECT_NODE * rect_tree_from_lwgeom(const LWGEOM *geom)
Create a tree index on top an LWGEOM.
Definition: lwtree.c:861
RECT_NODE_INTERNAL i
Definition: lwtree.h:75
int seg_num
Definition: lwtree.h:52
char * rect_tree_to_wkt(const RECT_NODE *node)
Definition: lwtree.c:700
double xmin
Definition: lwtree.h:69
double ymin
Definition: lwtree.h:71
RECT_NODE_RING_TYPE
Definition: lwtree.h:33
void rect_tree_free(RECT_NODE *node)
Free the rect-tree memory.
Definition: lwtree.c:69
struct rect_tree_distance_state RECT_TREE_DISTANCE_STATE
double rect_tree_distance_tree(RECT_NODE *n1, RECT_NODE *n2, double threshold)
Return the distance between two RECT_NODE trees.
Definition: lwtree.c:1354
RECT_NODE * rect_tree_from_ptarray(const POINTARRAY *pa, int geom_type)
Definition: lwtree.c:632
RECT_NODE_TYPE
Definition: lwtree.h:27