diff --git a/scwx-qt/scwx-qt.cmake b/scwx-qt/scwx-qt.cmake index 85cf8ee4..116a5355 100644 --- a/scwx-qt/scwx-qt.cmake +++ b/scwx-qt/scwx-qt.cmake @@ -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/imgui_font.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/media_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/imgui_font.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/media_types.cpp source/scwx/qt/types/qt_types.cpp diff --git a/scwx-qt/source/scwx/qt/types/alert_types.cpp b/scwx-qt/source/scwx/qt/types/alert_types.cpp index 34e44a95..46b1e785 100644 --- a/scwx-qt/source/scwx/qt/types/alert_types.cpp +++ b/scwx-qt/source/scwx/qt/types/alert_types.cpp @@ -37,6 +37,17 @@ std::string GetAlertActionName(AlertAction alertAction) return alertActionName_.at(alertAction); } +const std::vector& GetAlertAudioPhenomena() +{ + static const std::vector phenomena_ { + awips::Phenomenon::FlashFlood, + awips::Phenomenon::SevereThunderstorm, + awips::Phenomenon::SnowSquall, + awips::Phenomenon::Tornado}; + + return phenomena_; +} + } // namespace types } // namespace qt } // namespace scwx diff --git a/scwx-qt/source/scwx/qt/types/alert_types.hpp b/scwx-qt/source/scwx/qt/types/alert_types.hpp index 19431d4c..489b6b7a 100644 --- a/scwx-qt/source/scwx/qt/types/alert_types.hpp +++ b/scwx-qt/source/scwx/qt/types/alert_types.hpp @@ -1,8 +1,10 @@ #pragma once +#include #include #include +#include namespace scwx { @@ -23,6 +25,8 @@ typedef scwx::util::Iterator AlertAction GetAlertAction(const std::string& name); std::string GetAlertActionName(AlertAction alertAction); +const std::vector& GetAlertAudioPhenomena(); + } // namespace types } // namespace qt } // namespace scwx diff --git a/scwx-qt/source/scwx/qt/types/location_types.cpp b/scwx-qt/source/scwx/qt/types/location_types.cpp new file mode 100644 index 00000000..619e7746 --- /dev/null +++ b/scwx-qt/source/scwx/qt/types/location_types.cpp @@ -0,0 +1,29 @@ +#include +#include + +#include + +#include + +namespace scwx +{ +namespace qt +{ +namespace types +{ + +static const std::unordered_map + 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 diff --git a/scwx-qt/source/scwx/qt/types/location_types.hpp b/scwx-qt/source/scwx/qt/types/location_types.hpp new file mode 100644 index 00000000..9a6cca05 --- /dev/null +++ b/scwx-qt/source/scwx/qt/types/location_types.hpp @@ -0,0 +1,29 @@ +#pragma once + +#include + +#include + +namespace scwx +{ +namespace qt +{ +namespace types +{ + +enum class LocationMethod +{ + Fixed, + Track, + Unknown +}; +typedef scwx::util:: + Iterator + LocationMethodIterator; + +LocationMethod GetLocationMethod(const std::string& name); +const std::string& GetLocationMethodName(LocationMethod locationMethod); + +} // namespace types +} // namespace qt +} // namespace scwx diff --git a/wxdata/include/scwx/util/enum.hpp b/wxdata/include/scwx/util/enum.hpp new file mode 100644 index 00000000..7b991050 --- /dev/null +++ b/wxdata/include/scwx/util/enum.hpp @@ -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& pair) -> bool \ + { return boost::iequals(pair.second, name); }); \ + \ + if (result != nameMap.cend()) \ + { \ + return result->first; \ + } \ + else \ + { \ + return Type::Unknown; \ + } \ + } diff --git a/wxdata/wxdata.cmake b/wxdata/wxdata.cmake index f0507326..f074d858 100644 --- a/wxdata/wxdata.cmake +++ b/wxdata/wxdata.cmake @@ -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_factory.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/hash.hpp include/scwx/util/iterator.hpp