Coded location

This commit is contained in:
Dan Paulat 2022-01-25 21:39:28 -06:00
parent f25bb63ea0
commit ecf5b1f5f0
6 changed files with 428 additions and 3 deletions

View file

@ -0,0 +1,42 @@
#pragma once
#include <scwx/common/geographic.hpp>
#include <memory>
#include <string>
#include <vector>
#include <boost/range/any_range.hpp>
namespace scwx
{
namespace awips
{
class CodedLocationImpl;
class CodedLocation
{
public:
typedef boost::any_range<std::string, boost::forward_traversal_tag>
StringRange;
explicit CodedLocation();
~CodedLocation();
CodedLocation(const CodedLocation&) = delete;
CodedLocation& operator=(const CodedLocation&) = delete;
CodedLocation(CodedLocation&&) noexcept;
CodedLocation& operator=(CodedLocation&&) noexcept;
std::vector<common::Coordinate> coordinates() const;
bool Parse(const StringRange& lines, const std::string& wfo = "");
private:
std::unique_ptr<CodedLocationImpl> p;
};
} // namespace awips
} // namespace scwx

View file

@ -0,0 +1,25 @@
#pragma once
namespace scwx
{
namespace common
{
struct Coordinate
{
double latitude_;
double longitude_;
Coordinate(double latitude, double longitude) :
latitude_ {latitude}, longitude_ {longitude}
{
}
bool operator==(const Coordinate& o) const
{
return latitude_ == o.latitude_ && longitude_ == o.longitude_;
}
};
} // namespace common
} // namespace scwx