PostGIS  2.5.0dev-r@@SVN_REVISION@@

◆ vectortile_tile_combine()

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

Definition at line 1069 of file mvt.c.

References vectortile_layer_combine().

Referenced by mvt_ctx_combine().

1070 {
1071  uint32_t i, j;
1072  VectorTile__Tile *tile;
1073 
1074  /* Hopelessly messing up memory ownership here */
1075  if (tile1->n_layers == 0 && tile2->n_layers == 0)
1076  return tile1;
1077  else if (tile1->n_layers == 0)
1078  return tile2;
1079  else if (tile2->n_layers == 0)
1080  return tile1;
1081 
1082  tile = palloc(sizeof(VectorTile__Tile));
1083  vector_tile__tile__init(tile);
1084  tile->layers = palloc(sizeof(void*));
1085  tile->n_layers = 0;
1086 
1087  /* Merge all matching layers in the files (basically always only one) */
1088  for (i = 0; i < tile1->n_layers; i++)
1089  {
1090  for (j = 0; j < tile2->n_layers; j++)
1091  {
1092  VectorTile__Tile__Layer *l1 = tile1->layers[i];
1093  VectorTile__Tile__Layer *l2 = tile2->layers[j];
1094  if (strcmp(l1->name, l2->name)==0)
1095  {
1096  VectorTile__Tile__Layer *layer = vectortile_layer_combine(l1, l2);
1097  if (!layer)
1098  continue;
1099  tile->layers[tile->n_layers++] = layer;
1100  /* Add a spare slot at the end of the array */
1101  tile->layers = repalloc(tile->layers, (tile->n_layers+1) * sizeof(void*));
1102  }
1103  }
1104  }
1105  return tile;
1106 }
static VectorTile__Tile__Layer * vectortile_layer_combine(const VectorTile__Tile__Layer *layer1, const VectorTile__Tile__Layer *layer2)
Definition: mvt.c:1019
unsigned int uint32_t
Definition: uthash.h:78
Here is the call graph for this function:
Here is the caller graph for this function: