PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ ST_WrapX()

Datum ST_WrapX ( PG_FUNCTION_ARGS  )

Definition at line 1050 of file lwgeom_functions_basic.c.

1051{
1052 Datum gdatum;
1053 GSERIALIZED *geom_in;
1054 LWGEOM *lwgeom_in, *lwgeom_out;
1055 GSERIALIZED *geom_out;
1056 double cutx;
1057 double amount;
1058
1059 POSTGIS_DEBUG(2, "ST_WrapX called.");
1060
1061 gdatum = PG_GETARG_DATUM(0);
1062 cutx = PG_GETARG_FLOAT8(1);
1063 amount = PG_GETARG_FLOAT8(2);
1064
1065 // if ( ! amount ) PG_RETURN_DATUM(gdatum);
1066
1067 geom_in = ((GSERIALIZED *)PG_DETOAST_DATUM(gdatum));
1068 lwgeom_in = lwgeom_from_gserialized(geom_in);
1069
1070 lwgeom_out = lwgeom_wrapx(lwgeom_in, cutx, amount);
1071 geom_out = geometry_serialize(lwgeom_out);
1072
1073 lwgeom_free(lwgeom_in);
1074 lwgeom_free(lwgeom_out);
1075 PG_FREE_IF_COPY(geom_in, 0);
1076
1077 PG_RETURN_POINTER(geom_out);
1078}
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1246
LWGEOM * lwgeom_wrapx(const LWGEOM *lwgeom, double cutx, double amount)
wrap geometry on given cut x value

References lwgeom_free(), lwgeom_from_gserialized(), and lwgeom_wrapx().

Here is the call graph for this function: