2418{
2424 int64_t which;
2425
2426 POSTGIS_DEBUG(2, "LWGEOM_setpoint_linestring called.");
2427
2428
2429 pglwg1 = PG_GETARG_GSERIALIZED_P_COPY(0);
2430
2431 which = PG_GETARG_INT32(1);
2432 pglwg2 = PG_GETARG_GSERIALIZED_P(2);
2433
2434
2437 if (!lwpoint)
2438 {
2439 elog(ERROR, "Third argument must be a POINT");
2440 PG_RETURN_NULL();
2441 }
2444 PG_FREE_IF_COPY(pglwg2, 2);
2445
2448
2449 if (!line)
2450 {
2451 elog(ERROR, "First argument must be a LINESTRING");
2452 PG_RETURN_NULL();
2453 }
2454
2456 elog(ERROR, "Line has no points");
2457 PG_RETURN_NULL();
2458 }
2459
2460 if (which < 0)
2461 {
2462
2464 }
2466 {
2467 elog(ERROR,
"abs(Point index) out of range (-)(%u..%u)", 0, line->
points->
npoints - 1);
2468 PG_RETURN_NULL();
2469 }
2470
2471
2472
2473
2476
2477
2479 pfree(pglwg1);
2480
2481 PG_RETURN_POINTER(
result);
2482}
char result[OUT_DOUBLE_BUFFER_SIZE]
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)