2391{
2397 int64_t which;
2398
2399 POSTGIS_DEBUG(2, "LWGEOM_setpoint_linestring called.");
2400
2401
2402 pglwg1 = PG_GETARG_GSERIALIZED_P_COPY(0);
2403
2404 which = PG_GETARG_INT32(1);
2405 pglwg2 = PG_GETARG_GSERIALIZED_P(2);
2406
2407
2410 if (!lwpoint)
2411 {
2412 elog(ERROR, "Third argument must be a POINT");
2413 PG_RETURN_NULL();
2414 }
2417 PG_FREE_IF_COPY(pglwg2, 2);
2418
2421
2422 if (!line)
2423 {
2424 elog(ERROR, "First argument must be a LINESTRING");
2425 PG_RETURN_NULL();
2426 }
2427
2429 elog(ERROR, "Line has no points");
2430 PG_RETURN_NULL();
2431 }
2432
2433 if (which < 0)
2434 {
2435
2437 }
2439 {
2440 elog(ERROR,
"abs(Point index) out of range (-)(%u..%u)", 0, line->
points->
npoints - 1);
2441 PG_RETURN_NULL();
2442 }
2443
2444
2445
2446
2449
2450
2452 pfree(pglwg1);
2453
2454 PG_RETURN_POINTER(
result);
2455}
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)