PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwcollection_calculate_circ_tree()

static CIRC_NODE* lwcollection_calculate_circ_tree ( const LWCOLLECTION lwcol)
static

Definition at line 960 of file lwgeodetic_tree.c.

961 {
962  uint32_t i = 0, j = 0;
963  CIRC_NODE** nodes;
964  CIRC_NODE* node;
965 
966  /* One geometry? Done! */
967  if ( lwcol->ngeoms == 1 )
968  return lwgeom_calculate_circ_tree(lwcol->geoms[0]);
969 
970  /* Calculate a tree for each sub-geometry*/
971  nodes = lwalloc(lwcol->ngeoms * sizeof(CIRC_NODE*));
972  for ( i = 0; i < lwcol->ngeoms; i++ )
973  {
974  node = lwgeom_calculate_circ_tree(lwcol->geoms[i]);
975  if ( node )
976  nodes[j++] = node;
977  }
978  /* Put the trees into a spatially correlated order */
979  circ_nodes_sort(nodes, j);
980  /* Merge the trees pairwise up to a parent node and return */
981  node = circ_nodes_merge(nodes, j);
982  /* Don't need the working list any more */
983  lwfree(nodes);
984  node->geom_type = lwgeom_get_type((LWGEOM*)lwcol);
985  return node;
986 }
uint32_t lwgeom_get_type(const LWGEOM *geom)
Return LWTYPE number.
Definition: lwgeom.c:923
void lwfree(void *mem)
Definition: lwutil.c:244
void * lwalloc(size_t size)
Definition: lwutil.c:229
CIRC_NODE * lwgeom_calculate_circ_tree(const LWGEOM *lwgeom)
static CIRC_NODE * circ_nodes_merge(CIRC_NODE **nodes, int num_nodes)
static void circ_nodes_sort(CIRC_NODE **nodes, int num_nodes)
Given a list of nodes, sort them into a spatially consistent order, then pairwise merge them up into ...
uint32_t ngeoms
Definition: liblwgeom.h:510
LWGEOM ** geoms
Definition: liblwgeom.h:512
uint32_t geom_type
Note that p1 and p2 are pointers into an independent POINTARRAY, do not free them.
unsigned int uint32_t
Definition: uthash.h:78

References circ_nodes_merge(), circ_nodes_sort(), circ_node::geom_type, LWCOLLECTION::geoms, lwalloc(), lwfree(), lwgeom_calculate_circ_tree(), lwgeom_get_type(), LWCOLLECTION::ngeoms, and sort_node::node.

Referenced by lwgeom_calculate_circ_tree().

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