PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ gidx_contains()

static bool gidx_contains ( GIDX *  a,
GIDX *  b 
)
static

Definition at line 354 of file gserialized_gist_nd.c.

References FALSE, gidx_is_unknown(), and TRUE.

Referenced by gserialized_contains(), gserialized_gist_consistent_internal(), gserialized_gist_consistent_leaf(), and gserialized_within().

355 {
356  int i, dims_a, dims_b;
357 
358  POSTGIS_DEBUG(5, "entered function");
359 
360  if ( (a == NULL) || (b == NULL) ) return FALSE;
361 
362  if ( gidx_is_unknown(a) || gidx_is_unknown(b) )
363  return FALSE;
364 
365  dims_a = GIDX_NDIMS(a);
366  dims_b = GIDX_NDIMS(b);
367 
368  if ( dims_a < dims_b )
369  {
370  /*
371  ** If (b) is of higher dimensionality than (a) it can only be contained
372  ** if those higher dimensions are zeroes.
373  */
374  for (i = dims_a; i < dims_b; i++)
375  {
376  if ( GIDX_GET_MIN(b,i) != 0 )
377  return FALSE;
378  if ( GIDX_GET_MAX(b,i) != 0 )
379  return FALSE;
380  }
381  }
382 
383  /* Excess dimensions of (a), don't matter, it just has to contain (b) in (b)'s dimensions */
384  for (i = 0; i < Min(dims_a, dims_b); i++)
385  {
386  if ( GIDX_GET_MIN(a,i) > GIDX_GET_MIN(b,i) )
387  return FALSE;
388  if ( GIDX_GET_MAX(a,i) < GIDX_GET_MAX(b,i) )
389  return FALSE;
390  }
391 
392  return TRUE;
393 }
static bool gidx_is_unknown(const GIDX *a)
#define FALSE
Definition: dbfopen.c:168
#define TRUE
Definition: dbfopen.c:169
Here is the call graph for this function:
Here is the caller graph for this function: