PostGIS  2.1.10dev-r@@SVN_REVISION@@
void lwpoly_force_clockwise ( LWPOLY poly)

Definition at line 175 of file lwpoly.c.

References lwpoly_is_empty(), LWPOLY::nrings, ptarray_isccw(), ptarray_reverse(), and LWPOLY::rings.

Referenced by lwgeom_force_clockwise().

176 {
177  int i;
178 
179  /* No-op empties */
180  if ( lwpoly_is_empty(poly) )
181  return;
182 
183  /* External ring */
184  if ( ptarray_isccw(poly->rings[0]) )
185  ptarray_reverse(poly->rings[0]);
186 
187  /* Internal rings */
188  for (i=1; i<poly->nrings; i++)
189  if ( ! ptarray_isccw(poly->rings[i]) )
190  ptarray_reverse(poly->rings[i]);
191 
192 }
int ptarray_isccw(const POINTARRAY *pa)
Definition: ptarray.c:990
POINTARRAY ** rings
Definition: liblwgeom.h:413
int nrings
Definition: liblwgeom.h:411
void ptarray_reverse(POINTARRAY *pa)
Definition: ptarray.c:328
int lwpoly_is_empty(const LWPOLY *poly)
Definition: lwpoly.c:327

Here is the call graph for this function:

Here is the caller graph for this function: