source: proiecte/ptvs/src/vnsim/vehicular/routePlan/infrastructureRouted/GuidanceRequest.java @ 31

Last change on this file since 31 was 31, checked in by (none), 14 years ago
File size: 1.4 KB
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 ***********************************************************************************/
6package vnsim.vehicular.routePlan.infrastructureRouted;
7
8import vnsim.applications.trafficview.SimulatedCarInfo;
9import vnsim.applications.vitp.CarRunningVITP;
10import vnsim.map.object.Globals;
11import vnsim.vehicular.simulator.CarInstance;
12
13public 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.