wrap geometry on given cut x value
For a positive amount, shifts anything that is on the left of "cutx" to the right by the given amount.
For a negative amount, shifts anything that is on the right of "cutx" to the left by the given absolute amount.
- Parameters
-
cutx | the X value to perform wrapping on |
amount | shift amount and wrapping direction |
Definition at line 169 of file lwgeom_wrapx.c.
174 LWDEBUG(2,
"geom is empty, cloning");
181 LWDEBUG(2,
"amount is zero, cloning");
185 switch (lwgeom_in->
type)
189 LWDEBUG(2,
"split-wrapping line or polygon");
198 LWDEBUGF(2,
"POINT X is %g, cutx:%g, amount:%g", pt4d.
x, cutx, amount);
200 if ( ( amount < 0 && pt4d.x > cutx ) || ( amount > 0 && pt4d.
x < cutx ) )
212 LWDEBUG(2,
"collection-wrapping multi");
218 lwerror(
"Wrapping of %s geometries is unsupported",
LWGEOM * lwcollection_as_lwgeom(const LWCOLLECTION *obj)
LWGEOM * lwgeom_clone_deep(const LWGEOM *lwgeom)
Deep clone an LWGEOM, everything is copied.
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
void ptarray_set_point4d(POINTARRAY *pa, uint32_t n, const POINT4D *p4d)
#define LWDEBUG(level, msg)
#define LWDEBUGF(level, msg,...)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
static LWGEOM * lwgeom_split_wrapx(const LWGEOM *geom_in, double cutx, double amount)
static LWCOLLECTION * lwcollection_wrapx(const LWCOLLECTION *lwcoll_in, double cutx, double amount)
References COLLECTIONTYPE, getPoint4d_p(), LINETYPE, lwcollection_as_lwgeom(), lwcollection_wrapx(), LWDEBUG, LWDEBUGF, lwerror(), lwgeom_as_lwpoint(), lwgeom_clone_deep(), lwgeom_is_empty(), lwgeom_split_wrapx(), lwpoint_as_lwgeom(), lwtype_name(), MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, LWPOINT::point, POINTTYPE, POLYGONTYPE, ptarray_set_point4d(), LWGEOM::type, LWCOLLECTION::type, and POINT4D::x.
Referenced by lwcollection_wrapx(), ST_WrapX(), and test_lwgeom_wrapx().