PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ lwcollection_linearize()

static LWCOLLECTION* lwcollection_linearize ( const LWCOLLECTION collection,
double  tol,
LW_LINEARIZE_TOLERANCE_TYPE  type,
int  flags 
)
static
Parameters
collectioninput geometry collection
toltolerance, semantic driven by tolerance_type
tolerance_typesee LW_LINEARIZE_TOLERANCE_TYPE
flagssee flags in lwarc_linearize
Returns
a newly allocated LWCOLLECTION

Definition at line 693 of file lwstroke.c.

696 {
697  LWCOLLECTION *ocol;
698  LWGEOM *tmp;
699  LWGEOM **geoms;
700  uint32_t i;
701 
702  LWDEBUG(2, "lwcollection_linearize called.");
703 
704  geoms = lwalloc(sizeof(LWGEOM *)*collection->ngeoms);
705 
706  for (i=0; i<collection->ngeoms; i++)
707  {
708  tmp = collection->geoms[i];
709  switch (tmp->type)
710  {
711  case CIRCSTRINGTYPE:
712  geoms[i] = (LWGEOM *)lwcircstring_linearize((LWCIRCSTRING *)tmp, tol, type, flags);
713  break;
714  case COMPOUNDTYPE:
715  geoms[i] = (LWGEOM *)lwcompound_linearize((LWCOMPOUND *)tmp, tol, type, flags);
716  break;
717  case CURVEPOLYTYPE:
718  geoms[i] = (LWGEOM *)lwcurvepoly_linearize((LWCURVEPOLY *)tmp, tol, type, flags);
719  break;
720  case MULTICURVETYPE:
721  case MULTISURFACETYPE:
722  case COLLECTIONTYPE:
723  geoms[i] = (LWGEOM *)lwcollection_linearize((LWCOLLECTION *)tmp, tol, type, flags);
724  break;
725  default:
726  geoms[i] = lwgeom_clone_deep(tmp);
727  break;
728  }
729  }
730  ocol = lwcollection_construct(COLLECTIONTYPE, collection->srid, NULL, collection->ngeoms, geoms);
731  return ocol;
732 }
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
#define COMPOUNDTYPE
Definition: liblwgeom.h:93
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
#define MULTISURFACETYPE
Definition: liblwgeom.h:96
LWGEOM * lwgeom_clone_deep(const LWGEOM *lwgeom)
Deep clone an LWGEOM, everything is copied.
Definition: lwgeom.c:520
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
Definition: lwcollection.c:43
#define MULTICURVETYPE
Definition: liblwgeom.h:95
void * lwalloc(size_t size)
Definition: lwutil.c:229
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
static LWLINE * lwcircstring_linearize(const LWCIRCSTRING *icurve, double tol, LW_LINEARIZE_TOLERANCE_TYPE tolerance_type, int flags)
Definition: lwstroke.c:413
static LWLINE * lwcompound_linearize(const LWCOMPOUND *icompound, double tol, LW_LINEARIZE_TOLERANCE_TYPE tolerance_type, int flags)
Definition: lwstroke.c:473
static LWCOLLECTION * lwcollection_linearize(const LWCOLLECTION *collection, double tol, LW_LINEARIZE_TOLERANCE_TYPE type, int flags)
Definition: lwstroke.c:693
static LWPOLY * lwcurvepoly_linearize(const LWCURVEPOLY *curvepoly, double tol, LW_LINEARIZE_TOLERANCE_TYPE tolerance_type, int flags)
Definition: lwstroke.c:538
type
Definition: ovdump.py:41
uint32_t ngeoms
Definition: liblwgeom.h:510
LWGEOM ** geoms
Definition: liblwgeom.h:512
int32_t srid
Definition: liblwgeom.h:509
uint8_t type
Definition: liblwgeom.h:399
unsigned int uint32_t
Definition: uthash.h:78

References CIRCSTRINGTYPE, COLLECTIONTYPE, COMPOUNDTYPE, CURVEPOLYTYPE, LWCOLLECTION::geoms, lwalloc(), lwcircstring_linearize(), lwcollection_construct(), lwcompound_linearize(), lwcurvepoly_linearize(), LWDEBUG, lwgeom_clone_deep(), MULTICURVETYPE, MULTISURFACETYPE, LWCOLLECTION::ngeoms, LWCOLLECTION::srid, LWGEOM::type, and ovdump::type.

Referenced by lwcurve_linearize().

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