PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ gserialized_gist_union_2d()

Datum gserialized_gist_union_2d ( PG_FUNCTION_ARGS  )

Definition at line 1379 of file gserialized_gist_2d.c.

References box2df_copy(), box2df_merge(), box2df_to_string(), gserialized_gist_same_2d(), and PG_FUNCTION_INFO_V1().

Referenced by gserialized_gist_penalty_2d().

1380 {
1381  GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
1382  int *sizep = (int *) PG_GETARG_POINTER(1); /* Size of the return value */
1383  int numranges, i;
1384  BOX2DF *box_cur, *box_union;
1385 
1386  POSTGIS_DEBUG(4, "[GIST] 'union' function called");
1387 
1388  numranges = entryvec->n;
1389 
1390  box_cur = (BOX2DF*) DatumGetPointer(entryvec->vector[0].key);
1391 
1392  box_union = box2df_copy(box_cur);
1393 
1394  for ( i = 1; i < numranges; i++ )
1395  {
1396  box_cur = (BOX2DF*) DatumGetPointer(entryvec->vector[i].key);
1397  box2df_merge(box_union, box_cur);
1398  }
1399 
1400  *sizep = sizeof(BOX2DF);
1401 
1402  POSTGIS_DEBUGF(4, "[GIST] 'union', numranges(%i), pageunion %s", numranges, box2df_to_string(box_union));
1403 
1404  PG_RETURN_POINTER(box_union);
1405 
1406 }
static BOX2DF * box2df_copy(BOX2DF *b)
static char * box2df_to_string(const BOX2DF *a)
static void box2df_merge(BOX2DF *b_union, BOX2DF *b_new)
Here is the call graph for this function:
Here is the caller graph for this function: