PostGIS  2.5.0dev-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 640 of file lwstroke.c.

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, ovdump::type, and LWGEOM::type.

Referenced by lwcurve_linearize().

643 {
644  LWCOLLECTION *ocol;
645  LWGEOM *tmp;
646  LWGEOM **geoms;
647  uint32_t i;
648 
649  LWDEBUG(2, "lwcollection_linearize called.");
650 
651  geoms = lwalloc(sizeof(LWGEOM *)*collection->ngeoms);
652 
653  for (i=0; i<collection->ngeoms; i++)
654  {
655  tmp = collection->geoms[i];
656  switch (tmp->type)
657  {
658  case CIRCSTRINGTYPE:
659  geoms[i] = (LWGEOM *)lwcircstring_linearize((LWCIRCSTRING *)tmp, tol, type, flags);
660  break;
661  case COMPOUNDTYPE:
662  geoms[i] = (LWGEOM *)lwcompound_linearize((LWCOMPOUND *)tmp, tol, type, flags);
663  break;
664  case CURVEPOLYTYPE:
665  geoms[i] = (LWGEOM *)lwcurvepoly_linearize((LWCURVEPOLY *)tmp, tol, type, flags);
666  break;
667  case MULTICURVETYPE:
668  case MULTISURFACETYPE:
669  case COLLECTIONTYPE:
670  geoms[i] = (LWGEOM *)lwcollection_linearize((LWCOLLECTION *)tmp, tol, type, flags);
671  break;
672  default:
673  geoms[i] = lwgeom_clone_deep(tmp);
674  break;
675  }
676  }
677  ocol = lwcollection_construct(COLLECTIONTYPE, collection->srid, NULL, collection->ngeoms, geoms);
678  return ocol;
679 }
#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
#define CURVEPOLYTYPE
Definition: liblwgeom.h:93
#define COMPOUNDTYPE
Definition: liblwgeom.h:92
static LWLINE * lwcompound_linearize(const LWCOMPOUND *icompound, double tol, LW_LINEARIZE_TOLERANCE_TYPE tolerance_type, int flags)
Definition: lwstroke.c:420
static LWPOLY * lwcurvepoly_linearize(const LWCURVEPOLY *curvepoly, double tol, LW_LINEARIZE_TOLERANCE_TYPE tolerance_type, int flags)
Definition: lwstroke.c:485
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
LWGEOM * lwgeom_clone_deep(const LWGEOM *lwgeom)
Deep clone an LWGEOM, everything is copied.
Definition: lwgeom.c:520
uint32_t ngeoms
Definition: liblwgeom.h:509
unsigned int uint32_t
Definition: uthash.h:78
LWGEOM ** geoms
Definition: liblwgeom.h:511
static LWLINE * lwcircstring_linearize(const LWCIRCSTRING *icurve, double tol, LW_LINEARIZE_TOLERANCE_TYPE tolerance_type, int flags)
Definition: lwstroke.c:360
int32_t srid
Definition: liblwgeom.h:508
#define MULTISURFACETYPE
Definition: liblwgeom.h:95
uint8_t type
Definition: liblwgeom.h:398
type
Definition: ovdump.py:41
static LWCOLLECTION * lwcollection_linearize(const LWCOLLECTION *collection, double tol, LW_LINEARIZE_TOLERANCE_TYPE type, int flags)
Definition: lwstroke.c:640
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:91
void * lwalloc(size_t size)
Definition: lwutil.c:229
#define COLLECTIONTYPE
Definition: liblwgeom.h:90
Here is the call graph for this function:
Here is the caller graph for this function: