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

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

548 {
549  int i = 0;
550 
551  if ( poly->nrings == 0 )
552  return LW_TRUE;
553 
554  for ( i = 0; i < poly->nrings; i++ )
555  {
556  if (FLAGS_GET_Z(poly->flags))
557  {
558  if ( ! ptarray_is_closed_3d(poly->rings[i]) )
559  return LW_FALSE;
560  }
561  else
562  {
563  if ( ! ptarray_is_closed_2d(poly->rings[i]) )
564  return LW_FALSE;
565  }
566  }
567 
568  return LW_TRUE;
569 }
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:76
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:75
POINTARRAY ** rings
Definition: liblwgeom.h:456
int nrings
Definition: liblwgeom.h:454
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:139
uint8_t flags
Definition: liblwgeom.h:451

Here is the call graph for this function:

Here is the caller graph for this function: