PostGIS  2.4.9dev-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 692 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, ovdump::type, and LWGEOM::type.

Referenced by lwcurve_linearize().

695 {
696  LWCOLLECTION *ocol;
697  LWGEOM *tmp;
698  LWGEOM **geoms;
699  int i;
700 
701  LWDEBUG(2, "lwcollection_linearize called.");
702 
703  geoms = lwalloc(sizeof(LWGEOM *)*collection->ngeoms);
704 
705  for (i=0; i<collection->ngeoms; i++)
706  {
707  tmp = collection->geoms[i];
708  switch (tmp->type)
709  {
710  case CIRCSTRINGTYPE:
711  geoms[i] = (LWGEOM *)lwcircstring_linearize((LWCIRCSTRING *)tmp, tol, type, flags);
712  break;
713  case COMPOUNDTYPE:
714  geoms[i] = (LWGEOM *)lwcompound_linearize((LWCOMPOUND *)tmp, tol, type, flags);
715  break;
716  case CURVEPOLYTYPE:
717  geoms[i] = (LWGEOM *)lwcurvepoly_linearize((LWCURVEPOLY *)tmp, tol, type, flags);
718  break;
719  case MULTICURVETYPE:
720  case MULTISURFACETYPE:
721  case COLLECTIONTYPE:
722  geoms[i] = (LWGEOM *)lwcollection_linearize((LWCOLLECTION *)tmp, tol, type, flags);
723  break;
724  default:
725  geoms[i] = lwgeom_clone(tmp);
726  break;
727  }
728  }
729  ocol = lwcollection_construct(COLLECTIONTYPE, collection->srid, NULL, collection->ngeoms, geoms);
730  return ocol;
731 }
#define MULTICURVETYPE
Definition: liblwgeom.h:95
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
Definition: lwcollection.c:43
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
#define COMPOUNDTYPE
Definition: liblwgeom.h:93
static LWLINE * lwcompound_linearize(const LWCOMPOUND *icompound, double tol, LW_LINEARIZE_TOLERANCE_TYPE tolerance_type, int flags)
Definition: lwstroke.c:472
static LWPOLY * lwcurvepoly_linearize(const LWCURVEPOLY *curvepoly, double tol, LW_LINEARIZE_TOLERANCE_TYPE tolerance_type, int flags)
Definition: lwstroke.c:537
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
LWGEOM ** geoms
Definition: liblwgeom.h:509
static LWLINE * lwcircstring_linearize(const LWCIRCSTRING *icurve, double tol, LW_LINEARIZE_TOLERANCE_TYPE tolerance_type, int flags)
Definition: lwstroke.c:412
int32_t srid
Definition: liblwgeom.h:506
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
Definition: lwgeom.c:444
#define MULTISURFACETYPE
Definition: liblwgeom.h:96
uint8_t type
Definition: liblwgeom.h:396
type
Definition: ovdump.py:41
static LWCOLLECTION * lwcollection_linearize(const LWCOLLECTION *collection, double tol, LW_LINEARIZE_TOLERANCE_TYPE type, int flags)
Definition: lwstroke.c:692
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
void * lwalloc(size_t size)
Definition: lwutil.c:229
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
Here is the call graph for this function:
Here is the caller graph for this function: