PostGIS  2.5.0beta2dev-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 976 of file mvt.c.

Referenced by vectortile_layer_combine().

977 {
978  uint32_t i;
979  VectorTile__Tile__Feature *nfeature;
980 
981  /* Null in => Null out */
982  if (!feature) return NULL;
983 
984  /* Init object */
985  nfeature = palloc(sizeof(VectorTile__Tile__Feature));
986  vector_tile__tile__feature__init(nfeature);
987 
988  /* Copy settings straight over */
989  nfeature->has_id = feature->has_id;
990  nfeature->id = feature->id;
991  nfeature->has_type = feature->has_type;
992  nfeature->type = feature->type;
993 
994  /* Copy tags over, offsetting indexes so they match the dictionaries */
995  /* at the Tile_Layer level */
996  if (feature->n_tags > 0)
997  {
998  nfeature->n_tags = feature->n_tags;
999  nfeature->tags = palloc(sizeof(uint32_t)*feature->n_tags);
1000  for (i = 0; i < feature->n_tags/2; i++)
1001  {
1002  nfeature->tags[2*i] = feature->tags[2*i] + key_offset;
1003  nfeature->tags[2*i+1] = feature->tags[2*i+1] + value_offset;
1004  }
1005  }
1006 
1007  /* Copy the raw geometry data over literally */
1008  if (feature->n_geometry > 0)
1009  {
1010  nfeature->n_geometry = feature->n_geometry;
1011  nfeature->geometry = palloc(sizeof(uint32_t)*feature->n_geometry);
1012  memcpy(nfeature->geometry, feature->geometry, sizeof(uint32_t)*feature->n_geometry);
1013  }
1014 
1015  /* Done */
1016  return nfeature;
1017 }
unsigned int uint32_t
Definition: uthash.h:78
Here is the caller graph for this function: