|
24 |
// ns3 includes |
24 |
// ns3 includes |
25 |
#include "ns3/animation-interface.h" |
25 |
#include "ns3/animation-interface.h" |
26 |
#include "ns3/point-to-point-dumbbell-helper.h" |
26 |
#include "ns3/point-to-point-dumbbell-helper.h" |
27 |
#include "ns3/canvas-location.h" |
27 |
#include "ns3/constant-position-mobility-model.h" |
28 |
|
28 |
|
29 |
#include "ns3/node-list.h" |
29 |
#include "ns3/node-list.h" |
30 |
#include "ns3/point-to-point-net-device.h" |
30 |
#include "ns3/point-to-point-net-device.h" |
|
175 |
|
175 |
|
176 |
// Place the left router |
176 |
// Place the left router |
177 |
Ptr<Node> lr = GetLeft (); |
177 |
Ptr<Node> lr = GetLeft (); |
178 |
Ptr<CanvasLocation> loc = lr->GetObject<CanvasLocation> (); |
178 |
Ptr<ConstantPositionMobilityModel> loc = lr->GetObject<ConstantPositionMobilityModel> (); |
179 |
if (loc == 0) |
179 |
if (loc == 0) |
180 |
{ |
180 |
{ |
181 |
loc = CreateObject<CanvasLocation> (); |
181 |
loc = CreateObject<ConstantPositionMobilityModel> (); |
182 |
lr->AggregateObject (loc); |
182 |
lr->AggregateObject (loc); |
183 |
} |
183 |
} |
184 |
Vector lrl (ulx + xAdder, uly + yDist/2.0, 0); |
184 |
Vector lrl (ulx + xAdder, uly + yDist/2.0, 0); |
185 |
loc->SetLocation (lrl); |
185 |
loc->SetPosition (lrl); |
186 |
|
186 |
|
187 |
// Place the right router |
187 |
// Place the right router |
188 |
Ptr<Node> rr = GetRight (); |
188 |
Ptr<Node> rr = GetRight (); |
189 |
loc = rr->GetObject<CanvasLocation> (); |
189 |
loc = rr->GetObject<ConstantPositionMobilityModel> (); |
190 |
if (loc == 0) |
190 |
if (loc == 0) |
191 |
{ |
191 |
{ |
192 |
loc = CreateObject<CanvasLocation> (); |
192 |
loc = CreateObject<ConstantPositionMobilityModel> (); |
193 |
rr->AggregateObject (loc); |
193 |
rr->AggregateObject (loc); |
194 |
} |
194 |
} |
195 |
Vector rrl (ulx + xAdder * 2, uly + yDist/2.0, 0); // Right router location |
195 |
Vector rrl (ulx + xAdder * 2, uly + yDist/2.0, 0); // Right router location |
196 |
loc->SetLocation (rrl); |
196 |
loc->SetPosition (rrl); |
197 |
|
197 |
|
198 |
// Place the left leaf nodes |
198 |
// Place the left leaf nodes |
199 |
double theta = -M_PI_2 + thetaL; |
199 |
double theta = -M_PI_2 + thetaL; |
|
209 |
} |
209 |
} |
210 |
} |
210 |
} |
211 |
Ptr<Node> ln = GetLeft (l); |
211 |
Ptr<Node> ln = GetLeft (l); |
212 |
loc = ln->GetObject<CanvasLocation> (); |
212 |
loc = ln->GetObject<ConstantPositionMobilityModel> (); |
213 |
if (loc == 0) |
213 |
if (loc == 0) |
214 |
{ |
214 |
{ |
215 |
loc = CreateObject<CanvasLocation> (); |
215 |
loc = CreateObject<ConstantPositionMobilityModel> (); |
216 |
ln->AggregateObject (loc); |
216 |
ln->AggregateObject (loc); |
217 |
} |
217 |
} |
218 |
Vector lnl (lrl.x - cos (theta) * xAdder, |
218 |
Vector lnl (lrl.x - cos (theta) * xAdder, |
|
226 |
{ |
226 |
{ |
227 |
lnl.y = lry; // Set to lower right y |
227 |
lnl.y = lry; // Set to lower right y |
228 |
} |
228 |
} |
229 |
loc->SetLocation (lnl); |
229 |
loc->SetPosition (lnl); |
230 |
theta += thetaL; |
230 |
theta += thetaL; |
231 |
} |
231 |
} |
232 |
// Place the right nodes |
232 |
// Place the right nodes |
|
242 |
} |
242 |
} |
243 |
} |
243 |
} |
244 |
Ptr<Node> rn = GetRight (r); |
244 |
Ptr<Node> rn = GetRight (r); |
245 |
loc = rn->GetObject<CanvasLocation> (); |
245 |
loc = rn->GetObject<ConstantPositionMobilityModel> (); |
246 |
if (loc == 0) |
246 |
if (loc == 0) |
247 |
{ |
247 |
{ |
248 |
loc = CreateObject<CanvasLocation> (); |
248 |
loc = CreateObject<ConstantPositionMobilityModel> (); |
249 |
rn->AggregateObject (loc); |
249 |
rn->AggregateObject (loc); |
250 |
} |
250 |
} |
251 |
Vector rnl (rrl.x + cos (theta) * xAdder, // Right node location |
251 |
Vector rnl (rrl.x + cos (theta) * xAdder, // Right node location |
|
259 |
{ |
259 |
{ |
260 |
rnl.y = lry; // Set to lower right y |
260 |
rnl.y = lry; // Set to lower right y |
261 |
} |
261 |
} |
262 |
loc->SetLocation (rnl); |
262 |
loc->SetPosition (rnl); |
263 |
theta += thetaR; |
263 |
theta += thetaR; |
264 |
} |
264 |
} |
265 |
} |
265 |
} |