PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwmline_unstroke()

LWGEOM * lwmline_unstroke ( const LWMLINE mline)

Definition at line 786 of file lwstroke.c.

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

Referenced by lwgeom_unstroke().

787 {
788  LWGEOM **geoms;
789  int i, hascurve = 0;
790 
791  LWDEBUG(2, "lwmline_unstroke called.");
792 
793  geoms = lwalloc(sizeof(LWGEOM *)*mline->ngeoms);
794  for (i=0; i<mline->ngeoms; i++)
795  {
796  geoms[i] = lwline_unstroke((LWLINE *)mline->geoms[i]);
797  if (geoms[i]->type == CIRCSTRINGTYPE || geoms[i]->type == COMPOUNDTYPE)
798  {
799  hascurve = 1;
800  }
801  }
802  if (hascurve == 0)
803  {
804  for (i=0; i<mline->ngeoms; i++)
805  {
806  lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
807  }
808  return lwgeom_clone((LWGEOM *)mline);
809  }
810  return (LWGEOM *)lwcollection_construct(MULTICURVETYPE, mline->srid, NULL, mline->ngeoms, geoms);
811 }
#define MULTICURVETYPE
Definition: liblwgeom.h:80
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:214
#define COMPOUNDTYPE
Definition: liblwgeom.h:78
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
int ngeoms
Definition: liblwgeom.h:465
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
Definition: lwgeom.c:395
LWLINE ** geoms
Definition: liblwgeom.h:467
LWGEOM * lwline_unstroke(const LWLINE *line)
Definition: lwstroke.c:748
type
Definition: ovdump.py:41
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:77
void * lwalloc(size_t size)
Definition: lwutil.c:199
int32_t srid
Definition: liblwgeom.h:464
Here is the call graph for this function:
Here is the caller graph for this function: