PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ lwgeom_force_orientation()

static void lwgeom_force_orientation ( LWGEOM lwgeom,
int  orientation 
)
static

Force an orientation onto geometries made up of rings, so the rings circle in a particular direction, clockwise or counter-clockwise.

The orientation is one of LW_CLOCKWISE or LW_COUNTERCLOCKWISE. Non-polygonal geometries are ignored and returned untouched.

Definition at line 45 of file lwgeom.c.

46{
47 switch (lwgeom->type)
48 {
49 case POLYGONTYPE:
50 lwpoly_force_orientation(lwgeom_as_lwpoly(lwgeom), orientation);
51 return;
52
53 case TRIANGLETYPE:
55 return;
56
57 /* Not handle POLYHEDRALSURFACE and TIN
58 as they are supposed to be well oriented */
60 case COLLECTIONTYPE:
61 {
63 for (uint32_t i = 0; coll && i < coll->ngeoms; i++)
64 {
65 lwgeom_force_orientation(coll->geoms[i], orientation);
66 }
67 return;
68 }
69 }
70}
#define COLLECTIONTYPE
Definition liblwgeom.h:108
#define MULTIPOLYGONTYPE
Definition liblwgeom.h:107
#define POLYGONTYPE
Definition liblwgeom.h:104
#define TRIANGLETYPE
Definition liblwgeom.h:115
void lwtriangle_force_orientation(LWTRIANGLE *triangle, int orientation)
Definition lwtriangle.c:112
void lwpoly_force_orientation(LWPOLY *poly, int orientation)
Definition lwpoly.c:268
LWCOLLECTION * lwgeom_as_lwcollection(const LWGEOM *lwgeom)
Definition lwgeom.c:261
static void lwgeom_force_orientation(LWGEOM *lwgeom, int orientation)
Force an orientation onto geometries made up of rings, so the rings circle in a particular direction,...
Definition lwgeom.c:45
LWPOLY * lwgeom_as_lwpoly(const LWGEOM *lwgeom)
Definition lwgeom.c:243
LWTRIANGLE * lwgeom_as_lwtriangle(const LWGEOM *lwgeom)
Definition lwgeom.c:252
uint32_t ngeoms
Definition liblwgeom.h:580
LWGEOM ** geoms
Definition liblwgeom.h:575
uint8_t type
Definition liblwgeom.h:462

References COLLECTIONTYPE, LWCOLLECTION::geoms, lwgeom_as_lwcollection(), lwgeom_as_lwpoly(), lwgeom_as_lwtriangle(), lwgeom_force_orientation(), lwpoly_force_orientation(), lwtriangle_force_orientation(), MULTIPOLYGONTYPE, LWCOLLECTION::ngeoms, POLYGONTYPE, TRIANGLETYPE, and LWGEOM::type.

Referenced by lwgeom_force_clockwise(), lwgeom_force_counterclockwise(), and lwgeom_force_orientation().

Here is the call graph for this function:
Here is the caller graph for this function: