PostGIS  2.1.10dev-r@@SVN_REVISION@@
Datum gserialized_distance_box_2d ( PG_FUNCTION_ARGS  )

Definition at line 637 of file gserialized_gist_2d.c.

References box2df_distance(), distance(), gserialized_datum_get_box2df_p(), LW_SUCCESS, and MAXFLOAT.

638 {
639  BOX2DF b1, b2;
640  Datum gs1 = PG_GETARG_DATUM(0);
641  Datum gs2 = PG_GETARG_DATUM(1);
642 
643  POSTGIS_DEBUG(3, "entered function");
644 
645  /* Must be able to build box for each argument (ie, not empty geometry). */
646  if ( (gserialized_datum_get_box2df_p(gs1, &b1) == LW_SUCCESS) &&
648  {
649  double distance = box2df_distance(&b1, &b2);
650  POSTGIS_DEBUGF(3, "got boxes %s and %s", box2df_to_string(&b1), box2df_to_string(&b2));
651  PG_RETURN_FLOAT8(distance);
652  }
653  PG_RETURN_FLOAT8(MAXFLOAT);
654 }
#define LW_SUCCESS
Definition: liblwgeom.h:55
static double box2df_distance(const BOX2DF *a, const BOX2DF *b)
Calculate the box->box distance.
static int gserialized_datum_get_box2df_p(Datum gsdatum, BOX2DF *box2df)
Peak into a GSERIALIZED datum to find the bounding box.
Datum distance(PG_FUNCTION_ARGS)
#define MAXFLOAT
Largest float value.

Here is the call graph for this function: