PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ ST_WrapX()

Datum ST_WrapX ( PG_FUNCTION_ARGS  )

Definition at line 1086 of file lwgeom_functions_basic.c.

1087 {
1088  Datum gdatum;
1089  GSERIALIZED *geom_in;
1090  LWGEOM *lwgeom_in, *lwgeom_out;
1091  GSERIALIZED *geom_out;
1092  double cutx;
1093  double amount;
1094 
1095  POSTGIS_DEBUG(2, "ST_WrapX called.");
1096 
1097  gdatum = PG_GETARG_DATUM(0);
1098  cutx = PG_GETARG_FLOAT8(1);
1099  amount = PG_GETARG_FLOAT8(2);
1100 
1101  // if ( ! amount ) PG_RETURN_DATUM(gdatum);
1102 
1103  geom_in = ((GSERIALIZED *)PG_DETOAST_DATUM(gdatum));
1104  lwgeom_in = lwgeom_from_gserialized(geom_in);
1105 
1106  lwgeom_out = lwgeom_wrapx(lwgeom_in, cutx, amount);
1107  geom_out = geometry_serialize(lwgeom_out);
1108 
1109  lwgeom_free(lwgeom_in);
1110  lwgeom_free(lwgeom_out);
1111  PG_FREE_IF_COPY(geom_in, 0);
1112 
1113  PG_RETURN_POINTER(geom_out);
1114 }
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: