31 #include "lwgeom_pg.h"
33 #include "lwgeom_cache.h"
67 if ( rect_cache->
index )
70 rect_cache->
index = 0;
75 rect_cache->
index = tree;
83 if ( rect_cache->
index )
86 rect_cache->
index = 0;
87 rect_cache->
gcache.argnum = 0;
97 return (GeomCache*)cache;
130 PG_FREE_IF_COPY(g1, 0);
131 PG_FREE_IF_COPY(g2, 1);
159 PG_FREE_IF_COPY(g1, 0);
160 PG_FREE_IF_COPY(g2, 1);
174 if (tree_cache && tree_cache->
gcache.argnum)
178 if (tree_cache->
gcache.argnum == 1)
182 else if (tree_cache->
gcache.argnum == 2)
188 elog(ERROR,
"reached unreachable block in %s", __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.
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
double lwgeom_mindistance2d(const LWGEOM *lw1, const LWGEOM *lw2)
Function initializing min distance calculation.
This library is the generic geometry handling section of PostGIS.
static int RectTreeBuilder(const LWGEOM *lwgeom, GeomCache *cache)
Builder, freeer and public accessor for cached RECT_NODE trees.
static GeomCacheMethods RectTreeCacheMethods
Datum ST_DistanceRectTree(PG_FUNCTION_ARGS)
static int RectTreeFreer(GeomCache *cache)
static GeomCache * RectTreeAllocator(void)
PG_FUNCTION_INFO_V1(ST_DistanceRectTree)
Datum ST_DistanceRectTreeCached(PG_FUNCTION_ARGS)
static RectTreeGeomCache * GetRectTreeGeomCache(FunctionCallInfo fcinfo, const GSERIALIZED *g1, const GSERIALIZED *g2)
RECT_NODE * rect_tree_from_lwgeom(const LWGEOM *lwgeom)
Create a tree index on top an LWGEOM.
void rect_tree_free(RECT_NODE *node)
Recurse from top of node tree and free all children.
double rect_tree_distance_tree(RECT_NODE *n1, RECT_NODE *n2, double threshold)
Return the distance between two RECT_NODE trees.