PostGIS  2.1.10dev-r@@SVN_REVISION@@
void lwgeom_force_clockwise ( LWGEOM lwgeom)

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

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

Definition at line 23 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().

24 {
25  LWCOLLECTION *coll;
26  int i;
27 
28  switch (lwgeom->type)
29  {
30  case POLYGONTYPE:
31  lwpoly_force_clockwise((LWPOLY *)lwgeom);
32  return;
33 
34  case TRIANGLETYPE:
36  return;
37 
38  /* Not handle POLYHEDRALSURFACE and TIN
39  as they are supposed to be well oriented */
40  case MULTIPOLYGONTYPE:
41  case COLLECTIONTYPE:
42  coll = (LWCOLLECTION *)lwgeom;
43  for (i=0; i<coll->ngeoms; i++)
44  lwgeom_force_clockwise(coll->geoms[i]);
45  return;
46  }
47 }
void lwgeom_force_clockwise(LWGEOM *lwgeom)
Force Right-hand-rule on LWGEOM polygons.
Definition: lwgeom.c:23
#define POLYGONTYPE
Definition: liblwgeom.h:62
#define TRIANGLETYPE
Definition: liblwgeom.h:73
void lwtriangle_force_clockwise(LWTRIANGLE *triangle)
Definition: lwtriangle.c:93
void lwpoly_force_clockwise(LWPOLY *poly)
Definition: lwpoly.c:175
LWGEOM ** geoms
Definition: liblwgeom.h:465
#define MULTIPOLYGONTYPE
Definition: liblwgeom.h:65
uint8_t type
Definition: liblwgeom.h:352
#define COLLECTIONTYPE
Definition: liblwgeom.h:66

Here is the call graph for this function:

Here is the caller graph for this function: