PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ _lwt_split_by_nodes()

static LWGEOM* _lwt_split_by_nodes ( const LWGEOM g,
const LWGEOM nodes 
)
static

Definition at line 5598 of file lwgeom_topo.c.

References LWCOLLECTION::geoms, lwgeom_as_lwcollection(), lwgeom_clone_deep(), lwgeom_free(), lwgeom_split(), LWCOLLECTION::ngeoms, and LWGEOM::srid.

Referenced by lwt_AddLine().

5599 {
5600  LWCOLLECTION *col = lwgeom_as_lwcollection(nodes);
5601  int i;
5602  LWGEOM *bg;
5603 
5604  bg = lwgeom_clone_deep(g);
5605  if ( ! col->ngeoms ) return bg;
5606 
5607  for (i=0; i<col->ngeoms; ++i)
5608  {
5609  LWGEOM *g2;
5610  g2 = lwgeom_split(bg, col->geoms[i]);
5611  lwgeom_free(bg);
5612  bg = g2;
5613  }
5614  bg->srid = nodes->srid;
5615 
5616  return bg;
5617 }
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1099
LWGEOM * lwgeom_clone_deep(const LWGEOM *lwgeom)
Deep clone an LWGEOM, everything is copied.
Definition: lwgeom.c:482
int32_t srid
Definition: liblwgeom.h:399
LWGEOM ** geoms
Definition: liblwgeom.h:509
LWCOLLECTION * lwgeom_as_lwcollection(const LWGEOM *lwgeom)
Definition: lwgeom.c:192
LWGEOM * lwgeom_split(const LWGEOM *lwgeom_in, const LWGEOM *blade_in)
Here is the call graph for this function:
Here is the caller graph for this function: