Revert "[core] Do not clear custom layers upon style switch"

This reverts commit 8ec875b87c.
This commit is contained in:
Bruno de Oliveira Abinader
2016-04-21 20:15:18 +03:00
parent 3ee9d12013
commit 4e04a107e8
2 changed files with 1 additions and 7 deletions

View File

@@ -70,9 +70,7 @@ Style::Style(FileSource& fileSource_, float pixelRatio)
void Style::setJSON(const std::string& json, const std::string&) {
sources.clear();
layers.erase(std::remove_if(layers.begin(), layers.end(), [](const auto& layer) {
return !layer->template is<CustomLayer>();
}), layers.end());
layers.clear();
classes.clear();
StyleParser parser;

View File

@@ -90,8 +90,4 @@ TEST(CustomLayer, Basic) {
}, new TestLayer());
test::checkImage("test/fixtures/custom_layer/basic", test::render(map));
// Custom layer should be preserved when switching styles
map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"), "");
test::checkImage("test/fixtures/custom_layer/basic", test::render(map));
}