PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ rect_tree_to_lwgeom()

LWGEOM* rect_tree_to_lwgeom ( const RECT_NODE tree)

Definition at line 679 of file lwtree.c.

680 {
681  LWGEOM *poly = (LWGEOM*)lwpoly_construct_envelope(0, node->xmin, node->ymin, node->xmax, node->ymax);
682  if (rect_node_is_leaf(node))
683  {
684  return poly;
685  }
686  else
687  {
688  int i;
690  lwcollection_add_lwgeom(col, poly);
691  for (i = 0; i < node->i.num_nodes; i++)
692  {
693  lwcollection_add_lwgeom(col, rect_tree_to_lwgeom(node->i.nodes[i]));
694  }
695  return (LWGEOM*)col;
696  }
697 }
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm)
Definition: lwcollection.c:94
LWCOLLECTION * lwcollection_add_lwgeom(LWCOLLECTION *col, const LWGEOM *geom)
Appends geom to the collection managed by col.
Definition: lwcollection.c:187
LWPOLY * lwpoly_construct_envelope(int srid, double x1, double y1, double x2, double y2)
Definition: lwpoly.c:98
LWGEOM * rect_tree_to_lwgeom(const RECT_NODE *node)
Definition: lwtree.c:679
static int rect_node_is_leaf(const RECT_NODE *node)
Definition: lwtree.c:31

References COLLECTIONTYPE, rect_node::i, lwcollection_add_lwgeom(), lwcollection_construct_empty(), lwpoly_construct_envelope(), RECT_NODE_INTERNAL::nodes, RECT_NODE_INTERNAL::num_nodes, rect_node_is_leaf(), rect_node::xmax, rect_node::xmin, rect_node::ymax, and rect_node::ymin.

Referenced by rect_tree_to_wkt().

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