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 167 of file lwgeom_wrapx.c.
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().
172 LWDEBUG(2,
"geom is empty, cloning");
179 LWDEBUG(2,
"amount is zero, cloning");
183 switch (lwgeom_in->
type)
187 LWDEBUG(2,
"split-wrapping line or polygon");
196 LWDEBUGF(2,
"POINT X is %g, cutx:%g, amount:%g", pt4d.
x, cutx, amount);
198 if ( ( amount < 0 && pt4d.x > cutx ) || ( amount > 0 && pt4d.
x < cutx ) )
210 LWDEBUG(2,
"collection-wrapping multi");
216 lwerror(
"Wrapping of %s geometries is unsupported",
void ptarray_set_point4d(POINTARRAY *pa, int n, const POINT4D *p4d)
#define LWDEBUG(level, msg)
LWGEOM * lwgeom_clone_deep(const LWGEOM *lwgeom)
Deep clone an LWGEOM, everything is copied.
LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
static LWCOLLECTION * lwcollection_wrapx(const LWCOLLECTION *lwcoll_in, double cutx, double amount)
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
static LWGEOM * lwgeom_split_wrapx(const LWGEOM *geom_in, double cutx, double amount)
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
#define LWDEBUGF(level, msg,...)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
int getPoint4d_p(const POINTARRAY *pa, int n, POINT4D *point)
LWGEOM * lwcollection_as_lwgeom(const LWCOLLECTION *obj)