PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ vectortile_layer_combine()

static VectorTile__Tile__Layer* vectortile_layer_combine ( const VectorTile__Tile__Layer *  layer1,
const VectorTile__Tile__Layer *  layer2 
)
static

Definition at line 1370 of file mvt.c.

1371 {
1372  uint32_t i, j;
1373  int key2_offset, value2_offset;
1374  VectorTile__Tile__Layer *layer = palloc(sizeof(VectorTile__Tile__Layer));
1375  vector_tile__tile__layer__init(layer);
1376 
1377  /* Take globals from layer1 */
1378  layer->version = layer1->version;
1379  layer->name = pstrdup(layer1->name);
1380  layer->has_extent = layer1->has_extent;
1381  layer->extent = layer1->extent;
1382 
1383  /* Copy keys into new layer */
1384  j = 0;
1385  layer->n_keys = layer1->n_keys + layer2->n_keys;
1386  layer->keys = layer->n_keys ? palloc(layer->n_keys * sizeof(void*)) : NULL;
1387  for (i = 0; i < layer1->n_keys; i++)
1388  layer->keys[j++] = pstrdup(layer1->keys[i]);
1389  key2_offset = j;
1390  for (i = 0; i < layer2->n_keys; i++)
1391  layer->keys[j++] = pstrdup(layer2->keys[i]);
1392 
1393  /* Copy values into new layer */
1394  /* TODO, apply hash logic here too, so that merged tiles */
1395  /* retain unique value maps */
1396  layer->n_values = layer1->n_values + layer2->n_values;
1397  layer->values = layer->n_values ? palloc(layer->n_values * sizeof(void*)) : NULL;
1398  j = 0;
1399  for (i = 0; i < layer1->n_values; i++)
1400  layer->values[j++] = tile_value_copy(layer1->values[i]);
1401  value2_offset = j;
1402  for (i = 0; i < layer2->n_values; i++)
1403  layer->values[j++] = tile_value_copy(layer2->values[i]);
1404 
1405 
1406  layer->n_features = layer1->n_features + layer2->n_features;
1407  layer->features = layer->n_features ? palloc(layer->n_features * sizeof(void*)) : NULL;
1408  j = 0;
1409  for (i = 0; i < layer1->n_features; i++)
1410  layer->features[j++] = tile_feature_copy(layer1->features[i], 0, 0);
1411  for (i = 0; i < layer2->n_features; i++)
1412  layer->features[j++] = tile_feature_copy(layer2->features[i], key2_offset, value2_offset);
1413 
1414  return layer;
1415 }
static VectorTile__Tile__Feature * tile_feature_copy(const VectorTile__Tile__Feature *feature, int key_offset, int value_offset)
Definition: mvt.c:1326
static VectorTile__Tile__Value * tile_value_copy(const VectorTile__Tile__Value *value)
Definition: mvt.c:1316
unsigned int uint32_t
Definition: uthash.h:78

References tile_feature_copy(), and tile_value_copy().

Referenced by vectortile_tile_combine().

Here is the call graph for this function:
Here is the caller graph for this function: