PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwpoly_covers_lwline()

int lwpoly_covers_lwline ( const LWPOLY poly,
const LWLINE line 
)

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

2644 {
2645  /* Nulls and empties don't contain anything! */
2646  if ( ! poly || lwgeom_is_empty((LWGEOM*)poly) )
2647  {
2648  LWDEBUG(4,"returning false, geometry1 is empty or null");
2649  return LW_FALSE;
2650  }
2651 
2652  /* Nulls and empties don't contain anything! */
2653  if ( ! line || lwgeom_is_empty((LWGEOM*)line) )
2654  {
2655  LWDEBUG(4,"returning false, geometry2 is empty or null");
2656  return LW_FALSE;
2657  }
2658 
2659  if (LW_FALSE == lwpoly_covers_pointarray(poly, line->points))
2660  {
2661  LWDEBUG(4,"returning false, geometry2 has point outside of geometry1");
2662  return LW_FALSE;
2663  }
2664 
2665  /* check for any edge intersections, so nothing is partially outside of poly1 */
2666  if (LW_TRUE == lwpoly_intersects_line(poly, line->points))
2667  {
2668  LWDEBUG(4,"returning false, geometry2 is partially outside of geometry1");
2669  return LW_FALSE;
2670  }
2671 
2672  /* no abort condition found, so the poly2 should be completly inside poly1 */
2673  return LW_TRUE;
2674 }
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:2698
int lwpoly_covers_pointarray(const LWPOLY *lwpoly, const POINTARRAY *pta)
return LW_TRUE if all points are inside the polygon
Definition: lwgeodetic.c:2679
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
#define LW_FALSE
Definition: liblwgeom.h:77
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:76
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:1346
Here is the call graph for this function:
Here is the caller graph for this function: