PostGIS  2.5.0dev-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 975 of file mvt.c.

Referenced by vectortile_layer_combine().

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