PostGIS  2.5.0dev-r@@SVN_REVISION@@
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 639 of file lwstroke.c.

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

Referenced by lwcurve_linearize().

642 {
643  LWCOLLECTION *ocol;
644  LWGEOM *tmp;
645  LWGEOM **geoms;
646  uint32_t i;
647 
648  LWDEBUG(2, "lwcollection_linearize called.");
649 
650  geoms = lwalloc(sizeof(LWGEOM *)*collection->ngeoms);
651 
652  for (i=0; i<collection->ngeoms; i++)
653  {
654  tmp = collection->geoms[i];
655  switch (tmp->type)
656  {
657  case CIRCSTRINGTYPE:
658  geoms[i] = (LWGEOM *)lwcircstring_linearize((LWCIRCSTRING *)tmp, tol, type, flags);
659  break;
660  case COMPOUNDTYPE:
661  geoms[i] = (LWGEOM *)lwcompound_linearize((LWCOMPOUND *)tmp, tol, type, flags);
662  break;
663  case CURVEPOLYTYPE:
664  geoms[i] = (LWGEOM *)lwcurvepoly_linearize((LWCURVEPOLY *)tmp, tol, type, flags);
665  break;
666  case MULTICURVETYPE:
667  case MULTISURFACETYPE:
668  case COLLECTIONTYPE:
669  geoms[i] = (LWGEOM *)lwcollection_linearize((LWCOLLECTION *)tmp, tol, type, flags);
670  break;
671  default:
672  geoms[i] = lwgeom_clone(tmp);
673  break;
674  }
675  }
676  ocol = lwcollection_construct(COLLECTIONTYPE, collection->srid, NULL, collection->ngeoms, geoms);
677  return ocol;
678 }
#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:419
static LWPOLY * lwcurvepoly_linearize(const LWCURVEPOLY *curvepoly, double tol, LW_LINEARIZE_TOLERANCE_TYPE tolerance_type, int flags)
Definition: lwstroke.c:484
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
uint32_t ngeoms
Definition: liblwgeom.h:506
unsigned int uint32_t
Definition: uthash.h:78
LWGEOM ** geoms
Definition: liblwgeom.h:508
static LWLINE * lwcircstring_linearize(const LWCIRCSTRING *icurve, double tol, LW_LINEARIZE_TOLERANCE_TYPE tolerance_type, int flags)
Definition: lwstroke.c:359
int32_t srid
Definition: liblwgeom.h:505
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
Definition: lwgeom.c:475
#define MULTISURFACETYPE
Definition: liblwgeom.h:95
uint8_t type
Definition: liblwgeom.h:395
static LWCOLLECTION * lwcollection_linearize(const LWCOLLECTION *collection, double tol, LW_LINEARIZE_TOLERANCE_TYPE type, int flags)
Definition: lwstroke.c:639
#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: