Swap ordinate values in every vertex of the geometry.
Ordinates to swap are specified using an index with meaning: 0=x, 1=y, 2=z, 3=m
Swapping an existing ordinate with an unexisting one results in undefined value being written in the existing ordinate. Caller should verify and prevent such calls.
Availability: 2.2.0
Definition at line 1513 of file lwgeom.c.
References LWGEOM::bbox, CIRCSTRINGTYPE, COLLECTIONTYPE, COMPOUNDTYPE, CURVEPOLYTYPE, LWCOLLECTION::geoms, LINETYPE, LWDEBUGF, lwerror(), lwgeom_add_bbox(), lwgeom_as_lwcircstring(), lwgeom_as_lwline(), lwgeom_as_lwpoint(), lwgeom_as_lwtriangle(), lwgeom_drop_bbox(), lwgeom_is_empty(), lwtype_name(), MULTICURVETYPE, MULTILINETYPE, MULTIPOINTTYPE, MULTIPOLYGONTYPE, MULTISURFACETYPE, LWCOLLECTION::ngeoms, LWPOLY::nrings, POINTTYPE, POLYGONTYPE, POLYHEDRALSURFACETYPE, ptarray_swap_ordinates(), LWPOLY::rings, TINTYPE, TRIANGLETYPE, and LWGEOM::type.
Referenced by lwgeom_flip_coordinates(), ST_FlipCoordinates(), and ST_SwapOrdinates().
1523 LWDEBUGF(4,
"lwgeom_flip_coordinates, got type: %s",
1542 for (i=0; i<poly->
nrings; i++)
1563 for (i=0; i<col->
ngeoms; i++)
1570 lwerror(
"lwgeom_swap_ordinates: unsupported geometry type: %s",
1576 if ( in->
bbox && (o1 < 2 || o2 < 2) )
void lwgeom_drop_bbox(LWGEOM *lwgeom)
Call this function to drop BBOX and SRID from LWGEOM.
void lwgeom_swap_ordinates(LWGEOM *in, LWORD o1, LWORD o2)
Swap ordinate values in every vertex of the geometry.
#define POLYHEDRALSURFACETYPE
LWTRIANGLE * lwgeom_as_lwtriangle(const LWGEOM *lwgeom)
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
void ptarray_swap_ordinates(POINTARRAY *pa, LWORD o1, LWORD o2)
Swap ordinate values o1 and o2 on a given POINTARRAY.
LWLINE * lwgeom_as_lwline(const LWGEOM *lwgeom)
LWCIRCSTRING * lwgeom_as_lwcircstring(const LWGEOM *lwgeom)
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
void lwgeom_add_bbox(LWGEOM *lwgeom)
Ensure there's a box in the LWGEOM.
#define LWDEBUGF(level, msg,...)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.