mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 21:20:06 +00:00
Coded location
This commit is contained in:
parent
f25bb63ea0
commit
ecf5b1f5f0
6 changed files with 428 additions and 3 deletions
42
wxdata/include/scwx/awips/coded_location.hpp
Normal file
42
wxdata/include/scwx/awips/coded_location.hpp
Normal 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
|
||||
25
wxdata/include/scwx/common/geographic.hpp
Normal file
25
wxdata/include/scwx/common/geographic.hpp
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue