mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 16:40:04 +00:00 
			
		
		
		
	Add types for audio alerts
This commit is contained in:
		
							parent
							
								
									e1ccc1ebb8
								
							
						
					
					
						commit
						9486d2364a
					
				
					 7 changed files with 97 additions and 1 deletions
				
			
		|  | @ -172,6 +172,7 @@ set(HDR_TYPES source/scwx/qt/types/alert_types.hpp | ||||||
|               source/scwx/qt/types/github_types.hpp |               source/scwx/qt/types/github_types.hpp | ||||||
|               source/scwx/qt/types/imgui_font.hpp |               source/scwx/qt/types/imgui_font.hpp | ||||||
|               source/scwx/qt/types/layer_types.hpp |               source/scwx/qt/types/layer_types.hpp | ||||||
|  |               source/scwx/qt/types/location_types.hpp | ||||||
|               source/scwx/qt/types/map_types.hpp |               source/scwx/qt/types/map_types.hpp | ||||||
|               source/scwx/qt/types/media_types.hpp |               source/scwx/qt/types/media_types.hpp | ||||||
|               source/scwx/qt/types/qt_types.hpp |               source/scwx/qt/types/qt_types.hpp | ||||||
|  | @ -183,6 +184,7 @@ set(SRC_TYPES source/scwx/qt/types/alert_types.cpp | ||||||
|               source/scwx/qt/types/github_types.cpp |               source/scwx/qt/types/github_types.cpp | ||||||
|               source/scwx/qt/types/imgui_font.cpp |               source/scwx/qt/types/imgui_font.cpp | ||||||
|               source/scwx/qt/types/layer_types.cpp |               source/scwx/qt/types/layer_types.cpp | ||||||
|  |               source/scwx/qt/types/location_types.cpp | ||||||
|               source/scwx/qt/types/map_types.cpp |               source/scwx/qt/types/map_types.cpp | ||||||
|               source/scwx/qt/types/media_types.cpp |               source/scwx/qt/types/media_types.cpp | ||||||
|               source/scwx/qt/types/qt_types.cpp |               source/scwx/qt/types/qt_types.cpp | ||||||
|  |  | ||||||
|  | @ -37,6 +37,17 @@ std::string GetAlertActionName(AlertAction alertAction) | ||||||
|    return alertActionName_.at(alertAction); |    return alertActionName_.at(alertAction); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | const std::vector<awips::Phenomenon>& GetAlertAudioPhenomena() | ||||||
|  | { | ||||||
|  |    static const std::vector<awips::Phenomenon> phenomena_ { | ||||||
|  |       awips::Phenomenon::FlashFlood, | ||||||
|  |       awips::Phenomenon::SevereThunderstorm, | ||||||
|  |       awips::Phenomenon::SnowSquall, | ||||||
|  |       awips::Phenomenon::Tornado}; | ||||||
|  | 
 | ||||||
|  |    return phenomena_; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| } // namespace types
 | } // namespace types
 | ||||||
| } // namespace qt
 | } // namespace qt
 | ||||||
| } // namespace scwx
 | } // namespace scwx
 | ||||||
|  |  | ||||||
|  | @ -1,8 +1,10 @@ | ||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
|  | #include <scwx/awips/phenomenon.hpp> | ||||||
| #include <scwx/util/iterator.hpp> | #include <scwx/util/iterator.hpp> | ||||||
| 
 | 
 | ||||||
| #include <string> | #include <string> | ||||||
|  | #include <vector> | ||||||
| 
 | 
 | ||||||
| namespace scwx | namespace scwx | ||||||
| { | { | ||||||
|  | @ -23,6 +25,8 @@ typedef scwx::util::Iterator<AlertAction, AlertAction::Go, AlertAction::View> | ||||||
| AlertAction GetAlertAction(const std::string& name); | AlertAction GetAlertAction(const std::string& name); | ||||||
| std::string GetAlertActionName(AlertAction alertAction); | std::string GetAlertActionName(AlertAction alertAction); | ||||||
| 
 | 
 | ||||||
|  | const std::vector<awips::Phenomenon>& GetAlertAudioPhenomena(); | ||||||
|  | 
 | ||||||
| } // namespace types
 | } // namespace types
 | ||||||
| } // namespace qt
 | } // namespace qt
 | ||||||
| } // namespace scwx
 | } // namespace scwx
 | ||||||
|  |  | ||||||
							
								
								
									
										29
									
								
								scwx-qt/source/scwx/qt/types/location_types.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								scwx-qt/source/scwx/qt/types/location_types.cpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,29 @@ | ||||||
|  | #include <scwx/qt/types/location_types.hpp> | ||||||
|  | #include <scwx/util/enum.hpp> | ||||||
|  | 
 | ||||||
|  | #include <unordered_map> | ||||||
|  | 
 | ||||||
|  | #include <boost/algorithm/string.hpp> | ||||||
|  | 
 | ||||||
|  | namespace scwx | ||||||
|  | { | ||||||
|  | namespace qt | ||||||
|  | { | ||||||
|  | namespace types | ||||||
|  | { | ||||||
|  | 
 | ||||||
|  | static const std::unordered_map<LocationMethod, std::string> | ||||||
|  |    locationMethodName_ {{LocationMethod::Fixed, "Fixed"}, | ||||||
|  |                         {LocationMethod::Track, "Track"}, | ||||||
|  |                         {LocationMethod::Unknown, "?"}}; | ||||||
|  | 
 | ||||||
|  | SCWX_GET_ENUM(LocationMethod, GetLocationMethod, locationMethodName_) | ||||||
|  | 
 | ||||||
|  | const std::string& GetLocationMethodName(LocationMethod locationMethod) | ||||||
|  | { | ||||||
|  |    return locationMethodName_.at(locationMethod); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | } // namespace types
 | ||||||
|  | } // namespace qt
 | ||||||
|  | } // namespace scwx
 | ||||||
							
								
								
									
										29
									
								
								scwx-qt/source/scwx/qt/types/location_types.hpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								scwx-qt/source/scwx/qt/types/location_types.hpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,29 @@ | ||||||
|  | #pragma once | ||||||
|  | 
 | ||||||
|  | #include <scwx/util/iterator.hpp> | ||||||
|  | 
 | ||||||
|  | #include <string> | ||||||
|  | 
 | ||||||
|  | namespace scwx | ||||||
|  | { | ||||||
|  | namespace qt | ||||||
|  | { | ||||||
|  | namespace types | ||||||
|  | { | ||||||
|  | 
 | ||||||
|  | enum class LocationMethod | ||||||
|  | { | ||||||
|  |    Fixed, | ||||||
|  |    Track, | ||||||
|  |    Unknown | ||||||
|  | }; | ||||||
|  | typedef scwx::util:: | ||||||
|  |    Iterator<LocationMethod, LocationMethod::Fixed, LocationMethod::Track> | ||||||
|  |       LocationMethodIterator; | ||||||
|  | 
 | ||||||
|  | LocationMethod     GetLocationMethod(const std::string& name); | ||||||
|  | const std::string& GetLocationMethodName(LocationMethod locationMethod); | ||||||
|  | 
 | ||||||
|  | } // namespace types
 | ||||||
|  | } // namespace qt
 | ||||||
|  | } // namespace scwx
 | ||||||
							
								
								
									
										20
									
								
								wxdata/include/scwx/util/enum.hpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								wxdata/include/scwx/util/enum.hpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,20 @@ | ||||||
|  | #pragma once | ||||||
|  | 
 | ||||||
|  | #define SCWX_GET_ENUM(Type, FunctionName, nameMap)                             \ | ||||||
|  |    Type FunctionName(const std::string& name)                                  \ | ||||||
|  |    {                                                                           \ | ||||||
|  |       auto result =                                                            \ | ||||||
|  |          std::find_if(nameMap.cbegin(),                                        \ | ||||||
|  |                       nameMap.cend(),                                          \ | ||||||
|  |                       [&](const std::pair<Type, std::string>& pair) -> bool    \ | ||||||
|  |                       { return boost::iequals(pair.second, name); });          \ | ||||||
|  |                                                                                \ | ||||||
|  |       if (result != nameMap.cend())                                            \ | ||||||
|  |       {                                                                        \ | ||||||
|  |          return result->first;                                                 \ | ||||||
|  |       }                                                                        \ | ||||||
|  |       else                                                                     \ | ||||||
|  |       {                                                                        \ | ||||||
|  |          return Type::Unknown;                                                 \ | ||||||
|  |       }                                                                        \ | ||||||
|  |    } | ||||||
|  | @ -66,7 +66,8 @@ set(SRC_PROVIDER source/scwx/provider/aws_level2_data_provider.cpp | ||||||
|                  source/scwx/provider/nexrad_data_provider.cpp |                  source/scwx/provider/nexrad_data_provider.cpp | ||||||
|                  source/scwx/provider/nexrad_data_provider_factory.cpp |                  source/scwx/provider/nexrad_data_provider_factory.cpp | ||||||
|                  source/scwx/provider/warnings_provider.cpp) |                  source/scwx/provider/warnings_provider.cpp) | ||||||
| set(HDR_UTIL include/scwx/util/environment.hpp | set(HDR_UTIL include/scwx/util/enum.hpp | ||||||
|  |              include/scwx/util/environment.hpp | ||||||
|              include/scwx/util/float.hpp |              include/scwx/util/float.hpp | ||||||
|              include/scwx/util/hash.hpp |              include/scwx/util/hash.hpp | ||||||
|              include/scwx/util/iterator.hpp |              include/scwx/util/iterator.hpp | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat