PostGIS  3.0.6dev-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 784 of file lwstroke.c.

787 {
788  LWCOLLECTION *ocol;
789  LWGEOM *tmp;
790  LWGEOM **geoms;
791  uint32_t i;
792 
793  LWDEBUG(2, "lwcollection_linearize called.");
794 
795  geoms = lwalloc(sizeof(LWGEOM *)*collection->ngeoms);
796 
797  for (i=0; i<collection->ngeoms; i++)
798  {
799  tmp = collection->geoms[i];
800  switch (tmp->type)
801  {
802  case CIRCSTRINGTYPE:
803  geoms[i] = (LWGEOM *)lwcircstring_linearize((LWCIRCSTRING *)tmp, tol, type, flags);
804  break;
805  case COMPOUNDTYPE:
806  geoms[i] = (LWGEOM *)lwcompound_linearize((LWCOMPOUND *)tmp, tol, type, flags);
807  break;
808  case CURVEPOLYTYPE:
809  geoms[i] = (LWGEOM *)lwcurvepoly_linearize((LWCURVEPOLY *)tmp, tol, type, flags);
810  break;
811  case MULTICURVETYPE:
812  case MULTISURFACETYPE:
813  case COLLECTIONTYPE:
814  geoms[i] = (LWGEOM *)lwcollection_linearize((LWCOLLECTION *)tmp, tol, type, flags);
815  break;
816  default:
817  geoms[i] = lwgeom_clone_deep(tmp);
818  break;
819  }
820  }
821  ocol = lwcollection_construct(COLLECTIONTYPE, collection->srid, NULL, collection->ngeoms, geoms);
822  return ocol;
823 }
#define COLLECTIONTYPE
Definition: liblwgeom.h:122
#define COMPOUNDTYPE
Definition: liblwgeom.h:124
#define CURVEPOLYTYPE
Definition: liblwgeom.h:125
#define MULTISURFACETYPE
Definition: liblwgeom.h:127
LWGEOM * lwgeom_clone_deep(const LWGEOM *lwgeom)
Deep clone an LWGEOM, everything is copied.
Definition: lwgeom.c:511
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:123
#define MULTICURVETYPE
Definition: liblwgeom.h:126
void * lwalloc(size_t size)
Definition: lwutil.c:227
LWCOLLECTION * lwcollection_construct(uint8_t type, int32_t srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
Definition: lwcollection.c:42
#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:512
static LWLINE * lwcompound_linearize(const LWCOMPOUND *icompound, double tol, LW_LINEARIZE_TOLERANCE_TYPE tolerance_type, int flags)
Definition: lwstroke.c:572
static LWCOLLECTION * lwcollection_linearize(const LWCOLLECTION *collection, double tol, LW_LINEARIZE_TOLERANCE_TYPE type, int flags)
Definition: lwstroke.c:784
static LWPOLY * lwcurvepoly_linearize(const LWCURVEPOLY *curvepoly, double tol, LW_LINEARIZE_TOLERANCE_TYPE tolerance_type, int flags)
Definition: lwstroke.c:629
type
Definition: ovdump.py:42
uint32_t ngeoms
Definition: liblwgeom.h:566
LWGEOM ** geoms
Definition: liblwgeom.h:561
int32_t srid
Definition: liblwgeom.h:562
uint8_t type
Definition: liblwgeom.h:448

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: