PostGIS  2.1.10dev-r@@SVN_REVISION@@
Datum LWGEOM_curve_segmentize ( PG_FUNCTION_ARGS  )

Definition at line 54 of file lwgeom_sqlmm.c.

References geometry_serialize(), lwgeom_free(), lwgeom_from_gserialized(), and lwgeom_segmentize().

55 {
56  GSERIALIZED *geom = (GSERIALIZED *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
57  int32 perQuad = PG_GETARG_INT32(1);
58  GSERIALIZED *ret;
59  LWGEOM *igeom = NULL, *ogeom = NULL;
60 
61  POSTGIS_DEBUG(2, "LWGEOM_curve_segmentize called.");
62 
63  if (perQuad < 0)
64  {
65  elog(ERROR, "2nd argument must be positive.");
66  PG_RETURN_NULL();
67  }
68 
69  POSTGIS_DEBUGF(3, "perQuad = %d", perQuad);
70 
71  igeom = lwgeom_from_gserialized(geom);
72  ogeom = lwgeom_segmentize(igeom, perQuad);
73  lwgeom_free(igeom);
74 
75  if (ogeom == NULL)
76  PG_RETURN_NULL();
77 
78  ret = geometry_serialize(ogeom);
79  lwgeom_free(ogeom);
80  PG_FREE_IF_COPY(geom, 0);
81  PG_RETURN_POINTER(ret);
82 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1006
LWGEOM * lwgeom_segmentize(LWGEOM *geom, uint32_t perQuad)
Definition: lwsegmentize.c:446
LWGEOM * geom
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)

Here is the call graph for this function: