PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ ST_CurveToLine()

Datum ST_CurveToLine ( PG_FUNCTION_ARGS  )

Definition at line 101 of file lwgeom_sqlmm.c.

References geometry_serialize(), lwcurve_linearize(), lwgeom_free(), lwgeom_from_gserialized(), LWGEOM_line_desegmentize(), and PG_FUNCTION_INFO_V1().

Referenced by LWGEOM_curve_segmentize().

102 {
103  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
104  double tol = PG_GETARG_FLOAT8(1);
105  int toltype = PG_GETARG_INT32(2);
106  int flags = PG_GETARG_INT32(3);
107  GSERIALIZED *ret;
108  LWGEOM *igeom = NULL, *ogeom = NULL;
109 
110  POSTGIS_DEBUG(2, "ST_CurveToLine called.");
111 
112  POSTGIS_DEBUGF(3, "tol = %g, typ = %d, flg = %d", tol, toltype, flags);
113 
114  igeom = lwgeom_from_gserialized(geom);
115  ogeom = lwcurve_linearize(igeom, tol, toltype, flags);
116  lwgeom_free(igeom);
117 
118  if (ogeom == NULL)
119  PG_RETURN_NULL();
120 
121  ret = geometry_serialize(ogeom);
122  lwgeom_free(ogeom);
123  PG_FREE_IF_COPY(geom, 0);
124  PG_RETURN_POINTER(ret);
125 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1099
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
LWGEOM * lwcurve_linearize(const LWGEOM *geom, double tol, LW_LINEARIZE_TOLERANCE_TYPE type, int flags)
Definition: lwstroke.c:734
Here is the call graph for this function:
Here is the caller graph for this function: