36 #include "lwgeom_pg.h"
37 #include "lwgeom_cache.h"
97 return (GeomCache*)cache;
123 if (cache && cache->
itree)
127 poly1 = shared_gserialized_get(g1);
148 bool found_completely_inside =
false;
150 for (uint32_t i = 0; i < mpoint->
ngeoms; i++)
166 found_completely_inside =
true;
171 return found_completely_inside;
175 elog(ERROR,
"%s got a non-point input", __func__);
194 for (uint32_t i = 0; i < mpoint->
ngeoms; i++)
208 elog(ERROR,
"%s got a non-point input", __func__);
226 for (uint32_t i = 0; i < mpoint->
ngeoms; i++)
240 elog(ERROR,
"%s got a non-point input", __func__);
258 bool isPoly1, isPoly2, isPt1, isPt2;
263 PG_FREE_IF_COPY(g1, 0);
264 PG_FREE_IF_COPY(g2, 1);
265 PG_RETURN_BOOL(
false);
277 if (isPoly1 && isPt2)
282 else if (isPoly2 && isPt1)
289 elog(ERROR,
"arguments to %s must a point and a polygon", __func__);
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
IntervalTree * itree_from_lwgeom(const LWGEOM *geom)
void itree_free(IntervalTree *itree)
IntervalTreeResult itree_point_in_multipolygon(const IntervalTree *itree, const LWPOINT *point)
LWMPOINT * lwgeom_as_lwmpoint(const LWGEOM *lwgeom)
void lwgeom_free(LWGEOM *geom)
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
This library is the generic geometry handling section of PostGIS.
int lwpoint_is_empty(const LWPOINT *point)
static GeomCacheMethods IntervalTreeCacheMethods
bool itree_pip_intersects(const IntervalTree *itree, const LWGEOM *lwpoints)
PG_FUNCTION_INFO_V1(ST_IntersectsIntervalTree)
static int IntervalTreeFreer(GeomCache *geomcache)
IntervalTree * GetIntervalTree(FunctionCallInfo fcinfo, SHARED_GSERIALIZED *g1)
Checks for a cache hit against the provided geometry and returns a pre-built index structure (RTREE_P...
static GeomCache * IntervalTreeAllocator(void)
bool itree_pip_covers(const IntervalTree *itree, const LWGEOM *lwpoints)
static int IntervalTreeBuilder(const LWGEOM *lwgeom, GeomCache *geomcache)
Builder, freeer and public accessor for cached IntervalTrees.
Datum ST_IntersectsIntervalTree(PG_FUNCTION_ARGS)
bool itree_pip_contains(const IntervalTree *itree, const LWGEOM *lwpoints)
static uint32_t lwgeom_get_type(const LWGEOM *geom)
Return LWTYPE number.
static LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)