mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 04:10:06 +00:00 
			
		
		
		
	Migrating mapbox-gl-native to maplibre-gl-native
This commit is contained in:
		
							parent
							
								
									d734bc6a0a
								
							
						
					
					
						commit
						7e98227c70
					
				
					 5 changed files with 25 additions and 6 deletions
				
			
		|  | @ -16,6 +16,20 @@ namespace scwx | |||
| namespace qt | ||||
| { | ||||
| 
 | ||||
| typedef std::pair<std::string, std::string> MapStyle; | ||||
| 
 | ||||
| // clang-format off
 | ||||
| static const MapStyle streets          { "mapbox://styles/mapbox/streets-v11",           "Streets"}; | ||||
| static const MapStyle outdoors         { "mapbox://styles/mapbox/outdoors-v11",          "Outdoors"}; | ||||
| static const MapStyle light            { "mapbox://styles/mapbox/light-v10",             "Light"}; | ||||
| static const MapStyle dark             { "mapbox://styles/mapbox/dark-v10",              "Dark" }; | ||||
| static const MapStyle satellite        { "mapbox://styles/mapbox/satellite-v9",          "Satellite" }; | ||||
| static const MapStyle satelliteStreets { "mapbox://styles/mapbox/satellite-streets-v11", "Satellite Streets" }; | ||||
| // clang-format on
 | ||||
| 
 | ||||
| static const std::array<MapStyle, 6> mapboxStyles_ = { | ||||
|    {streets, outdoors, light, dark, satellite, satelliteStreets}}; | ||||
| 
 | ||||
| MapWidget::MapWidget(const QMapboxGLSettings& settings) : settings_(settings) | ||||
| { | ||||
|    setFocusPolicy(Qt::StrongFocus); | ||||
|  | @ -35,12 +49,13 @@ qreal MapWidget::pixelRatio() | |||
| 
 | ||||
| void MapWidget::changeStyle() | ||||
| { | ||||
|    static uint8_t currentStyleIndex; | ||||
|    static uint8_t currentStyleIndex = 0; | ||||
| 
 | ||||
|    auto& styles = QMapbox::defaultStyles(); | ||||
|    auto& styles = mapboxStyles_; | ||||
| 
 | ||||
|    map_->setStyleUrl(styles[currentStyleIndex].first); | ||||
|    setWindowTitle(QString("Mapbox GL: ") + styles[currentStyleIndex].second); | ||||
|    map_->setStyleUrl(styles[currentStyleIndex].first.c_str()); | ||||
|    setWindowTitle(QString("Mapbox GL: ") + | ||||
|                   styles[currentStyleIndex].second.c_str()); | ||||
| 
 | ||||
|    if (++currentStyleIndex == styles.size()) | ||||
|    { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat