mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 15:30:04 +00:00 
			
		
		
		
	Support placefile icon modulate with "scwx-ModulateIcon:" statement
This commit is contained in:
		
							parent
							
								
									1a9e87ba07
								
							
						
					
					
						commit
						2f41993d7b
					
				
					 3 changed files with 34 additions and 17 deletions
				
			
		|  | @ -68,9 +68,10 @@ public: | |||
|    std::chrono::seconds refresh_ {-1}; | ||||
| 
 | ||||
|    // Parsing state
 | ||||
|    units::length::nautical_miles<double>       threshold_ {999.0_nmi}; | ||||
|    boost::gil::rgba8_pixel_t                   color_ {255, 255, 255, 255}; | ||||
|    ColorMode                                   colorMode_ {ColorMode::RGBA}; | ||||
|    units::length::nautical_miles<double> 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<std::chrono::seconds> startTime_ {}; | ||||
|    std::chrono::sys_time<std::chrono::seconds> 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<std::string> 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); | ||||
|    } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat