PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwpoly_is_closed()

int lwpoly_is_closed ( const LWPOLY poly)

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

590 {
591  int i = 0;
592 
593  if ( poly->nrings == 0 )
594  return LW_TRUE;
595 
596  for ( i = 0; i < poly->nrings; i++ )
597  {
598  if (FLAGS_GET_Z(poly->flags))
599  {
600  if ( ! ptarray_is_closed_3d(poly->rings[i]) )
601  return LW_FALSE;
602  }
603  else
604  {
605  if ( ! ptarray_is_closed_2d(poly->rings[i]) )
606  return LW_FALSE;
607  }
608  }
609 
610  return LW_TRUE;
611 }
int ptarray_is_closed_3d(const POINTARRAY *pa)
Definition: ptarray.c:710
int ptarray_is_closed_2d(const POINTARRAY *pa)
Definition: ptarray.c:697
#define LW_FALSE
Definition: liblwgeom.h:77
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76
POINTARRAY ** rings
Definition: liblwgeom.h:457
int nrings
Definition: liblwgeom.h:455
#define FLAGS_GET_Z(flags)
Macros for manipulating the &#39;flags&#39; byte.
Definition: liblwgeom.h:140
uint8_t flags
Definition: liblwgeom.h:452
Here is the call graph for this function:
Here is the caller graph for this function: