PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ 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 796 of file lwstroke.c.

799{
800 LWCOLLECTION *ocol;
801 LWGEOM *tmp;
802 LWGEOM **geoms;
803 uint32_t i;
804
805 LWDEBUG(2, "lwcollection_linearize called.");
806
807 geoms = lwalloc(sizeof(LWGEOM *)*collection->ngeoms);
808
809 for (i=0; i<collection->ngeoms; i++)
810 {
811 tmp = collection->geoms[i];
812 switch (tmp->type)
813 {
814 case CIRCSTRINGTYPE:
815 geoms[i] = (LWGEOM *)lwcircstring_linearize((LWCIRCSTRING *)tmp, tol, type, flags);
816 break;
817 case COMPOUNDTYPE:
818 geoms[i] = (LWGEOM *)lwcompound_linearize((LWCOMPOUND *)tmp, tol, type, flags);
819 break;
820 case CURVEPOLYTYPE:
821 geoms[i] = (LWGEOM *)lwcurvepoly_linearize((LWCURVEPOLY *)tmp, tol, type, flags);
822 break;
823 case MULTICURVETYPE:
824 case MULTISURFACETYPE:
825 case COLLECTIONTYPE:
826 geoms[i] = (LWGEOM *)lwcollection_linearize((LWCOLLECTION *)tmp, tol, type, flags);
827 break;
828 default:
829 geoms[i] = lwgeom_clone_deep(tmp);
830 break;
831 }
832 }
833 ocol = lwcollection_construct(COLLECTIONTYPE, collection->srid, NULL, collection->ngeoms, geoms);
834 return ocol;
835}
LWCOLLECTION * lwcollection_construct(uint8_t type, int32_t srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
#define COLLECTIONTYPE
Definition liblwgeom.h:108
#define COMPOUNDTYPE
Definition liblwgeom.h:110
#define CURVEPOLYTYPE
Definition liblwgeom.h:111
#define MULTISURFACETYPE
Definition liblwgeom.h:113
void * lwalloc(size_t size)
Definition lwutil.c:227
#define CIRCSTRINGTYPE
Definition liblwgeom.h:109
#define MULTICURVETYPE
Definition liblwgeom.h:112
LWGEOM * lwgeom_clone_deep(const LWGEOM *lwgeom)
Deep clone an LWGEOM, everything is copied.
Definition lwgeom.c:557
#define LWDEBUG(level, msg)
Definition lwgeom_log.h:101
static LWCOLLECTION * lwcollection_linearize(const LWCOLLECTION *collection, double tol, LW_LINEARIZE_TOLERANCE_TYPE type, int flags)
Definition lwstroke.c:796
static LWPOLY * lwcurvepoly_linearize(const LWCURVEPOLY *curvepoly, double tol, LW_LINEARIZE_TOLERANCE_TYPE tolerance_type, int flags)
Definition lwstroke.c:641
static LWLINE * lwcircstring_linearize(const LWCIRCSTRING *icurve, double tol, LW_LINEARIZE_TOLERANCE_TYPE tolerance_type, int flags)
Definition lwstroke.c:524
static LWLINE * lwcompound_linearize(const LWCOMPOUND *icompound, double tol, LW_LINEARIZE_TOLERANCE_TYPE tolerance_type, int flags)
Definition lwstroke.c:584
uint32_t ngeoms
Definition liblwgeom.h:580
LWGEOM ** geoms
Definition liblwgeom.h:575
int32_t srid
Definition liblwgeom.h:576
uint8_t type
Definition liblwgeom.h:462

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

Referenced by lwcollection_linearize(), and lwcurve_linearize().

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