diff --git a/include/llmr/util/constants.hpp b/include/llmr/util/constants.hpp index 9df24eb6b..2b8cc2da2 100644 --- a/include/llmr/util/constants.hpp +++ b/include/llmr/util/constants.hpp @@ -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; diff --git a/src/map/tile_parser.cpp b/src/map/tile_parser.cpp index d06ced268..1b1f36dd4 100644 --- a/src/map/tile_parser.cpp +++ b/src/map/tile_parser.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -77,7 +78,10 @@ void TileParser::parseStyleLayers(const std::vector& 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 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"); } } } diff --git a/src/renderer/icon_bucket.cpp b/src/renderer/icon_bucket.cpp index 76404f7f8..11999a608 100644 --- a/src/renderer/icon_bucket.cpp +++ b/src/renderer/icon_bucket.cpp @@ -9,6 +9,7 @@ #include #include +#include #include @@ -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"); + } } } diff --git a/src/util/constants.cpp b/src/util/constants.cpp index 4ed363709..f6282ab5e 100644 --- a/src/util/constants.cpp +++ b/src/util/constants.cpp @@ -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;