mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 20:20:06 +00:00
Update MapTiler layer ordering
This commit is contained in:
parent
c77c899040
commit
98ab8904be
2 changed files with 21 additions and 17 deletions
|
|
@ -19,9 +19,7 @@ static const std::unordered_map<MapProvider, std::string> mapProviderName_ {
|
|||
|
||||
// Draw below tunnels, ferries and roads
|
||||
static const std::vector<std::string> mapboxDrawBelow_ {
|
||||
"tunnel", "ferry", "road"};
|
||||
static const std::vector<std::string> maptilerDrawBelow_ {
|
||||
"tunnel", "ferry", "road"};
|
||||
"tunnel.*", "ferry.*", "road.*"};
|
||||
|
||||
static const std::unordered_map<MapProvider, MapProviderInfo> mapProviderInfo_ {
|
||||
{MapProvider::Mapbox,
|
||||
|
|
@ -56,25 +54,25 @@ static const std::unordered_map<MapProvider, MapProviderInfo> mapProviderInfo_ {
|
|||
QMapLibreGL::Settings::SettingsTemplate::MapTilerSettings},
|
||||
.mapStyles_ {{.name_ {"Satellite"},
|
||||
.url_ {"maptiler://maps/hybrid"},
|
||||
.drawBelow_ {maptilerDrawBelow_}},
|
||||
.drawBelow_ {"tunnel"}},
|
||||
{.name_ {"Streets"},
|
||||
.url_ {"maptiler://maps/streets-v2"},
|
||||
.drawBelow_ {maptilerDrawBelow_}},
|
||||
.drawBelow_ {"aeroway"}},
|
||||
{.name_ {"Basic"},
|
||||
.url_ {"maptiler://maps/basic-v2"},
|
||||
.drawBelow_ {maptilerDrawBelow_}},
|
||||
.drawBelow_ {"railway_transit_tunnel"}},
|
||||
{.name_ {"Bright"},
|
||||
.url_ {"maptiler://maps/bright-v2"},
|
||||
.drawBelow_ {maptilerDrawBelow_}},
|
||||
.drawBelow_ {"ferry"}},
|
||||
{.name_ {"Outdoor"},
|
||||
.url_ {"maptiler://maps/outdoor-v2"},
|
||||
.drawBelow_ {maptilerDrawBelow_}},
|
||||
.drawBelow_ {"aeroway_runway"}},
|
||||
{.name_ {"Topo"},
|
||||
.url_ {"maptiler://maps/topo-v2"},
|
||||
.drawBelow_ {maptilerDrawBelow_}},
|
||||
.drawBelow_ {"aeroway_runway"}},
|
||||
{.name_ {"Winter"},
|
||||
.url_ {"maptiler://maps/winter-v2"},
|
||||
.drawBelow_ {maptilerDrawBelow_}}}}},
|
||||
.drawBelow_ {"aeroway_runway"}}}}},
|
||||
{MapProvider::Unknown, MapProviderInfo {}}};
|
||||
|
||||
MapProvider GetMapProvider(const std::string& name)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
#include <scwx/util/threads.hpp>
|
||||
#include <scwx/util/time.hpp>
|
||||
|
||||
#include <regex>
|
||||
|
||||
#include <backends/imgui_impl_opengl3.h>
|
||||
#include <backends/imgui_impl_qt.hpp>
|
||||
#include <boost/uuid/random_generator.hpp>
|
||||
|
|
@ -619,18 +621,22 @@ void MapWidget::AddLayers()
|
|||
|
||||
std::string before = "ferry";
|
||||
|
||||
for (const QString& layer : p->map_->layerIds())
|
||||
for (const QString& qlayer : p->map_->layerIds())
|
||||
{
|
||||
const std::string layer = qlayer.toStdString();
|
||||
|
||||
// Draw below layers defined in map style
|
||||
auto it = std::find_if(
|
||||
mapStyle.drawBelow_.cbegin(),
|
||||
mapStyle.drawBelow_.cend(),
|
||||
[&layer](const std::string& styleLayer) -> bool
|
||||
{ return layer.startsWith(QString::fromStdString(styleLayer)); });
|
||||
auto it = std::find_if(mapStyle.drawBelow_.cbegin(),
|
||||
mapStyle.drawBelow_.cend(),
|
||||
[&layer](const std::string& styleLayer) -> bool
|
||||
{
|
||||
std::regex re {styleLayer};
|
||||
return std::regex_match(layer, re);
|
||||
});
|
||||
|
||||
if (it != mapStyle.drawBelow_.cend())
|
||||
{
|
||||
before = layer.toStdString();
|
||||
before = layer;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue