PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ lwmline_unstroke()

LWGEOM * lwmline_unstroke ( const LWMLINE mline)

Definition at line 802 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().

803 {
804  LWGEOM **geoms;
805  int i, hascurve = 0;
806 
807  LWDEBUG(2, "lwmline_unstroke called.");
808 
809  geoms = lwalloc(sizeof(LWGEOM *)*mline->ngeoms);
810  for (i=0; i<mline->ngeoms; i++)
811  {
812  geoms[i] = lwline_unstroke((LWLINE *)mline->geoms[i]);
813  if (geoms[i]->type == CIRCSTRINGTYPE || geoms[i]->type == COMPOUNDTYPE)
814  {
815  hascurve = 1;
816  }
817  }
818  if (hascurve == 0)
819  {
820  for (i=0; i<mline->ngeoms; i++)
821  {
822  lwfree(geoms[i]); /* TODO: should this be lwgeom_free instead ? */
823  }
824  return lwgeom_clone((LWGEOM *)mline);
825  }
826  return (LWGEOM *)lwcollection_construct(MULTICURVETYPE, mline->srid, NULL, mline->ngeoms, geoms);
827 }
#define MULTICURVETYPE
Definition: liblwgeom.h:94
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
Definition: lwcollection.c:43
void lwfree(void *mem)
Definition: lwutil.c:242
#define COMPOUNDTYPE
Definition: liblwgeom.h:92
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
int ngeoms
Definition: liblwgeom.h:480
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
Definition: lwgeom.c:408
LWLINE ** geoms
Definition: liblwgeom.h:482
LWGEOM * lwline_unstroke(const LWLINE *line)
Definition: lwstroke.c:764
type
Definition: ovdump.py:41
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:91
void * lwalloc(size_t size)
Definition: lwutil.c:227
int32_t srid
Definition: liblwgeom.h:479
Here is the call graph for this function:
Here is the caller graph for this function: