PostGIS  2.5.1dev-r@@SVN_REVISION@@

◆ vectortile_tile_combine()

static VectorTile__Tile* vectortile_tile_combine ( VectorTile__Tile *  tile1,
VectorTile__Tile *  tile2 
)
static

Definition at line 1195 of file mvt.c.

References vectortile_layer_combine().

Referenced by mvt_ctx_combine().

1196 {
1197  uint32_t i, j;
1198  VectorTile__Tile *tile;
1199 
1200  /* Hopelessly messing up memory ownership here */
1201  if (tile1->n_layers == 0 && tile2->n_layers == 0)
1202  return tile1;
1203  else if (tile1->n_layers == 0)
1204  return tile2;
1205  else if (tile2->n_layers == 0)
1206  return tile1;
1207 
1208  tile = palloc(sizeof(VectorTile__Tile));
1209  vector_tile__tile__init(tile);
1210  tile->layers = palloc(sizeof(void*));
1211  tile->n_layers = 0;
1212 
1213  /* Merge all matching layers in the files (basically always only one) */
1214  for (i = 0; i < tile1->n_layers; i++)
1215  {
1216  for (j = 0; j < tile2->n_layers; j++)
1217  {
1218  VectorTile__Tile__Layer *l1 = tile1->layers[i];
1219  VectorTile__Tile__Layer *l2 = tile2->layers[j];
1220  if (strcmp(l1->name, l2->name)==0)
1221  {
1222  VectorTile__Tile__Layer *layer = vectortile_layer_combine(l1, l2);
1223  if (!layer)
1224  continue;
1225  tile->layers[tile->n_layers++] = layer;
1226  /* Add a spare slot at the end of the array */
1227  tile->layers = repalloc(tile->layers, (tile->n_layers+1) * sizeof(void*));
1228  }
1229  }
1230  }
1231  return tile;
1232 }
static VectorTile__Tile__Layer * vectortile_layer_combine(const VectorTile__Tile__Layer *layer1, const VectorTile__Tile__Layer *layer2)
Definition: mvt.c:1146
unsigned int uint32_t
Definition: uthash.h:78
Here is the call graph for this function:
Here is the caller graph for this function: