507 spgInnerConsistentIn *in = (spgInnerConsistentIn *)PG_GETARG_POINTER(0);
508 spgInnerConsistentOut *out = (spgInnerConsistentOut *)PG_GETARG_POINTER(1);
510 MemoryContext old_ctx;
515 void **traversalValues;
520 out->nNodes = in->nNodes;
521 out->nodeNumbers = (
int *)palloc(
sizeof(
int) * in->nNodes);
522 for (i = 0; i < in->nNodes; i++)
523 out->nodeNumbers[i] = i;
532 if (in->traversalValue)
533 cube_box = in->traversalValue;
537 centroid = DatumGetBox3DP(in->prefixDatum);
541 nodeNumbers = (
int *)palloc(
sizeof(
int) * in->nNodes);
542 traversalValues = (
void **)palloc(
sizeof(
void *) * in->nNodes);
549 old_ctx = MemoryContextSwitchTo(in->traversalMemoryContext);
551 for (octant = 0; octant < in->nNodes; octant++)
556 for (i = 0; i < in->nkeys; i++)
558 StrategyNumber strategy = in->scankeys[i].sk_strategy;
559 Datum query = in->scankeys[i].sk_argument;
579 flag = !
right6D(next_cube_box, box);
587 flag = !
left6D(next_cube_box, box);
595 flag = !
below6D(next_cube_box, box);
603 flag = !
above6D(next_cube_box, box);
611 flag = !
front6D(next_cube_box, box);
619 flag = !
back6D(next_cube_box, box);
623 elog(ERROR,
"unrecognized strategy: %d", strategy);
633 traversalValues[out->nNodes] = next_cube_box;
634 nodeNumbers[out->nNodes] = octant;
643 pfree(next_cube_box);
648 out->nodeNumbers = (
int *)palloc(
sizeof(
int) * out->nNodes);
649 out->traversalValues = (
void **)palloc(
sizeof(
void *) * out->nNodes);
650 for (i = 0; i < out->nNodes; i++)
652 out->nodeNumbers[i] = nodeNumbers[i];
653 out->traversalValues[i] = traversalValues[i];
656 pfree(traversalValues);
659 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)