diff --git a/scwx-qt/source/scwx/qt/gl/draw/placefile_icons.cpp b/scwx-qt/source/scwx/qt/gl/draw/placefile_icons.cpp index 7c29a771..784aa6b0 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/placefile_icons.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/placefile_icons.cpp @@ -488,11 +488,11 @@ void PlacefileIcons::Impl::UpdateBuffers() units::angle::degrees angle = di->angle_; const float a = angle.value(); - // Fixed modulate color - const float mc0 = 1.0f; - const float mc1 = 1.0f; - const float mc2 = 1.0f; - const float mc3 = 1.0f; + // Modulate color + const float mc0 = di->modulate_[0] / 255.0f; + const float mc1 = di->modulate_[1] / 255.0f; + const float mc2 = di->modulate_[2] / 255.0f; + const float mc3 = di->modulate_[3] / 255.0f; newIconBuffer_.insert(newIconBuffer_.end(), { diff --git a/wxdata/include/scwx/gr/placefile.hpp b/wxdata/include/scwx/gr/placefile.hpp index 671af535..017cc112 100644 --- a/wxdata/include/scwx/gr/placefile.hpp +++ b/wxdata/include/scwx/gr/placefile.hpp @@ -81,14 +81,15 @@ public: { IconDrawItem() { itemType_ = ItemType::Icon; } - double latitude_ {}; - double longitude_ {}; - double x_ {}; - double y_ {}; - units::degrees angle_ {}; - std::size_t fileNumber_ {0u}; - std::size_t iconNumber_ {0u}; - std::string hoverText_ {}; + boost::gil::rgba8_pixel_t modulate_ {}; + double latitude_ {}; + double longitude_ {}; + double x_ {}; + double y_ {}; + units::degrees angle_ {}; + std::size_t fileNumber_ {0u}; + std::size_t iconNumber_ {0u}; + std::string hoverText_ {}; }; struct TextDrawItem : DrawItem diff --git a/wxdata/source/scwx/gr/placefile.cpp b/wxdata/source/scwx/gr/placefile.cpp index b92fe1b2..a7584fc3 100644 --- a/wxdata/source/scwx/gr/placefile.cpp +++ b/wxdata/source/scwx/gr/placefile.cpp @@ -68,9 +68,10 @@ public: std::chrono::seconds refresh_ {-1}; // Parsing state - units::length::nautical_miles threshold_ {999.0_nmi}; - boost::gil::rgba8_pixel_t color_ {255, 255, 255, 255}; - ColorMode colorMode_ {ColorMode::RGBA}; + units::length::nautical_miles threshold_ {999.0_nmi}; + boost::gil::rgba8_pixel_t color_ {255, 255, 255, 255}; + boost::gil::rgba8_pixel_t iconModulate_ {255, 255, 255, 255}; + ColorMode colorMode_ {ColorMode::RGBA}; std::chrono::sys_time startTime_ {}; std::chrono::sys_time endTime_ {}; @@ -242,6 +243,8 @@ void Placefile::Impl::ProcessLine(const std::string& line) static const std::string imageKey_ {"Image:"}; static const std::string polygonKey_ {"Polygon:"}; + static const std::string scwxModulateIconKey_ {"scwx-ModulateIcon:"}; + currentStatement_ = DrawingStatement::Standard; // When tokenizing, add one additional delimiter to discard unexpected @@ -338,6 +341,18 @@ void Placefile::Impl::ProcessLine(const std::string& line) color_ = ParseColor(tokenList, 0, colorMode_); } } + else if (boost::istarts_with(line, scwxModulateIconKey_)) + { + // Supercell Wx Extension + // scwx-ModulateIcon: red green blue [alpha] + std::vector tokenList = util::ParseTokens( + line, {" ", " ", " ", " "}, scwxModulateIconKey_.size()); + + if (tokenList.size() >= 3) + { + iconModulate_ = ParseColor(tokenList, 0, colorMode_); + } + } else if (boost::istarts_with(line, refreshKey_)) { // Refresh: minutes @@ -433,6 +448,7 @@ void Placefile::Impl::ProcessLine(const std::string& line) di->threshold_ = threshold_; di->startTime_ = startTime_; di->endTime_ = endTime_; + di->modulate_ = iconModulate_; ParseLocation(tokenList[0], tokenList[1], @@ -686,7 +702,7 @@ void Placefile::Impl::ProcessLine(const std::string& line) } else { - logger_->warn("Unknown statement: {}", line); + logger_->trace("Unknown statement: {}", line); } }