mirror of
https://gitlab.ibr.cs.tu-bs.de/tschuber/ns-3-leo.git
synced 2025-07-30 02:30:07 +02:00
Add lat long conversion
This commit is contained in:
parent
b7f459e36a
commit
70c70a19ce
8 changed files with 171 additions and 16 deletions
28
model/leo-lat-long.cc
Normal file
28
model/leo-lat-long.cc
Normal 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 () {}
|
||||
|
||||
};
|
26
model/leo-lat-long.h
Normal file
26
model/leo-lat-long.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
|
||||
#ifndef LEO_LAT_LONG_H
|
||||
#define LEO_LAT_LONG_H
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class LeoLatLong
|
||||
{
|
||||
public:
|
||||
LeoLatLong ();
|
||||
LeoLatLong (double latitude, double longitude);
|
||||
virtual ~LeoLatLong();
|
||||
|
||||
double latitude;
|
||||
double longitude;
|
||||
};
|
||||
|
||||
std::ostream &operator << (std::ostream &os, const LeoLatLong &latLong);
|
||||
std::istream &operator >> (std::istream &is, LeoLatLong &latLong);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
17
model/orbit.h
Normal file
17
model/orbit.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
|
||||
#ifndef LEO_ORBIT_H
|
||||
#define LEO_ORBIT_H
|
||||
|
||||
#include "ns3/uinteger.h"
|
||||
|
||||
class Orbit {
|
||||
public:
|
||||
Orbit (double a, double i, double p, double s) : alt (a), inc (i), planes (p), sats (s) {}
|
||||
double alt;
|
||||
double inc;
|
||||
uint16_t planes;
|
||||
uint16_t sats;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue