Start writing a feature

This commit is contained in:
Eric Fischer 2014-09-22 16:50:24 -07:00
parent 27f99a1322
commit 78304d6385
2 changed files with 22 additions and 6 deletions

26
tile.cc
View File

@ -57,6 +57,8 @@ void check_range(struct index *start, struct index *end, char *metabase, unsigne
struct index *i;
printf("tile -----------------------------------------------\n");
for (i = start; i < end; i++) {
mapnik::vector::tile_feature *feature = layer->add_features();
printf("%llx ", i->index);
char *meta = metabase + i->fpos;
@ -65,16 +67,27 @@ void check_range(struct index *start, struct index *end, char *metabase, unsigne
deserialize_int(&meta, &t);
printf("(%d) ", t);
while (1) {
deserialize_int(&meta, &t);
if (t == VT_POINT) {
feature->set_type(mapnik::vector::tile::Point);
} else if (t == VT_LINE) {
feature->set_type(mapnik::vector::tile::LineString);
} else if (t == VT_POLYGON) {
feature->set_type(mapnik::vector::tile::Polygon);
} else {
feature->set_type(mapnik::vector::tile::Unknown);
}
if (t == VT_END) {
while (1) {
int op;
deserialize_int(&meta, &op);
if (op == VT_END) {
break;
}
printf("%d: ", t);
printf("%d: ", op);
if (t == VT_MOVETO || t == VT_LINETO) {
if (op == VT_MOVETO || op == VT_LINETO) {
int x, y;
deserialize_int(&meta, &x);
deserialize_int(&meta, &y);
@ -95,6 +108,9 @@ void check_range(struct index *start, struct index *end, char *metabase, unsigne
struct pool_val *key = deserialize_string(&meta, &keys, VT_STRING);
struct pool_val *value = deserialize_string(&meta, &keys, t);
feature->add_tags(key->n);
feature->add_tags(value->n);
printf("%s (%d) = %s (%d)\n", key->s, key->n, value->s, value->n);
}

2
tile.h
View File

@ -1,8 +1,8 @@
#define VT_END 0
#define VT_POINT 1
#define VT_LINE 2
#define VT_POLYGON 3
#define VT_END 0
#define VT_MOVETO 1
#define VT_LINETO 2
#define VT_CLOSEPATH 7