PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ pip_short_circuit()

static int pip_short_circuit ( RTREE_POLY_CACHE poly_cache,
LWPOINT point,
GSERIALIZED gpoly 
)
static

Definition at line 140 of file postgis/lwgeom_geos.c.

References hausdorffdistance(), lwgeom_as_lwmpoly(), lwgeom_as_lwpoly(), lwgeom_free(), lwgeom_from_gserialized(), lwgeom_get_type(), PG_FUNCTION_INFO_V1(), point_in_multipolygon(), point_in_multipolygon_rtree(), point_in_polygon(), RTREE_POLY_CACHE::polyCount, POLYGONTYPE, RTREE_POLY_CACHE::ringCounts, and RTREE_POLY_CACHE::ringIndices.

Referenced by contains(), coveredby(), covers(), and geos_intersects().

141 {
142  int result;
143 
144  if ( poly_cache && poly_cache->ringIndices )
145  {
146  result = point_in_multipolygon_rtree(poly_cache->ringIndices, poly_cache->polyCount, poly_cache->ringCounts, point);
147  }
148  else
149  {
150  LWGEOM* poly = lwgeom_from_gserialized(gpoly);
151  if ( lwgeom_get_type(poly) == POLYGONTYPE )
152  {
153  result = point_in_polygon(lwgeom_as_lwpoly(poly), point);
154  }
155  else
156  {
157  result = point_in_multipolygon(lwgeom_as_lwmpoly(poly), point);
158  }
159  lwgeom_free(poly);
160  }
161 
162  return result;
163 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
uint32_t lwgeom_get_type(const LWGEOM *geom)
Return LWTYPE number.
Definition: lwgeom.c:842
#define POLYGONTYPE
Definition: liblwgeom.h:86
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1063
int point_in_multipolygon_rtree(RTREE_NODE **root, int polyCount, int *ringCounts, LWPOINT *point)
LWPOLY * lwgeom_as_lwpoly(const LWGEOM *lwgeom)
Definition: lwgeom.c:138
int point_in_multipolygon(LWMPOLY *mpolygon, LWPOINT *point)
LWMPOLY * lwgeom_as_lwmpoly(const LWGEOM *lwgeom)
Definition: lwgeom.c:183
int point_in_polygon(LWPOLY *polygon, LWPOINT *point)
RTREE_NODE ** ringIndices
Definition: lwgeom_rtree.h:59
Here is the call graph for this function:
Here is the caller graph for this function: