mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 07:20:04 +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
 | // Draw below tunnels, ferries and roads
 | ||||||
| static const std::vector<std::string> mapboxDrawBelow_ { | static const std::vector<std::string> mapboxDrawBelow_ { | ||||||
|    "tunnel", "ferry", "road"}; |    "tunnel.*", "ferry.*", "road.*"}; | ||||||
| static const std::vector<std::string> maptilerDrawBelow_ { |  | ||||||
|    "tunnel", "ferry", "road"}; |  | ||||||
| 
 | 
 | ||||||
| static const std::unordered_map<MapProvider, MapProviderInfo> mapProviderInfo_ { | static const std::unordered_map<MapProvider, MapProviderInfo> mapProviderInfo_ { | ||||||
|    {MapProvider::Mapbox, |    {MapProvider::Mapbox, | ||||||
|  | @ -56,25 +54,25 @@ static const std::unordered_map<MapProvider, MapProviderInfo> mapProviderInfo_ { | ||||||
|           QMapLibreGL::Settings::SettingsTemplate::MapTilerSettings}, |           QMapLibreGL::Settings::SettingsTemplate::MapTilerSettings}, | ||||||
|        .mapStyles_ {{.name_ {"Satellite"}, |        .mapStyles_ {{.name_ {"Satellite"}, | ||||||
|                      .url_ {"maptiler://maps/hybrid"}, |                      .url_ {"maptiler://maps/hybrid"}, | ||||||
|                      .drawBelow_ {maptilerDrawBelow_}}, |                      .drawBelow_ {"tunnel"}}, | ||||||
|                     {.name_ {"Streets"}, |                     {.name_ {"Streets"}, | ||||||
|                      .url_ {"maptiler://maps/streets-v2"}, |                      .url_ {"maptiler://maps/streets-v2"}, | ||||||
|                      .drawBelow_ {maptilerDrawBelow_}}, |                      .drawBelow_ {"aeroway"}}, | ||||||
|                     {.name_ {"Basic"}, |                     {.name_ {"Basic"}, | ||||||
|                      .url_ {"maptiler://maps/basic-v2"}, |                      .url_ {"maptiler://maps/basic-v2"}, | ||||||
|                      .drawBelow_ {maptilerDrawBelow_}}, |                      .drawBelow_ {"railway_transit_tunnel"}}, | ||||||
|                     {.name_ {"Bright"}, |                     {.name_ {"Bright"}, | ||||||
|                      .url_ {"maptiler://maps/bright-v2"}, |                      .url_ {"maptiler://maps/bright-v2"}, | ||||||
|                      .drawBelow_ {maptilerDrawBelow_}}, |                      .drawBelow_ {"ferry"}}, | ||||||
|                     {.name_ {"Outdoor"}, |                     {.name_ {"Outdoor"}, | ||||||
|                      .url_ {"maptiler://maps/outdoor-v2"}, |                      .url_ {"maptiler://maps/outdoor-v2"}, | ||||||
|                      .drawBelow_ {maptilerDrawBelow_}}, |                      .drawBelow_ {"aeroway_runway"}}, | ||||||
|                     {.name_ {"Topo"}, |                     {.name_ {"Topo"}, | ||||||
|                      .url_ {"maptiler://maps/topo-v2"}, |                      .url_ {"maptiler://maps/topo-v2"}, | ||||||
|                      .drawBelow_ {maptilerDrawBelow_}}, |                      .drawBelow_ {"aeroway_runway"}}, | ||||||
|                     {.name_ {"Winter"}, |                     {.name_ {"Winter"}, | ||||||
|                      .url_ {"maptiler://maps/winter-v2"}, |                      .url_ {"maptiler://maps/winter-v2"}, | ||||||
|                      .drawBelow_ {maptilerDrawBelow_}}}}}, |                      .drawBelow_ {"aeroway_runway"}}}}}, | ||||||
|    {MapProvider::Unknown, MapProviderInfo {}}}; |    {MapProvider::Unknown, MapProviderInfo {}}}; | ||||||
| 
 | 
 | ||||||
| MapProvider GetMapProvider(const std::string& name) | MapProvider GetMapProvider(const std::string& name) | ||||||
|  |  | ||||||
|  | @ -16,6 +16,8 @@ | ||||||
| #include <scwx/util/threads.hpp> | #include <scwx/util/threads.hpp> | ||||||
| #include <scwx/util/time.hpp> | #include <scwx/util/time.hpp> | ||||||
| 
 | 
 | ||||||
|  | #include <regex> | ||||||
|  | 
 | ||||||
| #include <backends/imgui_impl_opengl3.h> | #include <backends/imgui_impl_opengl3.h> | ||||||
| #include <backends/imgui_impl_qt.hpp> | #include <backends/imgui_impl_qt.hpp> | ||||||
| #include <boost/uuid/random_generator.hpp> | #include <boost/uuid/random_generator.hpp> | ||||||
|  | @ -619,18 +621,22 @@ void MapWidget::AddLayers() | ||||||
| 
 | 
 | ||||||
|       std::string before = "ferry"; |       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
 |          // Draw below layers defined in map style
 | ||||||
|          auto it = std::find_if( |          auto it = std::find_if(mapStyle.drawBelow_.cbegin(), | ||||||
|             mapStyle.drawBelow_.cbegin(), |                                 mapStyle.drawBelow_.cend(), | ||||||
|             mapStyle.drawBelow_.cend(), |                                 [&layer](const std::string& styleLayer) -> bool | ||||||
|             [&layer](const std::string& styleLayer) -> bool |                                 { | ||||||
|             { return layer.startsWith(QString::fromStdString(styleLayer)); }); |                                    std::regex re {styleLayer}; | ||||||
|  |                                    return std::regex_match(layer, re); | ||||||
|  |                                 }); | ||||||
| 
 | 
 | ||||||
|          if (it != mapStyle.drawBelow_.cend()) |          if (it != mapStyle.drawBelow_.cend()) | ||||||
|          { |          { | ||||||
|             before = layer.toStdString(); |             before = layer; | ||||||
|             break; |             break; | ||||||
|          } |          } | ||||||
|       } |       } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat