show tile parse warnings

This commit is contained in:
Konstantin Käfer
2014-05-21 14:18:25 +02:00
parent 834ef2eee8
commit 16a79b42ca
4 changed files with 20 additions and 3 deletions

View File

@@ -14,6 +14,7 @@ extern const float tileSize;
namespace debug {
extern const bool tileParseWarnings;
extern const bool styleParseWarnings;
extern const bool renderWarnings;
extern const bool renderTree;

View File

@@ -7,6 +7,7 @@
#include <llmr/renderer/text_bucket.hpp>
#include <llmr/renderer/raster_bucket.hpp>
#include <llmr/util/raster.hpp>
#include <llmr/util/constants.hpp>
#include <llmr/geometry/glyph_atlas.hpp>
#include <llmr/util/std.hpp>
@@ -77,7 +78,10 @@ void TileParser::parseStyleLayers(const std::vector<LayerDescription>& layers) {
} else {
// There is no proper specification for this bucket, even though
// it is referenced in the stylesheet.
fprintf(stderr, "Stylesheet specifies bucket %s, but it is not defined\n", layer_desc.bucket_name.c_str());
if (debug::tileParseWarnings) {
fprintf(stderr, "Stylesheet specifies bucket %s, but it is not defined\n",
layer_desc.bucket_name.c_str());
}
}
}
}
@@ -101,6 +105,10 @@ std::unique_ptr<Bucket> TileParser::createBucket(const BucketDescription& bucket
}
} else {
// The layer specified in the bucket does not exist. Do nothing.
if (debug::tileParseWarnings) {
fprintf(stderr, "[WARNING] layer '%s' does not exist in source '%s'\n",
bucket_desc.source_layer.c_str(), bucket_desc.source_name.c_str());
}
}
return nullptr;
@@ -116,6 +124,8 @@ void TileParser::addBucketFeatures(Bucket& bucket, const VectorTileLayer& layer,
pbf geometry_pbf = feature.message();
if (geometry_pbf) {
bucket->addGeometry(geometry_pbf);
} else if (debug::tileParseWarnings) {
fprintf(stderr, "[WARNING] geometry is empty\n");
}
}
}

View File

@@ -9,6 +9,7 @@
#include <llmr/map/vector_tile.hpp>
#include <llmr/platform/gl.hpp>
#include <llmr/util/constants.hpp>
#include <cassert>
@@ -29,7 +30,9 @@ void IconBucket::addFeature(const VectorTileFeature &feature, SpriteAtlas &sprit
if (geometry.field.size()) {
auto field_it = feature.properties.find(geometry.field);
if (field_it == feature.properties.end()) {
fprintf(stderr, "feature doesn't contain field '%s'\n", geometry.field.c_str());
if (debug::tileParseWarnings) {
fprintf(stderr, "[WARNING] feature doesn't contain field '%s'\n", geometry.field.c_str());
}
return;
}
@@ -50,7 +53,9 @@ void IconBucket::addFeature(const VectorTileFeature &feature, SpriteAtlas &sprit
if (cmd == Geometry::move_to) {
vertexBuffer.add(x, y, tx, ty);
} else {
fprintf(stderr, "other command than move_to in icon geometry\n");
if (debug::tileParseWarnings) {
fprintf(stderr, "[WARNING] other command than move_to in icon geometry\n");
}
}
}

View File

@@ -2,6 +2,7 @@
const float llmr::util::tileSize = 512.0f;
const bool llmr::debug::tileParseWarnings = true;
const bool llmr::debug::styleParseWarnings = true;
const bool llmr::debug::renderWarnings = true;
const bool llmr::debug::renderTree = false;