PostGIS  3.0.0dev-r@@SVN_REVISION@@

◆ ST_CurveToLine()

Datum ST_CurveToLine ( PG_FUNCTION_ARGS  )

Definition at line 100 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().

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