Line | |
---|
1 | /************************************************************************************ |
---|
2 | * Copyright (C) 2008 by Politehnica University of Bucharest and Rutgers University |
---|
3 | * All rights reserved. |
---|
4 | * Refer to LICENSE for terms and conditions of use. |
---|
5 | ***********************************************************************************/ |
---|
6 | package vnsim.vehicular.routePlan.infrastructureRouted; |
---|
7 | |
---|
8 | import vnsim.applications.trafficview.SimulatedCarInfo; |
---|
9 | import vnsim.applications.vitp.CarRunningVITP; |
---|
10 | import vnsim.map.object.Globals; |
---|
11 | import vnsim.vehicular.simulator.CarInstance; |
---|
12 | |
---|
13 | public class GuidanceRequest { |
---|
14 | |
---|
15 | public static void generateRequestToInfrastructure(CarInstance car) { |
---|
16 | |
---|
17 | if ((car.route.length <= car.routeIndex + 1) |
---|
18 | && (Globals.engine.crtTime % 100 == car.queryTime)) { |
---|
19 | |
---|
20 | SimulatedCarInfo myCar = Globals.engine.getCarIdx(car.ID); |
---|
21 | if (myCar != null) { |
---|
22 | |
---|
23 | if (!(myCar instanceof InfrastructureNode)) { |
---|
24 | if ((car.route[car.routeIndex].pt2 != car.destination.ptIdx) |
---|
25 | || (car.route[car.routeIndex].roadIndex != car.destination.roadIdx)) { |
---|
26 | |
---|
27 | ((CarRunningVITP) myCar).broadcastRoadPacket("DR " |
---|
28 | + car.ID + " " |
---|
29 | + car.route[car.routeIndex].roadIndex + " " |
---|
30 | + car.route[car.routeIndex].pt1 + " " |
---|
31 | + car.route[car.routeIndex].pt2 + " " |
---|
32 | + car.destination.roadIdx + " " + car.destination.ptIdx); |
---|
33 | |
---|
34 | } |
---|
35 | |
---|
36 | } |
---|
37 | } |
---|
38 | } |
---|
39 | |
---|
40 | } |
---|
41 | |
---|
42 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.