PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ ST_WrapX()

Datum ST_WrapX ( PG_FUNCTION_ARGS  )

Definition at line 1066 of file lwgeom_functions_basic.c.

1067 {
1068  Datum gdatum;
1069  GSERIALIZED *geom_in;
1070  LWGEOM *lwgeom_in, *lwgeom_out;
1071  GSERIALIZED *geom_out;
1072  double cutx;
1073  double amount;
1074 
1075  POSTGIS_DEBUG(2, "ST_WrapX called.");
1076 
1077  gdatum = PG_GETARG_DATUM(0);
1078  cutx = PG_GETARG_FLOAT8(1);
1079  amount = PG_GETARG_FLOAT8(2);
1080 
1081  //if ( ! amount ) PG_RETURN_DATUM(gdatum);
1082 
1083  geom_in = ((GSERIALIZED *)PG_DETOAST_DATUM(gdatum));
1084  lwgeom_in = lwgeom_from_gserialized(geom_in);
1085 
1086  lwgeom_out = lwgeom_wrapx(lwgeom_in, cutx, amount);
1087  geom_out = geometry_serialize(lwgeom_out);
1088 
1089  lwgeom_free(lwgeom_in);
1090  lwgeom_free(lwgeom_out);
1091  PG_FREE_IF_COPY(geom_in, 0);
1092 
1093  PG_RETURN_POINTER(geom_out);
1094 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
LWGEOM * lwgeom_wrapx(const LWGEOM *lwgeom, double cutx, double amount)
wrap geometry on given cut x value
Definition: lwgeom_wrapx.c:169
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)

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

Here is the call graph for this function: