PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ pip_short_circuit()

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

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

143 {
144  int result;
145 
146  if ( poly_cache && poly_cache->ringIndices )
147  {
148  result = point_in_multipolygon_rtree(poly_cache->ringIndices, poly_cache->polyCount, poly_cache->ringCounts, point);
149  }
150  else
151  {
152  LWGEOM* poly = lwgeom_from_gserialized(gpoly);
153  if ( lwgeom_get_type(poly) == POLYGONTYPE )
154  {
155  result = point_in_polygon(lwgeom_as_lwpoly(poly), point);
156  }
157  else
158  {
159  result = point_in_multipolygon(lwgeom_as_lwmpoly(poly), point);
160  }
161  lwgeom_free(poly);
162  }
163 
164  return result;
165 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
uint32_t lwgeom_get_type(const LWGEOM *geom)
Return LWTYPE number.
Definition: lwgeom.c:923
LWMPOLY * lwgeom_as_lwmpoly(const LWGEOM *lwgeom)
Definition: lwgeom.c:251
#define POLYGONTYPE
Definition: liblwgeom.h:87
LWPOLY * lwgeom_as_lwpoly(const LWGEOM *lwgeom)
Definition: lwgeom.c:206
int point_in_multipolygon(LWMPOLY *mpolygon, LWPOINT *point)
int point_in_multipolygon_rtree(RTREE_NODE **root, int polyCount, int *ringCounts, LWPOINT *point)
int point_in_polygon(LWPOLY *polygon, LWPOINT *point)
RTREE_NODE ** ringIndices
Definition: lwgeom_rtree.h:60

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().

Here is the call graph for this function:
Here is the caller graph for this function: