PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ gserialized_spgist_leaf_consistent_3d()

PGDLLEXPORT Datum gserialized_spgist_leaf_consistent_3d ( PG_FUNCTION_ARGS  )

Definition at line 669 of file gserialized_spgist_3d.c.

670 {
671  spgLeafConsistentIn *in = (spgLeafConsistentIn *)PG_GETARG_POINTER(0);
672  spgLeafConsistentOut *out = (spgLeafConsistentOut *)PG_GETARG_POINTER(1);
673  BOX3D *leaf = DatumGetBox3DP(in->leafDatum);
674  bool flag = true;
675  int i;
676 
677  /* All tests are exact. */
678  out->recheck = false;
679 
680  /* leafDatum is what it is... */
681  out->leafValue = in->leafDatum;
682 
683  /* Perform the required comparison(s) */
684  for (i = 0; i < in->nkeys; i++)
685  {
686  StrategyNumber strategy = in->scankeys[i].sk_strategy;
687  Datum query = in->scankeys[i].sk_argument;
688  BOX3D *box = DatumGetBox3DP(DirectFunctionCall1(LWGEOM_to_BOX3D, query));
689 
690  switch (strategy)
691  {
693  flag = BOX3D_overlaps_internal(leaf, box);
694  break;
695 
697  flag = BOX3D_contains_internal(leaf, box);
698  break;
699 
701  flag = BOX3D_contained_internal(leaf, box);
702  break;
703 
705  flag = BOX3D_same_internal(leaf, box);
706  break;
707 
709  flag = BOX3D_left_internal(leaf, box);
710  break;
711 
713  flag = BOX3D_overleft_internal(leaf, box);
714  break;
715 
717  flag = BOX3D_right_internal(leaf, box);
718  break;
719 
721  flag = BOX3D_overright_internal(leaf, box);
722  break;
723 
725  flag = BOX3D_above_internal(leaf, box);
726  break;
727 
729  flag = BOX3D_overabove_internal(leaf, box);
730  break;
731 
733  flag = BOX3D_below_internal(leaf, box);
734  break;
735 
737  flag = BOX3D_overbelow_internal(leaf, box);
738  break;
739 
741  flag = BOX3D_back_internal(leaf, box);
742  break;
743 
745  flag = BOX3D_overback_internal(leaf, box);
746  break;
747 
749  flag = BOX3D_front_internal(leaf, box);
750  break;
751 
753  flag = BOX3D_overfront_internal(leaf, box);
754  break;
755 
756  default:
757  elog(ERROR, "unrecognized strategy: %d", strategy);
758  }
759 
760  /* If any check is failed, we have found our answer. */
761  if (!flag)
762  break;
763  }
764 
765  PG_RETURN_BOOL(flag);
766 }
#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)
Definition: lwgeom_box3d.c:390
bool BOX3D_above_internal(BOX3D *box1, BOX3D *box2)
bool BOX3D_back_internal(BOX3D *box1, BOX3D *box2)
bool BOX3D_overlaps_internal(BOX3D *box1, BOX3D *box2)
bool BOX3D_contains_internal(BOX3D *box1, BOX3D *box2)
bool BOX3D_overabove_internal(BOX3D *box1, BOX3D *box2)
bool BOX3D_right_internal(BOX3D *box1, BOX3D *box2)
bool BOX3D_overback_internal(BOX3D *box1, BOX3D *box2)
bool BOX3D_overleft_internal(BOX3D *box1, BOX3D *box2)
bool BOX3D_below_internal(BOX3D *box1, BOX3D *box2)
bool BOX3D_left_internal(BOX3D *box1, BOX3D *box2)
bool BOX3D_overright_internal(BOX3D *box1, BOX3D *box2)
bool BOX3D_same_internal(BOX3D *box1, BOX3D *box2)
bool BOX3D_contained_internal(BOX3D *box1, BOX3D *box2)
bool BOX3D_front_internal(BOX3D *box1, BOX3D *box2)
bool BOX3D_overfront_internal(BOX3D *box1, BOX3D *box2)
bool BOX3D_overbelow_internal(BOX3D *box1, BOX3D *box2)

References BOX3D_above_internal(), BOX3D_back_internal(), BOX3D_below_internal(), BOX3D_contained_internal(), BOX3D_contains_internal(), BOX3D_front_internal(), BOX3D_left_internal(), BOX3D_overabove_internal(), BOX3D_overback_internal(), BOX3D_overbelow_internal(), BOX3D_overfront_internal(), BOX3D_overlaps_internal(), BOX3D_overleft_internal(), BOX3D_overright_internal(), BOX3D_right_internal(), BOX3D_same_internal(), LWGEOM_to_BOX3D(), SPGAboveStrategyNumber, SPGBackStrategyNumber, SPGBelowStrategyNumber, SPGContainedByStrategyNumber, SPGContainsStrategyNumber, SPGFrontStrategyNumber, SPGLeftStrategyNumber, SPGOverAboveStrategyNumber, SPGOverBackStrategyNumber, SPGOverBelowStrategyNumber, SPGOverFrontStrategyNumber, SPGOverlapStrategyNumber, SPGOverLeftStrategyNumber, SPGOverRightStrategyNumber, SPGRightStrategyNumber, and SPGSameStrategyNumber.

Here is the call graph for this function: