PostGIS  2.1.10dev-r@@SVN_REVISION@@
LWGEOM * lwmline_desegmentize ( LWMLINE mline)

Definition at line 785 of file lwsegmentize.c.

References CIRCSTRINGTYPE, COMPOUNDTYPE, LWMLINE::geoms, lwalloc(), lwcollection_construct(), LWDEBUG, lwfree(), lwgeom_clone(), lwline_desegmentize(), MULTICURVETYPE, LWMLINE::ngeoms, and LWMLINE::srid.

Referenced by lwgeom_desegmentize().

786 {
787  LWGEOM **geoms;
788  int i, hascurve = 0;
789 
790  LWDEBUG(2, "lwmline_desegmentize called.");
791 
792  geoms = lwalloc(sizeof(LWGEOM *)*mline->ngeoms);
793  for (i=0; i<mline->ngeoms; i++)
794  {
795  geoms[i] = lwline_desegmentize((LWLINE *)mline->geoms[i]);
796  if (geoms[i]->type == CIRCSTRINGTYPE || geoms[i]->type == COMPOUNDTYPE)
797  {
798  hascurve = 1;
799  }
800  }
801  if (hascurve == 0)
802  {
803  for (i=0; i<mline->ngeoms; i++)
804  {
805  lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
806  }
807  return lwgeom_clone((LWGEOM *)mline);
808  }
809  return (LWGEOM *)lwcollection_construct(MULTICURVETYPE, mline->srid, NULL, mline->ngeoms, geoms);
810 }
#define MULTICURVETYPE
Definition: liblwgeom.h:70
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
Definition: lwcollection.c:30
void lwfree(void *mem)
Definition: lwutil.c:190
#define COMPOUNDTYPE
Definition: liblwgeom.h:68
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
int ngeoms
Definition: liblwgeom.h:437
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
Definition: lwgeom.c:351
LWGEOM * lwline_desegmentize(LWLINE *line)
Definition: lwsegmentize.c:747
LWLINE ** geoms
Definition: liblwgeom.h:439
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:67
void * lwalloc(size_t size)
Definition: lwutil.c:175
int32_t srid
Definition: liblwgeom.h:436

Here is the call graph for this function:

Here is the caller graph for this function: