mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 02:30:05 +00:00 
			
		
		
		
	Add location marker icon and color rendering on the map.
This commit is contained in:
		
							parent
							
								
									6da34fc151
								
							
						
					
					
						commit
						1a32748b8e
					
				
					 2 changed files with 11 additions and 9 deletions
				
			
		|  | @ -31,9 +31,6 @@ static const std::string kLongitudeName_ = "longitude"; | |||
| static const std::string kIconName_      = "icon"; | ||||
| static const std::string kIconColorName_ = "icon-color"; | ||||
| 
 | ||||
| static const std::string defaultIconName = types::getMarkerIcons()[0].name; | ||||
| static const boost::gil::rgba8_pixel_t defaultIconColor = | ||||
|    util::color::ToRgba8PixelT("#ffff0000"); | ||||
| 
 | ||||
| class MarkerManager::Impl | ||||
| { | ||||
|  | @ -94,6 +91,9 @@ public: | |||
|    friend MarkerRecord tag_invoke(boost::json::value_to_tag<MarkerRecord>, | ||||
|                                   const boost::json::value& jv) | ||||
|    { | ||||
|       static const std::string defaultIconName = types::getMarkerIcons()[0].name; | ||||
|       static const boost::gil::rgba8_pixel_t defaultIconColor = | ||||
|          util::color::ToRgba8PixelT("#ffff0000"); | ||||
| 
 | ||||
|       const boost::json::object& jo = jv.as_object(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -2,7 +2,6 @@ | |||
| #include <scwx/qt/manager/marker_manager.hpp> | ||||
| #include <scwx/util/logger.hpp> | ||||
| #include <scwx/qt/types/marker_types.hpp> | ||||
| #include <scwx/qt/types/texture_types.hpp> | ||||
| #include <scwx/qt/gl/draw/geo_icons.hpp> | ||||
| 
 | ||||
| namespace scwx | ||||
|  | @ -29,8 +28,6 @@ public: | |||
|    void ConnectSignals(); | ||||
| 
 | ||||
|    MarkerLayer* self_; | ||||
|    const std::string& markerIconName_ { | ||||
|       types::GetTextureName(types::ImageTexture::LocationMarker)}; | ||||
| 
 | ||||
|    std::shared_ptr<gl::draw::GeoIcons> geoIcons_; | ||||
| }; | ||||
|  | @ -59,9 +56,10 @@ void MarkerLayer::Impl::ReloadMarkers() | |||
|       [this](const types::MarkerInfo& marker) | ||||
|       { | ||||
|          std::shared_ptr<gl::draw::GeoIconDrawItem> icon = geoIcons_->AddIcon(); | ||||
|          geoIcons_->SetIconTexture(icon, markerIconName_, 0); | ||||
|          geoIcons_->SetIconTexture(icon, marker.iconName, 0); | ||||
|          geoIcons_->SetIconLocation(icon, marker.latitude, marker.longitude); | ||||
|          geoIcons_->SetIconHoverText(icon, marker.name); | ||||
|          geoIcons_->SetIconModulate(icon, marker.iconColor); | ||||
|       }); | ||||
| 
 | ||||
|    geoIcons_->FinishIcons(); | ||||
|  | @ -82,7 +80,11 @@ void MarkerLayer::Initialize() | |||
|    DrawLayer::Initialize(); | ||||
| 
 | ||||
|    p->geoIcons_->StartIconSheets(); | ||||
|    p->geoIcons_->AddIconSheet(p->markerIconName_); | ||||
|    for (auto& markerIcon : types::getMarkerIcons()) | ||||
|    { | ||||
|       p->geoIcons_->AddIconSheet( | ||||
|          markerIcon.name, 0, 0, markerIcon.hotX, markerIcon.hotY); | ||||
|    } | ||||
|    p->geoIcons_->FinishIconSheets(); | ||||
| 
 | ||||
|    p->ReloadMarkers(); | ||||
|  | @ -90,8 +92,8 @@ void MarkerLayer::Initialize() | |||
| 
 | ||||
| void MarkerLayer::Render(const QMapLibre::CustomLayerRenderParameters& params) | ||||
| { | ||||
|    // auto markerManager = manager::MarkerManager::Instance();
 | ||||
|    gl::OpenGLFunctions& gl = context()->gl(); | ||||
|    context()->set_render_parameters(params); | ||||
| 
 | ||||
|    DrawLayer::Render(params); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 AdenKoperczak
						AdenKoperczak