Definition at line 383 of file lwgeom_functions_analytic.c.
References LWGEOM::bbox, LWPOINT::flags, FLAGS_GET_M, FLAGS_GET_Z, geometry_serialize(), getPoint4d_p(), gserialized_is_empty(), gridspec_t::ipm, gridspec_t::ipx, gridspec_t::ipy, gridspec_t::ipz, lwgeom_add_bbox(), lwgeom_as_lwpoint(), lwgeom_drop_bbox(), lwgeom_from_gserialized(), lwgeom_grid(), lwtype_name(), POINT4D::m, gridspec_t::msize, PG_FUNCTION_INFO_V1(), LWPOINT::point, ST_LineCrossingDirection(), LWGEOM::type, POINT4D::x, gridspec_t::xsize, POINT4D::y, gridspec_t::ysize, POINT4D::z, and gridspec_t::zsize.
Referenced by LWGEOM_snaptogrid().
394 in_geom = PG_GETARG_GSERIALIZED_P(0);
399 PG_RETURN_POINTER(in_geom);
402 in_point = PG_GETARG_GSERIALIZED_P(1);
404 if ( in_lwpoint == NULL )
406 lwpgerror(
"Offset geometry must be a point");
409 grid.
xsize = PG_GETARG_FLOAT8(2);
410 grid.
ysize = PG_GETARG_FLOAT8(3);
411 grid.
zsize = PG_GETARG_FLOAT8(4);
412 grid.
msize = PG_GETARG_FLOAT8(5);
416 grid.
ipx = offsetpoint.
x;
417 grid.
ipy = offsetpoint.
y;
423 #if POSTGIS_DEBUG_LEVEL >= 4 430 PG_RETURN_POINTER(in_geom);
435 POSTGIS_DEBUGF(3,
"SnapToGrid got a %s",
lwtype_name(in_lwgeom->
type));
438 if ( out_lwgeom == NULL ) PG_RETURN_NULL();
447 POSTGIS_DEBUGF(3,
"SnapToGrid made a %s",
lwtype_name(out_lwgeom->
type));
451 PG_RETURN_POINTER(out_geom);
LWGEOM * lwgeom_grid(const LWGEOM *lwgeom, const gridspec *grid)
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
void lwgeom_drop_bbox(LWGEOM *lwgeom)
Call this function to drop BBOX and SRID from LWGEOM.
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
void lwgeom_add_bbox(LWGEOM *lwgeom)
Compute a bbox if not already computed.
#define FLAGS_GET_M(flags)
int getPoint4d_p(const POINTARRAY *pa, int n, POINT4D *point)