use feature_type to distinguish between geometry type and bucket type

This commit is contained in:
Konstantin Käfer
2014-03-12 14:31:37 +01:00
parent 29e4ecb977
commit ceb75b7b26
2 changed files with 18 additions and 2 deletions

View File

@@ -316,7 +316,7 @@ void FilteredVectorTileLayer::iterator::operator++() {
default: type = BucketType::None; break;
}
if (type != filter.bucket_desc.type) {
if (type != filter.bucket_desc.feature_type) {
break; // feature_pbf loop early
}
} else {
@@ -324,7 +324,7 @@ void FilteredVectorTileLayer::iterator::operator++() {
}
}
if (!skip && type == filter.bucket_desc.type) {
if (!skip && type == filter.bucket_desc.feature_type) {
valid = true;
return; // data loop
} else {

View File

@@ -31,6 +31,12 @@ BucketDescription StyleParser::parseBucket(JSVal value) {
} else {
throw Style::exception("bucket type must be a string");
}
} else if (name == "feature_type") {
if (value.IsString()) {
bucket.feature_type = bucketType({ value.GetString(), value.GetStringLength() });
} else {
throw Style::exception("feature type must be a string");
}
} else if (name == "source") {
if (value.IsString()) {
bucket.source_name = { value.GetString(), value.GetStringLength() };
@@ -81,6 +87,12 @@ BucketDescription StyleParser::parseBucket(JSVal value) {
} else {
throw Style::exception("font size must be a number");
}
} else if (name == "text_field") {
if (value.IsString()) {
bucket.geometry.text_field = { value.GetString(), value.GetStringLength() };
} else {
throw Style::exception("text field must be a string");
}
} else if (name == "miterLimit") {
if (value.IsNumber()) {
bucket.geometry.miter_limit = value.GetDouble();
@@ -96,6 +108,10 @@ BucketDescription StyleParser::parseBucket(JSVal value) {
}
}
if (bucket.feature_type == BucketType::None) {
bucket.feature_type = bucket.type;
}
return bucket;
}