2293{
2299 int64_t which;
2300
2301 POSTGIS_DEBUG(2, "LWGEOM_setpoint_linestring called.");
2302
2303
2304 pglwg1 = PG_GETARG_GSERIALIZED_P_COPY(0);
2305
2306 which = PG_GETARG_INT32(1);
2307 pglwg2 = PG_GETARG_GSERIALIZED_P(2);
2308
2309
2312 if (!lwpoint)
2313 {
2314 elog(ERROR, "Third argument must be a POINT");
2315 PG_RETURN_NULL();
2316 }
2319 PG_FREE_IF_COPY(pglwg2, 2);
2320
2323
2324 if (!line)
2325 {
2326 elog(ERROR, "First argument must be a LINESTRING");
2327 PG_RETURN_NULL();
2328 }
2329
2331 elog(ERROR, "Line has no points");
2332 PG_RETURN_NULL();
2333 }
2334
2335 if (which < 0)
2336 {
2337
2339 }
2341 {
2342 elog(ERROR,
"abs(Point index) out of range (-)(%u..%u)", 0, line->
points->
npoints - 1);
2343 PG_RETURN_NULL();
2344 }
2345
2346
2347
2348
2351
2352
2354 pfree(pglwg1);
2355
2356 PG_RETURN_POINTER(result);
2357}
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwpoint_free(LWPOINT *pt)
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
void lwline_setPoint4d(LWLINE *line, uint32_t which, POINT4D *newpoint)
void lwline_free(LWLINE *line)
static LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)