PostGIS  2.3.7dev-r@@SVN_REVISION@@
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(), 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:86
#define TRIANGLETYPE
Definition: liblwgeom.h:97
void lwtriangle_force_clockwise(LWTRIANGLE *triangle)
Definition: lwtriangle.c:106
void lwpoly_force_clockwise(LWPOLY *poly)
Definition: lwpoly.c:246
LWGEOM ** geoms
Definition: liblwgeom.h:508
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:89
uint8_t type
Definition: liblwgeom.h:395
#define COLLECTIONTYPE
Definition: liblwgeom.h:90

Here is the call graph for this function:

Here is the caller graph for this function: