PostGIS  2.1.10dev-r@@SVN_REVISION@@
static bool gidx_contains ( GIDX *  a,
GIDX *  b 
)
static

Definition at line 349 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().

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

Here is the call graph for this function:

Here is the caller graph for this function: