PostGIS  2.5.0dev-r@@SVN_REVISION@@
static int pip_short_circuit ( RTREE_POLY_CACHE poly_cache,
LWPOINT point,
GSERIALIZED gpoly 
)
static

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

References lwgeom_as_lwmpoly(), lwgeom_as_lwpoly(), lwgeom_free(), lwgeom_from_gserialized(), lwgeom_get_type(), 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().

139 {
140  int result;
141 
142  if ( poly_cache && poly_cache->ringIndices )
143  {
144  result = point_in_multipolygon_rtree(poly_cache->ringIndices, poly_cache->polyCount, poly_cache->ringCounts, point);
145  }
146  else
147  {
148  LWGEOM* poly = lwgeom_from_gserialized(gpoly);
149  if ( lwgeom_get_type(poly) == POLYGONTYPE )
150  {
151  result = point_in_polygon(lwgeom_as_lwpoly(poly), point);
152  }
153  else
154  {
155  result = point_in_multipolygon(lwgeom_as_lwmpoly(poly), point);
156  }
157  lwgeom_free(poly);
158  }
159 
160  return result;
161 }
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:916
#define POLYGONTYPE
Definition: liblwgeom.h:86
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1137
int point_in_multipolygon_rtree(RTREE_NODE **root, int polyCount, int *ringCounts, LWPOINT *point)
LWPOLY * lwgeom_as_lwpoly(const LWGEOM *lwgeom)
Definition: lwgeom.c:205
int point_in_multipolygon(LWMPOLY *mpolygon, LWPOINT *point)
LWMPOLY * lwgeom_as_lwmpoly(const LWGEOM *lwgeom)
Definition: lwgeom.c:250
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: