Add types for audio alerts

This commit is contained in:
Dan Paulat 2023-11-29 06:00:30 -06:00
parent e1ccc1ebb8
commit 9486d2364a
7 changed files with 97 additions and 1 deletions

View file

@ -37,6 +37,17 @@ std::string GetAlertActionName(AlertAction 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 qt
} // namespace scwx

View file

@ -1,8 +1,10 @@
#pragma once
#include <scwx/awips/phenomenon.hpp>
#include <scwx/util/iterator.hpp>
#include <string>
#include <vector>
namespace scwx
{
@ -23,6 +25,8 @@ typedef scwx::util::Iterator<AlertAction, AlertAction::Go, AlertAction::View>
AlertAction GetAlertAction(const std::string& name);
std::string GetAlertActionName(AlertAction alertAction);
const std::vector<awips::Phenomenon>& GetAlertAudioPhenomena();
} // namespace types
} // namespace qt
} // namespace scwx

View 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

View 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