PostGIS  2.5.0dev-r@@SVN_REVISION@@
int lwpoly_covers_lwline ( const LWPOLY poly,
const LWLINE line 
)

Definition at line 2560 of file lwgeodetic.c.

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

Referenced by lwgeom_covers_lwgeom_sphere().

2561 {
2562  /* Nulls and empties don't contain anything! */
2563  if ( ! poly || lwgeom_is_empty((LWGEOM*)poly) )
2564  {
2565  LWDEBUG(4,"returning false, geometry1 is empty or null");
2566  return LW_FALSE;
2567  }
2568 
2569  /* Nulls and empties don't contain anything! */
2570  if ( ! line || lwgeom_is_empty((LWGEOM*)line) )
2571  {
2572  LWDEBUG(4,"returning false, geometry2 is empty or null");
2573  return LW_FALSE;
2574  }
2575 
2576  if (LW_FALSE == lwpoly_covers_pointarray(poly, line->points))
2577  {
2578  LWDEBUG(4,"returning false, geometry2 has point outside of geometry1");
2579  return LW_FALSE;
2580  }
2581 
2582  /* check for any edge intersections, so nothing is partially outside of poly1 */
2583  if (LW_TRUE == lwpoly_intersects_line(poly, line->points))
2584  {
2585  LWDEBUG(4,"returning false, geometry2 is partially outside of geometry1");
2586  return LW_FALSE;
2587  }
2588 
2589  /* no abort condition found, so the poly2 should be completly inside poly1 */
2590  return LW_TRUE;
2591 }
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:2615
int lwpoly_covers_pointarray(const LWPOLY *lwpoly, const POINTARRAY *pta)
return LW_TRUE if all points are inside the polygon
Definition: lwgeodetic.c:2596
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
#define LW_FALSE
Definition: liblwgeom.h:76
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:75
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
Definition: lwgeom.c:1386
POINTARRAY * points
Definition: liblwgeom.h:421

Here is the call graph for this function:

Here is the caller graph for this function: