PostGIS  2.5.1dev-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 1102 of file mvt.c.

Referenced by vectortile_layer_combine().

1103 {
1104  uint32_t i;
1105  VectorTile__Tile__Feature *nfeature;
1106 
1107  /* Null in => Null out */
1108  if (!feature) return NULL;
1109 
1110  /* Init object */
1111  nfeature = palloc(sizeof(VectorTile__Tile__Feature));
1112  vector_tile__tile__feature__init(nfeature);
1113 
1114  /* Copy settings straight over */
1115  nfeature->has_id = feature->has_id;
1116  nfeature->id = feature->id;
1117  nfeature->has_type = feature->has_type;
1118  nfeature->type = feature->type;
1119 
1120  /* Copy tags over, offsetting indexes so they match the dictionaries */
1121  /* at the Tile_Layer level */
1122  if (feature->n_tags > 0)
1123  {
1124  nfeature->n_tags = feature->n_tags;
1125  nfeature->tags = palloc(sizeof(uint32_t)*feature->n_tags);
1126  for (i = 0; i < feature->n_tags/2; i++)
1127  {
1128  nfeature->tags[2*i] = feature->tags[2*i] + key_offset;
1129  nfeature->tags[2*i+1] = feature->tags[2*i+1] + value_offset;
1130  }
1131  }
1132 
1133  /* Copy the raw geometry data over literally */
1134  if (feature->n_geometry > 0)
1135  {
1136  nfeature->n_geometry = feature->n_geometry;
1137  nfeature->geometry = palloc(sizeof(uint32_t)*feature->n_geometry);
1138  memcpy(nfeature->geometry, feature->geometry, sizeof(uint32_t)*feature->n_geometry);
1139  }
1140 
1141  /* Done */
1142  return nfeature;
1143 }
unsigned int uint32_t
Definition: uthash.h:78
Here is the caller graph for this function: