PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ LWGEOM_curve_segmentize()

Datum LWGEOM_curve_segmentize ( PG_FUNCTION_ARGS  )

Definition at line 69 of file lwgeom_sqlmm.c.

70 {
71  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
72  int32 perQuad = PG_GETARG_INT32(1);
73  GSERIALIZED *ret;
74  LWGEOM *igeom = NULL, *ogeom = NULL;
75 
76  POSTGIS_DEBUG(2, "LWGEOM_curve_segmentize called.");
77 
78  if (perQuad < 0)
79  {
80  elog(ERROR, "2nd argument must be positive.");
81  PG_RETURN_NULL();
82  }
83 
84  POSTGIS_DEBUGF(3, "perQuad = %d", perQuad);
85 
86  igeom = lwgeom_from_gserialized(geom);
87  ogeom = lwgeom_stroke(igeom, perQuad);
88  lwgeom_free(igeom);
89 
90  if (ogeom == NULL)
91  PG_RETURN_NULL();
92 
93  ret = geometry_serialize(ogeom);
94  lwgeom_free(ogeom);
95  PG_FREE_IF_COPY(geom, 0);
96  PG_RETURN_POINTER(ret);
97 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
LWGEOM * lwgeom_stroke(const LWGEOM *geom, uint32_t perQuad)
Definition: lwstroke.c:768
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
unsigned int int32
Definition: shpopen.c:273

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

Here is the call graph for this function: