PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwgeom_force_clockwise()

void lwgeom_force_clockwise ( LWGEOM lwgeom)

Force Right-hand-rule on LWGEOM polygons.

Ensure the outer ring is clockwise oriented and all inner rings are counter-clockwise.

Definition at line 36 of file lwgeom.c.

References COLLECTIONTYPE, LWCOLLECTION::geoms, lwpoly_force_clockwise(), lwtriangle_force_clockwise(), MULTIPOLYGONTYPE, LWCOLLECTION::ngeoms, POLYGONTYPE, TRIANGLETYPE, and LWGEOM::type.

Referenced by LWGEOM_force_clockwise_poly(), mvt_geom(), and test_lwgeom_force_clockwise().

37 {
38  LWCOLLECTION *coll;
39  int i;
40 
41  switch (lwgeom->type)
42  {
43  case POLYGONTYPE:
44  lwpoly_force_clockwise((LWPOLY *)lwgeom);
45  return;
46 
47  case TRIANGLETYPE:
49  return;
50 
51  /* Not handle POLYHEDRALSURFACE and TIN
52  as they are supposed to be well oriented */
53  case MULTIPOLYGONTYPE:
54  case COLLECTIONTYPE:
55  coll = (LWCOLLECTION *)lwgeom;
56  for (i=0; i<coll->ngeoms; i++)
57  lwgeom_force_clockwise(coll->geoms[i]);
58  return;
59  }
60 }
void lwgeom_force_clockwise(LWGEOM *lwgeom)
Force Right-hand-rule on LWGEOM polygons.
Definition: lwgeom.c:36
#define POLYGONTYPE
Definition: liblwgeom.h:87
#define TRIANGLETYPE
Definition: liblwgeom.h:98
void lwtriangle_force_clockwise(LWTRIANGLE *triangle)
Definition: lwtriangle.c:106
void lwpoly_force_clockwise(LWPOLY *poly)
Definition: lwpoly.c:270
LWGEOM ** geoms
Definition: liblwgeom.h:509
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:90
uint8_t type
Definition: liblwgeom.h:396
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
Here is the call graph for this function:
Here is the caller graph for this function: