mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 01:20:06 +00:00 
			
		
		
		
	Geo icons updates for rendering
This commit is contained in:
		
							parent
							
								
									18f500fe5f
								
							
						
					
					
						commit
						ad4c402404
					
				
					 2 changed files with 64 additions and 41 deletions
				
			
		|  | @ -70,8 +70,7 @@ struct GeoIconDrawItem | |||
|    std::chrono::sys_time<std::chrono::seconds> startTime_ {}; | ||||
|    std::chrono::sys_time<std::chrono::seconds> endTime_ {}; | ||||
| 
 | ||||
|    bool                      visible_ {}; | ||||
|    boost::gil::rgba8_pixel_t modulate_ {}; | ||||
|    boost::gil::rgba8_pixel_t modulate_ {255, 255, 255, 255}; | ||||
|    double                    latitude_ {}; | ||||
|    double                    longitude_ {}; | ||||
|    double                    x_ {}; | ||||
|  | @ -118,6 +117,7 @@ public: | |||
| 
 | ||||
|    std::shared_ptr<GlContext> context_; | ||||
| 
 | ||||
|    bool visible_ {true}; | ||||
|    bool dirty_ {false}; | ||||
|    bool thresholded_ {false}; | ||||
| 
 | ||||
|  | @ -273,6 +273,11 @@ void GeoIcons::Initialize() | |||
| void GeoIcons::Render(const QMapLibreGL::CustomLayerRenderParameters& params, | ||||
|                       bool textureAtlasChanged) | ||||
| { | ||||
|    if (!p->visible_) | ||||
|    { | ||||
|       return; | ||||
|    } | ||||
| 
 | ||||
|    std::unique_lock lock {p->iconMutex_}; | ||||
| 
 | ||||
|    if (!p->currentIconList_.empty()) | ||||
|  | @ -380,6 +385,11 @@ void IconInfo::UpdateTextureInfo() | |||
|    scaledHeight_ = iconHeight_ * yFactor; | ||||
| } | ||||
| 
 | ||||
| void GeoIcons::SetVisible(bool visible) | ||||
| { | ||||
|    p->visible_ = visible; | ||||
| } | ||||
| 
 | ||||
| void GeoIcons::StartIconSheets() | ||||
| { | ||||
|    // Clear the new buffer
 | ||||
|  | @ -454,6 +464,18 @@ void GeoIcons::SetIconLocation(const std::shared_ptr<GeoIconDrawItem>& di, | |||
|    di->y_         = yOffset; | ||||
| } | ||||
| 
 | ||||
| void GeoIcons::SetIconLocation(const std::shared_ptr<GeoIconDrawItem>& di, | ||||
|                                double                                  latitude, | ||||
|                                double longitude, | ||||
|                                double xOffset, | ||||
|                                double yOffset) | ||||
| { | ||||
|    di->latitude_  = latitude; | ||||
|    di->longitude_ = longitude; | ||||
|    di->x_         = xOffset; | ||||
|    di->y_         = yOffset; | ||||
| } | ||||
| 
 | ||||
| void GeoIcons::SetIconAngle(const std::shared_ptr<GeoIconDrawItem>& di, | ||||
|                             units::angle::degrees<double>           angle) | ||||
| { | ||||
|  | @ -472,12 +494,6 @@ void GeoIcons::SetIconHoverText(const std::shared_ptr<GeoIconDrawItem>& di, | |||
|    di->hoverText_ = text; | ||||
| } | ||||
| 
 | ||||
| void GeoIcons::SetIconVisible(const std::shared_ptr<GeoIconDrawItem>& di, | ||||
|                               bool                                    visible) | ||||
| { | ||||
|    di->visible_ = visible; | ||||
| } | ||||
| 
 | ||||
| void GeoIcons::FinishIcons() | ||||
| { | ||||
|    // Update buffers
 | ||||
|  | @ -512,12 +528,6 @@ void GeoIcons::Impl::UpdateBuffers() | |||
| 
 | ||||
|    for (auto& di : newIconList_) | ||||
|    { | ||||
|       // Skip hidden icons
 | ||||
|       if (!di->visible_) | ||||
|       { | ||||
|          continue; | ||||
|       } | ||||
| 
 | ||||
|       auto it = currentIconSheets_.find(di->iconSheet_); | ||||
|       if (it == currentIconSheets_.cend()) | ||||
|       { | ||||
|  |  | |||
|  | @ -42,6 +42,13 @@ public: | |||
|                         const QPointF&   mouseGlobalPos, | ||||
|                         const glm::vec2& mouseCoords) override; | ||||
| 
 | ||||
|    /**
 | ||||
|     * Sets the visibility of the geo icons. | ||||
|     * | ||||
|     * @param [in] visible Icon visibility | ||||
|     */ | ||||
|    void SetVisible(bool visible); | ||||
| 
 | ||||
|    /**
 | ||||
|     * Resets and prepares the draw item for adding a new set of icon sheets. | ||||
|     */ | ||||
|  | @ -91,24 +98,39 @@ public: | |||
|     * @param [in] iconSheet The name of the icon sheet in the texture atlas | ||||
|     * @param [in] iconIndex The zero-based index of the icon in the icon sheet | ||||
|     */ | ||||
|    void SetIconTexture(const std::shared_ptr<GeoIconDrawItem>& di, | ||||
|                        const std::string&                      iconSheet, | ||||
|                        std::size_t                             iconIndex); | ||||
|    static void SetIconTexture(const std::shared_ptr<GeoIconDrawItem>& di, | ||||
|                               const std::string&                      iconSheet, | ||||
|                               std::size_t iconIndex); | ||||
| 
 | ||||
|    /**
 | ||||
|     * Sets the location of a geo icon. | ||||
|     * | ||||
|     * @param [in] di Geo icon draw item | ||||
|     * @param [in] latitude The latitude of the geo icon. | ||||
|     * @param [in] longitude The longitude of the geo icon. | ||||
|     * @param [in] xOffset The x-offset of the geo icon. Default is 0. | ||||
|     * @param [in] yOffset The y-offset of the geo icon. Default is 0. | ||||
|     * @param [in] latitude The latitude of the geo icon in degrees. | ||||
|     * @param [in] longitude The longitude of the geo icon in degrees. | ||||
|     * @param [in] xOffset The x-offset of the geo icon in pixels. Default is 0. | ||||
|     * @param [in] yOffset The y-offset of the geo icon in pixels. Default is 0. | ||||
|     */ | ||||
|    void SetIconLocation(const std::shared_ptr<GeoIconDrawItem>& di, | ||||
|                         units::angle::degrees<double>           latitude, | ||||
|                         units::angle::degrees<double>           longitude, | ||||
|                         double                                  xOffset = 0.0, | ||||
|                         double                                  yOffset = 0.0); | ||||
|    static void SetIconLocation(const std::shared_ptr<GeoIconDrawItem>& di, | ||||
|                                units::angle::degrees<double>           latitude, | ||||
|                                units::angle::degrees<double> longitude, | ||||
|                                double                        xOffset = 0.0, | ||||
|                                double                        yOffset = 0.0); | ||||
| 
 | ||||
|    /**
 | ||||
|     * Sets the location of a geo icon. | ||||
|     * | ||||
|     * @param [in] di Geo icon draw item | ||||
|     * @param [in] latitude The latitude of the geo icon in degrees. | ||||
|     * @param [in] longitude The longitude of the geo icon in degrees. | ||||
|     * @param [in] xOffset The x-offset of the geo icon in pixels. Default is 0. | ||||
|     * @param [in] yOffset The y-offset of the geo icon in pixels. Default is 0. | ||||
|     */ | ||||
|    static void SetIconLocation(const std::shared_ptr<GeoIconDrawItem>& di, | ||||
|                                double                                  latitude, | ||||
|                                double longitude, | ||||
|                                double xOffset = 0.0, | ||||
|                                double yOffset = 0.0); | ||||
| 
 | ||||
|    /**
 | ||||
|     * Sets the angle of a geo icon. | ||||
|  | @ -116,8 +138,8 @@ public: | |||
|     * @param [in] di Geo icon draw item | ||||
|     * @param [in] angle Angle in degrees | ||||
|     */ | ||||
|    void SetIconAngle(const std::shared_ptr<GeoIconDrawItem>& di, | ||||
|                      units::angle::degrees<double>           angle); | ||||
|    static void SetIconAngle(const std::shared_ptr<GeoIconDrawItem>& di, | ||||
|                             units::angle::degrees<double>           angle); | ||||
| 
 | ||||
|    /**
 | ||||
|     * Sets the modulate color of a geo icon. | ||||
|  | @ -125,8 +147,8 @@ public: | |||
|     * @param [in] di Geo icon draw item | ||||
|     * @param [in] modulate Modulate color | ||||
|     */ | ||||
|    void SetIconModulate(const std::shared_ptr<GeoIconDrawItem>& di, | ||||
|                         boost::gil::rgba8_pixel_t               modulate); | ||||
|    static void SetIconModulate(const std::shared_ptr<GeoIconDrawItem>& di, | ||||
|                                boost::gil::rgba8_pixel_t modulate); | ||||
| 
 | ||||
|    /**
 | ||||
|     * Sets the hover text of a geo icon. | ||||
|  | @ -134,17 +156,8 @@ public: | |||
|     * @param [in] di Geo icon draw item | ||||
|     * @param [in] text Hover text | ||||
|     */ | ||||
|    void SetIconHoverText(const std::shared_ptr<GeoIconDrawItem>& di, | ||||
|                          const std::string&                      text); | ||||
| 
 | ||||
|    /**
 | ||||
|     * Sets the visibility of a geo icon. | ||||
|     * | ||||
|     * @param [in] di Geo icon draw item | ||||
|     * @param [in] visible Icon visibility | ||||
|     */ | ||||
|    void SetIconVisible(const std::shared_ptr<GeoIconDrawItem>& di, | ||||
|                        bool                                    visible); | ||||
|    static void SetIconHoverText(const std::shared_ptr<GeoIconDrawItem>& di, | ||||
|                                 const std::string&                      text); | ||||
| 
 | ||||
|    /**
 | ||||
|     * Finalizes the draw item after adding new icons. | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat