PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ tile_feature_copy()

static VectorTile__Tile__Feature* tile_feature_copy ( const VectorTile__Tile__Feature *  feature,
int  key_offset,
int  value_offset 
)
static

Definition at line 1326 of file mvt.c.

1327 {
1328  uint32_t i;
1329  VectorTile__Tile__Feature *nfeature;
1330 
1331  /* Null in => Null out */
1332  if (!feature) return NULL;
1333 
1334  /* Init object */
1335  nfeature = palloc(sizeof(VectorTile__Tile__Feature));
1336  vector_tile__tile__feature__init(nfeature);
1337 
1338  /* Copy settings straight over */
1339  nfeature->has_id = feature->has_id;
1340  nfeature->id = feature->id;
1341  nfeature->has_type = feature->has_type;
1342  nfeature->type = feature->type;
1343 
1344  /* Copy tags over, offsetting indexes so they match the dictionaries */
1345  /* at the Tile_Layer level */
1346  if (feature->n_tags > 0)
1347  {
1348  nfeature->n_tags = feature->n_tags;
1349  nfeature->tags = palloc(sizeof(uint32_t)*feature->n_tags);
1350  for (i = 0; i < feature->n_tags/2; i++)
1351  {
1352  nfeature->tags[2*i] = feature->tags[2*i] + key_offset;
1353  nfeature->tags[2*i+1] = feature->tags[2*i+1] + value_offset;
1354  }
1355  }
1356 
1357  /* Copy the raw geometry data over literally */
1358  if (feature->n_geometry > 0)
1359  {
1360  nfeature->n_geometry = feature->n_geometry;
1361  nfeature->geometry = palloc(sizeof(uint32_t)*feature->n_geometry);
1362  memcpy(nfeature->geometry, feature->geometry, sizeof(uint32_t)*feature->n_geometry);
1363  }
1364 
1365  /* Done */
1366  return nfeature;
1367 }
unsigned int uint32_t
Definition: uthash.h:78

Referenced by vectortile_layer_combine().

Here is the caller graph for this function: