PostGIS  2.2.7dev-r@@SVN_REVISION@@
int lwpoly_is_closed ( const LWPOLY poly)

Definition at line 476 of file lwpoly.c.

References LWPOLY::flags, FLAGS_GET_Z, LW_FALSE, LW_TRUE, LWPOLY::nrings, ptarray_is_closed_2d(), ptarray_is_closed_3d(), and LWPOLY::rings.

Referenced by lwgeom_is_closed().

477 {
478  int i = 0;
479 
480  if ( poly->nrings == 0 )
481  return LW_TRUE;
482 
483  for ( i = 0; i < poly->nrings; i++ )
484  {
485  if (FLAGS_GET_Z(poly->flags))
486  {
487  if ( ! ptarray_is_closed_3d(poly->rings[i]) )
488  return LW_FALSE;
489  }
490  else
491  {
492  if ( ! ptarray_is_closed_2d(poly->rings[i]) )
493  return LW_FALSE;
494  }
495  }
496 
497  return LW_TRUE;
498 }
int ptarray_is_closed_3d(const POINTARRAY *pa)
Definition: ptarray.c:707
int ptarray_is_closed_2d(const POINTARRAY *pa)
Definition: ptarray.c:694
#define LW_FALSE
Definition: liblwgeom.h:62
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:61
POINTARRAY ** rings
Definition: liblwgeom.h:441
int nrings
Definition: liblwgeom.h:439
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:124
uint8_t flags
Definition: liblwgeom.h:436

Here is the call graph for this function:

Here is the caller graph for this function: