Add lat long conversion

This commit is contained in:
Tim Schubert 2020-08-23 21:25:54 +02:00
parent b7f459e36a
commit 70c70a19ce
8 changed files with 171 additions and 16 deletions

28
model/leo-lat-long.cc Normal file
View file

@ -0,0 +1,28 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
#include "leo-lat-long.h"
namespace ns3 {
std::ostream &operator << (std::ostream &os, const LeoLatLong &l)
{
os << l.latitude << ":" << l.longitude;
return os;
}
std::istream &operator >> (std::istream &is, LeoLatLong &l)
{
char c1;
is >> l.latitude >> c1 >> l.longitude;
if (c1 != ':')
{
is.setstate (std::ios_base::failbit);
}
return is;
}
LeoLatLong::LeoLatLong () : latitude (0), longitude (0) {}
LeoLatLong::LeoLatLong (double la, double lo) : latitude (la), longitude (lo) {}
LeoLatLong::~LeoLatLong () {}
};