Given a generic GeomCache, and a geometry to prepare, prepare a PrepGeomCache and stick it into the GeomCache->index slot.
The PrepGeomCache includes the original GEOS geometry, and the GEOS prepared geometry, and a pointer to the MemoryContext where the callback functions are registered.
This function is passed into the generic GetGeomCache function so that it can build an appropriate indexed structure in the case of a cache hit when there is no indexed structure yet available to return.
Definition at line 303 of file lwgeom_geos_prepared.c.
References AddPrepGeomHashEntry(), PrepGeomCache::argnum, PrepGeomHashEntry::context, PrepGeomCache::context_callback, PrepGeomCache::context_statement, CreatePrepGeomHash(), PrepGeomCache::geom, PrepGeomHashEntry::geom, GetPrepGeomHashEntry(), LW_FAILURE, LW_SUCCESS, LWGEOM2GEOS(), lwgeom_get_type(), MULTIPOINTTYPE, POINTTYPE, PrepGeomCache::prepared_geom, PrepGeomHashEntry::prepared_geom, PreparedCacheDelete(), and PrepGeomHash.
320 #if POSTGIS_PGSQL_VERSION < 96 322 &PreparedCacheContextMethods,
324 "PostGIS Prepared Geometry Context");
328 "PostGIS Prepared Geometry Context",
329 ALLOCSET_SMALL_SIZES);
334 MemoryContextCallback *callback = MemoryContextAlloc(prepcache->
context_callback,
sizeof(MemoryContextCallback));
353 lwpgerror(
"PrepGeomCacheBuilder asked to build new prepcache where one already exists.");
371 prepcache->
argnum = cache->argnum;
380 lwpgerror(
"PrepGeomCacheBuilder failed to find hash entry for context %p", prepcache->
context_callback);
const GEOSPreparedGeometry * prepared_geom
uint32_t lwgeom_get_type(const LWGEOM *geom)
Return LWTYPE number.
const GEOSPreparedGeometry * prepared_geom
MemoryContext context_statement
const GEOSGeometry * geom
static void AddPrepGeomHashEntry(PrepGeomHashEntry pghe)
const GEOSGeometry * geom
GEOSGeometry * LWGEOM2GEOS(const LWGEOM *lwgeom, int autofix)
static void PreparedCacheDelete(void *ptr)
static void CreatePrepGeomHash(void)
static PrepGeomHashEntry * GetPrepGeomHashEntry(MemoryContext mcxt)
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
MemoryContext context_callback
static HTAB * PrepGeomHash