PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ LWGEOM_curve_segmentize()

Datum LWGEOM_curve_segmentize ( PG_FUNCTION_ARGS  )

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

54 {
55  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
56  int32 perQuad = PG_GETARG_INT32(1);
57  GSERIALIZED *ret;
58  LWGEOM *igeom = NULL, *ogeom = NULL;
59 
60  POSTGIS_DEBUG(2, "LWGEOM_curve_segmentize called.");
61 
62  if (perQuad < 0)
63  {
64  elog(ERROR, "2nd argument must be positive.");
65  PG_RETURN_NULL();
66  }
67 
68  POSTGIS_DEBUGF(3, "perQuad = %d", perQuad);
69 
70  igeom = lwgeom_from_gserialized(geom);
71  ogeom = lwgeom_stroke(igeom, perQuad);
72  lwgeom_free(igeom);
73 
74  if (ogeom == NULL)
75  PG_RETURN_NULL();
76 
77  ret = geometry_serialize(ogeom);
78  lwgeom_free(ogeom);
79  PG_FREE_IF_COPY(geom, 0);
80  PG_RETURN_POINTER(ret);
81 }
LWGEOM * lwgeom_stroke(const LWGEOM *geom, uint32_t perQuad)
Definition: lwstroke.c:446
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:1050
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
Here is the call graph for this function:
Here is the caller graph for this function: