125{
131 int preserve_endpoints=1;
132 int n_iterations=1;
133
135 PG_RETURN_POINTER(geom);
136
137 if ( (PG_NARGS()>1) && (!PG_ARGISNULL(1)) )
138 n_iterations = PG_GETARG_INT32(1);
139
140 if (n_iterations< 1 || n_iterations>5)
141 elog(ERROR,"Number of iterations must be between 1 and 5 : %s", __func__);
142
143 if ( (PG_NARGS()>2) && (!PG_ARGISNULL(2)) )
144 {
145 if(PG_GETARG_BOOL(2))
146 preserve_endpoints = 1;
147 else
148 preserve_endpoints = 0;
149 }
150
152
154 if ( ! out ) PG_RETURN_NULL();
155
156
158
159 result = geometry_serialize(out);
161 PG_FREE_IF_COPY(geom, 0);
162 PG_RETURN_POINTER(
result);
163}
char result[OUT_DOUBLE_BUFFER_SIZE]
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
uint32_t gserialized_get_type(const GSERIALIZED *g)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
void lwgeom_free(LWGEOM *geom)
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
LWGEOM * lwgeom_chaikin(const LWGEOM *igeom, int n_iterations, int preserve_endpoint)
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.