mirror of
https://gitlab.ibr.cs.tu-bs.de/tschuber/ns-3-leo.git
synced 2025-06-09 10:31:43 +02:00
Add polar position allocator
This commit is contained in:
parent
70c70a19ce
commit
ab7c9881f6
7 changed files with 147 additions and 12 deletions
|
@ -30,24 +30,25 @@ LeoGndNodeHelper::SetAttribute (string name, const AttributeValue &value)
|
|||
}
|
||||
|
||||
NodeContainer
|
||||
LeoGndNodeHelper::Install (const std::string &wpFile)
|
||||
LeoGndNodeHelper::Install (const std::string &file)
|
||||
{
|
||||
NS_LOG_FUNCTION (wpFile);
|
||||
NS_LOG_FUNCTION (this << file);
|
||||
|
||||
NodeContainer nodes;
|
||||
ifstream waypoints;
|
||||
waypoints.open (wpFile, ifstream::in);
|
||||
Vector pos;
|
||||
while ((waypoints >> pos))
|
||||
ifstream stream;
|
||||
stream.open (file, ifstream::in);
|
||||
LeoLatLong loc;
|
||||
while ((stream >> loc))
|
||||
{
|
||||
Ptr<ConstantPositionMobilityModel> mob = CreateObject<ConstantPositionMobilityModel> ();
|
||||
Vector pos = GetEarthPosition (loc);
|
||||
mob->SetPosition (pos);
|
||||
Ptr<Node> node = m_gndNodeFactory.Create<Node> ();
|
||||
node->AggregateObject (mob);
|
||||
nodes.Add (node);
|
||||
NS_LOG_INFO ("Added ground node at " << pos);
|
||||
}
|
||||
waypoints.close ();
|
||||
stream.close ();
|
||||
|
||||
NS_LOG_INFO ("Added " << nodes.GetN () << " ground nodes");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue