PostGIS  3.3.9dev-r@@SVN_REVISION@@

◆ ST_WrapX()

Datum ST_WrapX ( PG_FUNCTION_ARGS  )

Definition at line 1083 of file lwgeom_functions_basic.c.

1084 {
1085  Datum gdatum;
1086  GSERIALIZED *geom_in;
1087  LWGEOM *lwgeom_in, *lwgeom_out;
1088  GSERIALIZED *geom_out;
1089  double cutx;
1090  double amount;
1091 
1092  POSTGIS_DEBUG(2, "ST_WrapX called.");
1093 
1094  gdatum = PG_GETARG_DATUM(0);
1095  cutx = PG_GETARG_FLOAT8(1);
1096  amount = PG_GETARG_FLOAT8(2);
1097 
1098  // if ( ! amount ) PG_RETURN_DATUM(gdatum);
1099 
1100  geom_in = ((GSERIALIZED *)PG_DETOAST_DATUM(gdatum));
1101  lwgeom_in = lwgeom_from_gserialized(geom_in);
1102 
1103  lwgeom_out = lwgeom_wrapx(lwgeom_in, cutx, amount);
1104  geom_out = geometry_serialize(lwgeom_out);
1105 
1106  lwgeom_free(lwgeom_in);
1107  lwgeom_free(lwgeom_out);
1108  PG_FREE_IF_COPY(geom_in, 0);
1109 
1110  PG_RETURN_POINTER(geom_out);
1111 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:239
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1155
LWGEOM * lwgeom_wrapx(const LWGEOM *lwgeom, double cutx, double amount)
wrap geometry on given cut x value
Definition: lwgeom_wrapx.c:169

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

Here is the call graph for this function: