23 #include "utils/fmgrprotos.h"
39 #define SPTEST(f, x, y) \
40 DatumGetBool(DirectFunctionCall2(f, PointPGetDatum(x), PointPGetDatum(y)))
77 elog(
ERROR,
"getQuadrant: impossible case");
91 result->
low = *centroid;
95 result->
high.
y = centroid->
y;
96 result->
low.
x = centroid->
x;
100 result->
high = *centroid;
104 result->
high.
x = centroid->
x;
107 result->
low.
y = centroid->
y;
146 x_cmp(
const void *
a,
const void *
b,
void *
arg)
153 return (pa->
x > pb->
x) ? 1 : -1;
157 y_cmp(
const void *
a,
const void *
b,
void *
arg)
164 return (pa->
y > pb->
y) ? 1 : -1;
184 centroid =
palloc(
sizeof(*centroid));
187 centroid->
x = sorted[in->
nTuples >> 1]->
x;
189 centroid->
y = sorted[in->
nTuples >> 1]->
y;
192 centroid =
palloc0(
sizeof(*centroid));
256 infbbox.
high.
x = inf;
257 infbbox.
high.
y = inf;
258 infbbox.
low.
x = -inf;
259 infbbox.
low.
y = -inf;
298 which = (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4);
309 which &= (1 << 3) | (1 << 4);
313 which &= (1 << 1) | (1 << 2);
321 which &= (1 << 2) | (1 << 3);
326 which &= (1 << 1) | (1 << 4);
355 p.
x = boxQuery->
low.
x;
362 elog(
ERROR,
"unrecognized strategy number: %d",
372 for (
i = 0;
i < 4; ++
i)
379 for (
i = 1;
i <= 4;
i++)
381 if (which & (1 <<
i))
456 elog(
ERROR,
"unrecognized strategy number: %d",
#define Assert(condition)
static void PGresult * res
static float8 get_float8_infinity(void)
#define DirectFunctionCall2(func, arg1, arg2)
#define PG_GETARG_POINTER(n)
#define PG_RETURN_BOOL(x)
static Point * DatumGetPointP(Datum X)
static BOX * DatumGetBoxP(Datum X)
static Datum PointPGetDatum(const Point *X)
static Datum BoxPGetDatum(const BOX *X)
Datum point_eq(PG_FUNCTION_ARGS)
Datum point_above(PG_FUNCTION_ARGS)
Datum box_contain_pt(PG_FUNCTION_ARGS)
Datum point_below(PG_FUNCTION_ARGS)
Datum point_horiz(PG_FUNCTION_ARGS)
Datum point_left(PG_FUNCTION_ARGS)
Datum point_right(PG_FUNCTION_ARGS)
Datum point_vert(PG_FUNCTION_ARGS)
void * palloc0(Size size)
#define qsort(a, b, c, d)
static bool DatumGetBool(Datum X)
static Datum PointerGetDatum(const void *X)
MemoryContextSwitchTo(old_ctx)
static int x_cmp(const void *a, const void *b)
static int y_cmp(const void *a, const void *b)
BOX * box_copy(BOX *orig)
double * spg_key_orderbys_distances(Datum key, bool isLeaf, ScanKey orderbys, int norderbys)
Datum spg_quad_picksplit(PG_FUNCTION_ARGS)
static BOX * getQuadrantArea(BOX *bbox, Point *centroid, int quadrant)
Datum spg_quad_choose(PG_FUNCTION_ARGS)
static int16 getQuadrant(Point *centroid, Point *tst)
Datum spg_quad_config(PG_FUNCTION_ARGS)
Datum spg_quad_leaf_consistent(PG_FUNCTION_ARGS)
Datum spg_quad_inner_consistent(PG_FUNCTION_ARGS)
#define RTLeftStrategyNumber
#define RTRightStrategyNumber
#define RTSameStrategyNumber
#define RTOldBelowStrategyNumber
#define RTBelowStrategyNumber
#define RTOldAboveStrategyNumber
#define RTAboveStrategyNumber
#define RTContainedByStrategyNumber
StrategyNumber sk_strategy
spgChooseResultType resultType
union spgChooseOut::@50 result
struct spgChooseOut::@50::@51 matchNode
MemoryContext traversalMemoryContext