35 #include "../postgis_config.h"
37 #include "lwgeom_pg.h"
57 PG_RETURN_BOOL(
result == 1);
72 int32 perQuad = PG_GETARG_INT32(1);
74 LWGEOM *igeom = NULL, *ogeom = NULL;
76 POSTGIS_DEBUG(2,
"LWGEOM_curve_segmentize called.");
80 elog(ERROR,
"2nd argument must be positive.");
84 POSTGIS_DEBUGF(3,
"perQuad = %d", perQuad);
93 ret = geometry_serialize(ogeom);
95 PG_FREE_IF_COPY(geom, 0);
96 PG_RETURN_POINTER(ret);
103 double tol = PG_GETARG_FLOAT8(1);
104 int toltype = PG_GETARG_INT32(2);
105 int flags = PG_GETARG_INT32(3);
107 LWGEOM *igeom = NULL, *ogeom = NULL;
109 POSTGIS_DEBUG(2,
"ST_CurveToLine called.");
111 POSTGIS_DEBUGF(3,
"tol = %g, typ = %d, flg = %d", tol, toltype, flags);
120 ret = geometry_serialize(ogeom);
122 PG_FREE_IF_COPY(geom, 0);
123 PG_RETURN_POINTER(ret);
131 LWGEOM *igeom = NULL, *ogeom = NULL;
133 POSTGIS_DEBUG(2,
"LWGEOM_line_desegmentize.");
141 PG_FREE_IF_COPY(geom, 0);
145 ret = geometry_serialize(ogeom);
147 PG_FREE_IF_COPY(geom, 0);
148 PG_RETURN_POINTER(ret);
168 int index = PG_GETARG_INT32(1);
172 if (index < 1 || (uint32_t)index > lwcmp->
ngeoms)
175 ret = geometry_serialize(subgeom);
176 PG_FREE_IF_COPY(geom, 0);
177 PG_RETURN_POINTER(ret);
char result[OUT_DOUBLE_BUFFER_SIZE]
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
const LWGEOM * lwcollection_getsubcurve(const LWCOMPOUND *compound, uint32_t gnum)
void lwgeom_free(LWGEOM *geom)
uint32_t lwcompound_num_curves(const LWCOMPOUND *compound)
LWGEOM * lwcurve_linearize(const LWGEOM *geom, double tol, LW_LINEARIZE_TOLERANCE_TYPE type, int flags)
LWGEOM * lwgeom_unstroke(const LWGEOM *geom)
Convert linearized type into arc type, de-linearizing the strokes where possible.
LWGEOM * lwgeom_stroke(const LWGEOM *geom, uint32_t perQuad)
Convert type with arcs into equivalent linearized type.
LWGEOM * lwgeom_clone(const LWGEOM *lwgeom)
Clone LWGEOM object.
int lwgeom_has_arc(const LWGEOM *geom)
Geometry includes at least one actual circular arc.
LWCOMPOUND * lwgeom_as_lwcompound(const LWGEOM *lwgeom)
This library is the generic geometry handling section of PostGIS.
Datum LWGEOM_has_arc(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(LWGEOM_has_arc)
Datum ST_CurveN(PG_FUNCTION_ARGS)
Datum ST_CurveToLine(PG_FUNCTION_ARGS)
Datum ST_NumCurves(PG_FUNCTION_ARGS)
Datum LWGEOM_line_desegmentize(PG_FUNCTION_ARGS)
Datum LWGEOM_curve_segmentize(PG_FUNCTION_ARGS)