PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ LWGEOM_curve_segmentize()

Datum LWGEOM_curve_segmentize ( PG_FUNCTION_ARGS  )

Definition at line 67 of file lwgeom_sqlmm.c.

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

Referenced by LWGEOM_has_arc().

68 {
69  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
70  int32 perQuad = PG_GETARG_INT32(1);
71  GSERIALIZED *ret;
72  LWGEOM *igeom = NULL, *ogeom = NULL;
73 
74  POSTGIS_DEBUG(2, "LWGEOM_curve_segmentize called.");
75 
76  if (perQuad < 0)
77  {
78  elog(ERROR, "2nd argument must be positive.");
79  PG_RETURN_NULL();
80  }
81 
82  POSTGIS_DEBUGF(3, "perQuad = %d", perQuad);
83 
84  igeom = lwgeom_from_gserialized(geom);
85  ogeom = lwgeom_stroke(igeom, perQuad);
86  lwgeom_free(igeom);
87 
88  if (ogeom == NULL)
89  PG_RETURN_NULL();
90 
91  ret = geometry_serialize(ogeom);
92  lwgeom_free(ogeom);
93  PG_FREE_IF_COPY(geom, 0);
94  PG_RETURN_POINTER(ret);
95 }
LWGEOM * lwgeom_stroke(const LWGEOM *geom, uint32_t perQuad)
Definition: lwstroke.c:462
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:1063
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
Here is the call graph for this function:
Here is the caller graph for this function: