PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ LWGEOM_curve_segmentize()

Datum LWGEOM_curve_segmentize ( PG_FUNCTION_ARGS  )

Definition at line 69 of file lwgeom_sqlmm.c.

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

Referenced by LWGEOM_has_arc().

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_stroke(const LWGEOM *geom, uint32_t perQuad)
Definition: lwstroke.c:767
unsigned int int32
Definition: shpopen.c:273
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)
Here is the call graph for this function:
Here is the caller graph for this function: