PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ rect_tree_from_lwpoly()

static RECT_NODE * rect_tree_from_lwpoly ( const LWGEOM lwgeom)
static

Definition at line 745 of file lwtree.c.

746{
747 RECT_NODE **nodes;
748 RECT_NODE *tree;
749 uint32_t i, j = 0;
750 const LWPOLY *lwpoly = (const LWPOLY*)lwgeom;
751
752 if (lwpoly->nrings < 1)
753 return NULL;
754
755 nodes = lwalloc(sizeof(RECT_NODE*) * lwpoly->nrings);
756 for (i = 0; i < lwpoly->nrings; i++)
757 {
758 RECT_NODE *node = rect_tree_from_ptarray(lwpoly->rings[i], lwgeom->type);
759 if (node)
760 {
762 nodes[j++] = node;
763 }
764 }
765 tree = rect_nodes_merge(nodes, j);
766 tree->geom_type = lwgeom->type;
767 lwfree(nodes);
768 return tree;
769}
void * lwalloc(size_t size)
Definition lwutil.c:227
void lwfree(void *mem)
Definition lwutil.c:248
RECT_NODE * rect_tree_from_ptarray(const POINTARRAY *pa, int geom_type)
Definition lwtree.c:632
static RECT_NODE * rect_nodes_merge(RECT_NODE **nodes, uint32_t num_nodes)
Definition lwtree.c:596
@ RECT_NODE_RING_EXTERIOR
Definition lwtree.h:36
@ RECT_NODE_RING_INTERIOR
Definition lwtree.h:37
uint8_t type
Definition liblwgeom.h:462
POINTARRAY ** rings
Definition liblwgeom.h:519
uint32_t nrings
Definition liblwgeom.h:524
RECT_NODE_RING_TYPE ring_type
Definition lwtree.h:60
RECT_NODE_INTERNAL i
Definition lwtree.h:75
unsigned char geom_type
Definition lwtree.h:68

References rect_node::geom_type, rect_node::i, lwalloc(), lwfree(), LWPOLY::nrings, RECT_NODE_RING_EXTERIOR, RECT_NODE_RING_INTERIOR, rect_nodes_merge(), rect_tree_from_ptarray(), RECT_NODE_INTERNAL::ring_type, LWPOLY::rings, and LWGEOM::type.

Referenced by rect_tree_from_lwgeom().

Here is the call graph for this function:
Here is the caller graph for this function: