PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ make_strtree()

static struct STRTree make_strtree ( void **  geoms,
uint32_t  num_geoms,
char  is_lwgeom 
)
static

Make a GEOSSTRtree that stores a pointer to a variable containing the array index of the input geoms.

Definition at line 61 of file lwgeom_geos_cluster.c.

82 {
83  struct STRTree tree;
84  tree.envelopes = 0;
85  tree.num_geoms = 0;
86  tree.geom_ids = 0;
87 
88  tree.tree = GEOSSTRtree_create(STRTREE_NODE_CAPACITY);
89  if (tree.tree == NULL)
90  {
91  return tree;
92  }
93  tree.geom_ids = lwalloc(num_geoms * sizeof(uint32_t));
94  tree.num_geoms = num_geoms;
95 
96  if (is_lwgeom)
97  {
98  uint32_t i;
99  tree.envelopes = lwalloc(num_geoms * sizeof(GEOSGeometry*));
100  for (i = 0; i < num_geoms; i++)
101  {
102  tree.geom_ids[i] = i;
103  tree.envelopes[i] = geos_envelope_surrogate(geoms[i]);
104  GEOSSTRtree_insert(tree.tree, tree.envelopes[i], &(tree.geom_ids[i]));
105  }
106  }
107  else
108  {
109  uint32_t i;
110  tree.envelopes = NULL;
111  for (i = 0; i < num_geoms; i++)
112  {
113  tree.geom_ids[i] = i;
114  GEOSSTRtree_insert(tree.tree, geoms[i], &(tree.geom_ids[i]));
115  }
116  }
117 
118  return tree;
119 }
void * lwalloc(size_t size)
Definition: lwutil.c:229
static GEOSGeometry * geos_envelope_surrogate(const LWGEOM *g)
static const int STRTREE_NODE_CAPACITY
uint32_t num_geoms
GEOSSTRtree * tree
unsigned int uint32_t
Definition: uthash.h:78

Referenced by union_dbscan_general(), union_dbscan_minpoints_1(), and union_intersecting_pairs().

Here is the caller graph for this function: