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

Definition at line 1155 of file gserialized_gist_2d.c.

References box2df_copy(), and box2df_merge().

1156 {
1157  GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
1158  int *sizep = (int *) PG_GETARG_POINTER(1); /* Size of the return value */
1159  int numranges, i;
1160  BOX2DF *box_cur, *box_union;
1161 
1162  POSTGIS_DEBUG(4, "[GIST] 'union' function called");
1163 
1164  numranges = entryvec->n;
1165 
1166  box_cur = (BOX2DF*) DatumGetPointer(entryvec->vector[0].key);
1167 
1168  box_union = box2df_copy(box_cur);
1169 
1170  for ( i = 1; i < numranges; i++ )
1171  {
1172  box_cur = (BOX2DF*) DatumGetPointer(entryvec->vector[i].key);
1173  box2df_merge(box_union, box_cur);
1174  }
1175 
1176  *sizep = sizeof(BOX2DF);
1177 
1178  POSTGIS_DEBUGF(4, "[GIST] 'union', numranges(%i), pageunion %s", numranges, box2df_to_string(box_union));
1179 
1180  PG_RETURN_POINTER(box_union);
1181 
1182 }
static BOX2DF * box2df_copy(BOX2DF *b)
static void box2df_merge(BOX2DF *b_union, BOX2DF *b_new)

Here is the call graph for this function: