PostGIS  3.0.0dev-r@@SVN_REVISION@@

◆ lwpoly_covers_lwline()

int lwpoly_covers_lwline ( const LWPOLY poly,
const LWLINE line 
)

Definition at line 2573 of file lwgeodetic.c.

References LW_FALSE, LW_TRUE, LWDEBUG, lwgeom_is_empty(), lwpoly_covers_pointarray(), and lwpoly_intersects_line().

Referenced by lwgeom_covers_lwgeom_sphere().

2574 {
2575  /* Nulls and empties don't contain anything! */
2576  if ( ! poly || lwgeom_is_empty((LWGEOM*)poly) )
2577  {
2578  LWDEBUG(4,"returning false, geometry1 is empty or null");
2579  return LW_FALSE;
2580  }
2581 
2582  /* Nulls and empties don't contain anything! */
2583  if ( ! line || lwgeom_is_empty((LWGEOM*)line) )
2584  {
2585  LWDEBUG(4,"returning false, geometry2 is empty or null");
2586  return LW_FALSE;
2587  }
2588 
2589  if (LW_FALSE == lwpoly_covers_pointarray(poly, line->points))
2590  {
2591  LWDEBUG(4,"returning false, geometry2 has point outside of geometry1");
2592  return LW_FALSE;
2593  }
2594 
2595  /* check for any edge intersections, so nothing is partially outside of poly1 */
2596  if (LW_TRUE == lwpoly_intersects_line(poly, line->points))
2597  {
2598  LWDEBUG(4,"returning false, geometry2 is partially outside of geometry1");
2599  return LW_FALSE;
2600  }
2601 
2602  /* no abort condition found, so the poly2 should be completely inside poly1 */
2603  return LW_TRUE;
2604 }
int lwpoly_intersects_line(const LWPOLY *lwpoly, const POINTARRAY *line)
Checks if any edges of lwpoly intersect with the line formed by the pointarray return LW_TRUE if any ...
Definition: lwgeodetic.c:2628
int lwpoly_covers_pointarray(const LWPOLY *lwpoly, const POINTARRAY *pta)
return LW_TRUE if all points are inside the polygon
Definition: lwgeodetic.c:2609
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
Definition: lwinline.h:172
#define LW_FALSE
Definition: liblwgeom.h:76
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:75
Here is the call graph for this function:
Here is the caller graph for this function: