508 spgInnerConsistentIn *in = (spgInnerConsistentIn *)PG_GETARG_POINTER(0);
509 spgInnerConsistentOut *out = (spgInnerConsistentOut *)PG_GETARG_POINTER(1);
511 MemoryContext old_ctx;
516 void **traversalValues;
521 out->nNodes = in->nNodes;
522 out->nodeNumbers = (
int *)palloc(
sizeof(
int) * in->nNodes);
523 for (i = 0; i < in->nNodes; i++)
524 out->nodeNumbers[i] = i;
533 if (in->traversalValue)
534 cube_box = in->traversalValue;
538 centroid = DatumGetBox3DP(in->prefixDatum);
542 nodeNumbers = (
int *)palloc(
sizeof(
int) * in->nNodes);
543 traversalValues = (
void **)palloc(
sizeof(
void *) * in->nNodes);
550 old_ctx = MemoryContextSwitchTo(in->traversalMemoryContext);
552 for (octant = 0; octant < in->nNodes; octant++)
557 for (i = 0; i < in->nkeys; i++)
559 StrategyNumber strategy = in->scankeys[i].sk_strategy;
560 Datum query = in->scankeys[i].sk_argument;
580 flag = !
right6D(next_cube_box, box);
588 flag = !
left6D(next_cube_box, box);
596 flag = !
below6D(next_cube_box, box);
604 flag = !
above6D(next_cube_box, box);
612 flag = !
front6D(next_cube_box, box);
620 flag = !
back6D(next_cube_box, box);
624 elog(ERROR,
"unrecognized strategy: %d", strategy);
634 traversalValues[out->nNodes] = next_cube_box;
635 nodeNumbers[out->nNodes] = octant;
644 pfree(next_cube_box);
649 out->nodeNumbers = (
int *)palloc(
sizeof(
int) * out->nNodes);
650 out->traversalValues = (
void **)palloc(
sizeof(
void *) * out->nNodes);
651 for (i = 0; i < out->nNodes; i++)
653 out->nodeNumbers[i] = nodeNumbers[i];
654 out->traversalValues[i] = traversalValues[i];
657 pfree(traversalValues);
660 MemoryContextSwitchTo(old_ctx);
static bool front6D(CubeBox3D *cube_box, BOX3D *query)
static bool back6D(CubeBox3D *cube_box, BOX3D *query)
static bool right6D(CubeBox3D *cube_box, BOX3D *query)
static bool overBack6D(CubeBox3D *cube_box, BOX3D *query)
static bool overAbove6D(CubeBox3D *cube_box, BOX3D *query)
static bool overlap6D(CubeBox3D *cube_box, BOX3D *query)
static CubeBox3D * nextCubeBox3D(CubeBox3D *cube_box, BOX3D *centroid, uint8 octant)
static bool overRight6D(CubeBox3D *cube_box, BOX3D *query)
static bool overFront6D(CubeBox3D *cube_box, BOX3D *query)
static CubeBox3D * initCubeBox(void)
static bool contain6D(CubeBox3D *cube_box, BOX3D *query)
static bool overBelow6D(CubeBox3D *cube_box, BOX3D *query)
static bool above6D(CubeBox3D *cube_box, BOX3D *query)
static bool below6D(CubeBox3D *cube_box, BOX3D *query)
static bool overLeft6D(CubeBox3D *cube_box, BOX3D *query)
static bool left6D(CubeBox3D *cube_box, BOX3D *query)
#define SPGOverlapStrategyNumber
#define SPGOverLeftStrategyNumber
#define SPGLeftStrategyNumber
#define SPGAboveStrategyNumber
#define SPGSameStrategyNumber
#define SPGOverBackStrategyNumber
#define SPGContainedByStrategyNumber
#define SPGOverRightStrategyNumber
#define SPGFrontStrategyNumber
#define SPGBelowStrategyNumber
#define SPGRightStrategyNumber
#define SPGOverFrontStrategyNumber
#define SPGContainsStrategyNumber
#define SPGOverBelowStrategyNumber
#define SPGBackStrategyNumber
#define SPGOverAboveStrategyNumber
Datum LWGEOM_to_BOX3D(PG_FUNCTION_ARGS)
Datum centroid(PG_FUNCTION_ARGS)