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

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

456 {
457  int i = 0;
458 
459  if ( poly->nrings == 0 )
460  return LW_TRUE;
461 
462  for ( i = 0; i < poly->nrings; i++ )
463  {
464  if (FLAGS_GET_Z(poly->flags))
465  {
466  if ( ! ptarray_is_closed_3d(poly->rings[i]) )
467  return LW_FALSE;
468  }
469  else
470  {
471  if ( ! ptarray_is_closed_2d(poly->rings[i]) )
472  return LW_FALSE;
473  }
474  }
475 
476  return LW_TRUE;
477 }
int ptarray_is_closed_3d(const POINTARRAY *pa)
Definition: ptarray.c:678
int ptarray_is_closed_2d(const POINTARRAY *pa)
Definition: ptarray.c:672
#define LW_FALSE
Definition: liblwgeom.h:52
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:51
POINTARRAY ** rings
Definition: liblwgeom.h:413
int nrings
Definition: liblwgeom.h:411
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:106
uint8_t flags
Definition: liblwgeom.h:408

Here is the call graph for this function:

Here is the caller graph for this function: