View | Details | Raw Unified | Return to bug 1106
Collapse All | Expand All

(-)a/examples/matrix-topology/matrix-topology.cc (-3 / +3 lines)
 Lines 196-205    Link Here 
196
    {
196
    {
197
      positionAlloc_n->Add (Vector (coord_array[m][0], coord_array[m][1], 0));
197
      positionAlloc_n->Add (Vector (coord_array[m][0], coord_array[m][1], 0));
198
      Ptr<Node> n0 = nodes.Get (m);
198
      Ptr<Node> n0 = nodes.Get (m);
199
      Ptr<CanvasLocation> nLoc =  n0->GetObject<CanvasLocation> ();
199
      Ptr<ConstantPositionMobilityModel> nLoc =  n0->GetObject<ConstantPositionMobilityModel> ();
200
      if (nLoc == 0)
200
      if (nLoc == 0)
201
        {
201
        {
202
          nLoc = CreateObject<CanvasLocation> ();
202
          nLoc = CreateObject<ConstantPositionMobilityModel> ();
203
          n0->AggregateObject (nLoc);
203
          n0->AggregateObject (nLoc);
204
        }
204
        }
205
      // y-coordinates are negated for correct display in NetAnim
205
      // y-coordinates are negated for correct display in NetAnim
 Lines 207-213    Link Here 
207
      // by negating the y coordinates, we declare the reference (0,0) coordinate
207
      // by negating the y coordinates, we declare the reference (0,0) coordinate
208
      // to the bottom left corner
208
      // to the bottom left corner
209
      Vector nVec (coord_array[m][0], -coord_array[m][1], 0);
209
      Vector nVec (coord_array[m][0], -coord_array[m][1], 0);
210
      nLoc->SetLocation (nVec);
210
      nLoc->SetPosition (nVec);
211
211
212
    }
212
    }
213
  mobility_n.SetPositionAllocator (positionAlloc_n);
213
  mobility_n.SetPositionAllocator (positionAlloc_n);
(-)a/src/netanim/helper/point-to-point-dumbbell-helper.cc (-13 / +13 lines)
 Lines 24-30    Link Here 
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"
 Lines 175-199    Link Here 
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;
 Lines 209-218    Link Here 
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,
 Lines 226-232    Link Here 
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
 Lines 242-251    Link Here 
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
 Lines 259-265    Link Here 
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
}
(-)a/src/netanim/helper/point-to-point-grid-helper.cc (-4 / +4 lines)
 Lines 20-26    Link Here 
20
#include "ns3/animation-interface.h"
20
#include "ns3/animation-interface.h"
21
#include "ns3/internet-stack-helper.h"
21
#include "ns3/internet-stack-helper.h"
22
#include "ns3/point-to-point-helper.h"
22
#include "ns3/point-to-point-helper.h"
23
#include "ns3/canvas-location.h"
23
#include "ns3/constant-position-mobility-model.h"
24
#include "ns3/string.h"
24
#include "ns3/string.h"
25
#include "ns3/vector.h"
25
#include "ns3/vector.h"
26
#include "ns3/log.h"
26
#include "ns3/log.h"
 Lines 160-173    Link Here 
160
    for (uint32_t j = 0; j < m_xSize; ++j)
160
    for (uint32_t j = 0; j < m_xSize; ++j)
161
    {
161
    {
162
      Ptr<Node> node = GetNode (i, j);
162
      Ptr<Node> node = GetNode (i, j);
163
      Ptr<CanvasLocation> loc = node->GetObject<CanvasLocation> ();
163
      Ptr<ConstantPositionMobilityModel> loc = node->GetObject<ConstantPositionMobilityModel> ();
164
      if (loc ==0)
164
      if (loc ==0)
165
      {
165
      {
166
        loc = CreateObject<CanvasLocation> ();
166
        loc = CreateObject<ConstantPositionMobilityModel> ();
167
        node->AggregateObject (loc);
167
        node->AggregateObject (loc);
168
      }
168
      }
169
      Vector locVec (xLoc, yLoc, 0);
169
      Vector locVec (xLoc, yLoc, 0);
170
      loc->SetLocation (locVec);
170
      loc->SetPosition (locVec);
171
171
172
      xLoc += xAdder;
172
      xLoc += xAdder;
173
    }
173
    }
(-)a/src/netanim/helper/point-to-point-star-helper.cc (-7 / +7 lines)
 Lines 20-26    Link Here 
20
// ns3 includes
20
// ns3 includes
21
#include "ns3/animation-interface.h"
21
#include "ns3/animation-interface.h"
22
#include "ns3/point-to-point-star-helper.h"
22
#include "ns3/point-to-point-star-helper.h"
23
#include "ns3/canvas-location.h"
23
#include "ns3/constant-position-mobility-model.h"
24
24
25
#include "ns3/node-list.h"
25
#include "ns3/node-list.h"
26
#include "ns3/point-to-point-net-device.h"
26
#include "ns3/point-to-point-net-device.h"
 Lines 120-133    Link Here 
120
120
121
  // Place the hub
121
  // Place the hub
122
  Ptr<Node> hub = m_hub.Get (0);
122
  Ptr<Node> hub = m_hub.Get (0);
123
  Ptr<CanvasLocation> hubLoc =  hub->GetObject<CanvasLocation> ();
123
  Ptr<ConstantPositionMobilityModel> hubLoc =  hub->GetObject<ConstantPositionMobilityModel> ();
124
  if (hubLoc == 0)
124
  if (hubLoc == 0)
125
    {
125
    {
126
      hubLoc = CreateObject<CanvasLocation> ();
126
      hubLoc = CreateObject<ConstantPositionMobilityModel> ();
127
      hub->AggregateObject (hubLoc);
127
      hub->AggregateObject (hubLoc);
128
    }
128
    }
129
  Vector hubVec (ulx + xDist/2.0, uly + yDist/2.0, 0);
129
  Vector hubVec (ulx + xDist/2.0, uly + yDist/2.0, 0);
130
  hubLoc->SetLocation (hubVec);
130
  hubLoc->SetPosition (hubVec);
131
131
132
  double spokeDist;
132
  double spokeDist;
133
  if (xDist > yDist)
133
  if (xDist > yDist)
 Lines 143-158    Link Here 
143
  for (uint32_t i = 0; i < m_spokes.GetN (); ++i)
143
  for (uint32_t i = 0; i < m_spokes.GetN (); ++i)
144
    {
144
    {
145
      Ptr<Node> spokeNode = m_spokes.Get (i);
145
      Ptr<Node> spokeNode = m_spokes.Get (i);
146
      Ptr<CanvasLocation> spokeLoc = spokeNode->GetObject<CanvasLocation> ();
146
      Ptr<ConstantPositionMobilityModel> spokeLoc = spokeNode->GetObject<ConstantPositionMobilityModel> ();
147
      if (spokeLoc == 0)
147
      if (spokeLoc == 0)
148
        {
148
        {
149
          spokeLoc = CreateObject<CanvasLocation> ();
149
          spokeLoc = CreateObject<ConstantPositionMobilityModel> ();
150
          spokeNode->AggregateObject (spokeLoc);
150
          spokeNode->AggregateObject (spokeLoc);
151
        }
151
        }
152
        Vector spokeVec (hubVec.x + cos (theta*i) * spokeDist, 
152
        Vector spokeVec (hubVec.x + cos (theta*i) * spokeDist, 
153
                         hubVec.y + sin (theta*i) * spokeDist,
153
                         hubVec.y + sin (theta*i) * spokeDist,
154
                         0);
154
                         0);
155
        spokeLoc->SetLocation (spokeVec);
155
        spokeLoc->SetPosition (spokeVec);
156
    }
156
    }
157
}
157
}
158
158
(-)a/src/netanim/model/animation-interface.cc (-3 / +3 lines)
 Lines 36-42    Link Here 
36
#include "ns3/channel.h"
36
#include "ns3/channel.h"
37
#include "ns3/config.h"
37
#include "ns3/config.h"
38
#include "ns3/node.h"
38
#include "ns3/node.h"
39
#include "ns3/canvas-location.h"
39
#include "ns3/mobility-model.h"
40
#include "ns3/packet.h"
40
#include "ns3/packet.h"
41
#include "ns3/simulator.h"
41
#include "ns3/simulator.h"
42
42
 Lines 99-109    Link Here 
99
  for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i)
99
  for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i)
100
    {
100
    {
101
      Ptr<Node> n = *i;
101
      Ptr<Node> n = *i;
102
      Ptr<CanvasLocation> loc = n->GetObject<CanvasLocation> ();
102
      Ptr<MobilityModel> loc = n->GetObject<MobilityModel> ();
103
      if (loc)
103
      if (loc)
104
        {
104
        {
105
          // Location exists, dump it
105
          // Location exists, dump it
106
          Vector v = loc->GetLocation ();
106
          Vector v = loc->GetPosition ();
107
          ostringstream oss;
107
          ostringstream oss;
108
          oss << "0.0 N " << n->GetId () 
108
          oss << "0.0 N " << n->GetId () 
109
               << " " << v.x << " " << v.y << endl;
109
               << " " << v.x << " " << v.y << endl;
(-)a/src/netanim/wscript (-3 / +1 lines)
 Lines 1-11    Link Here 
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
2
3
def build(bld):
3
def build(bld):
4
    module = bld.create_ns3_module('netanim', ['internet', 'point-to-point'])
4
    module = bld.create_ns3_module('netanim', ['internet', 'point-to-point', 'mobility'])
5
    module.includes = '.'
5
    module.includes = '.'
6
    module.source = [
6
    module.source = [
7
        'model/animation-interface.cc',
7
        'model/animation-interface.cc',
8
        'model/canvas-location.cc',
9
        'helper/point-to-point-dumbbell-helper.cc',
8
        'helper/point-to-point-dumbbell-helper.cc',
10
        'helper/point-to-point-grid-helper.cc',
9
        'helper/point-to-point-grid-helper.cc',
11
        'helper/point-to-point-star-helper.cc',
10
        'helper/point-to-point-star-helper.cc',
 Lines 15-21    Link Here 
15
    headers.module = 'netanim'
14
    headers.module = 'netanim'
16
    headers.source = [
15
    headers.source = [
17
        'model/animation-interface.h',
16
        'model/animation-interface.h',
18
        'model/canvas-location.h',
19
        'helper/point-to-point-dumbbell-helper.h',
17
        'helper/point-to-point-dumbbell-helper.h',
20
        'helper/point-to-point-grid-helper.h',
18
        'helper/point-to-point-grid-helper.h',
21
        'helper/point-to-point-star-helper.h',
19
        'helper/point-to-point-star-helper.h',

Return to bug 1106