don't require the background layer to be named "background"

This commit is contained in:
Konstantin Käfer
2014-08-05 11:58:16 +02:00
parent 17617a54bd
commit b402d03837
3 changed files with 3 additions and 3 deletions

View File

@@ -646,7 +646,7 @@ void Map::renderLayer(std::shared_ptr<StyleLayer> layer_desc, RenderPass pass) {
}
}
}
} else if (layer_desc->id == "background") {
} else if (layer_desc->type == StyleLayerType::Background) {
// This layer defines the background color.
} else {
// This is a singular layer.

View File

@@ -98,7 +98,7 @@ void Style::loadJSON(const uint8_t *const data) {
const BackgroundProperties &Style::getBackgroundProperties() const {
if (layers && layers->layers.size()) {
const auto first = layers->layers.front();
if (first && first->id == "background") {
if (first && first->type == StyleLayerType::Background) {
return first->getProperties<BackgroundProperties>();
}
}

View File

@@ -10,7 +10,7 @@ StyleLayer::StyleLayer(const std::string &id, std::map<ClassID, ClassProperties>
: id(id), styles(std::move(styles)), rasterize(std::move(rasterize)) {}
bool StyleLayer::isBackground() const {
return type == StyleLayerType::Background && id == "background";
return type == StyleLayerType::Background;
}
void StyleLayer::setClasses(const std::vector<std::string> &class_names, const timestamp now,