[31] | 1 | /* |
---|
| 2 | * Author Andrei Ichimescu |
---|
| 3 | * email andrei.ichimescu@gmail.com |
---|
| 4 | */ |
---|
| 5 | |
---|
| 6 | package vnsim.vehicular.routePlan.cityRouting; |
---|
| 7 | |
---|
| 8 | import java.util.ArrayList; |
---|
| 9 | |
---|
| 10 | import javax.swing.JOptionPane; |
---|
| 11 | |
---|
| 12 | import vnsim.vehicular.generator.Mobility; |
---|
| 13 | import vnsim.vehicular.routePlan.MakeScenarios; |
---|
| 14 | import vnsim.vehicular.routePlan.RoutingConstants; |
---|
| 15 | import vnsim.vehicular.scenarios.Scenario; |
---|
| 16 | import vnsim.vehicular.simulator.Location; |
---|
| 17 | |
---|
| 18 | public class Main { |
---|
| 19 | |
---|
| 20 | /** |
---|
| 21 | * @param args |
---|
| 22 | */ |
---|
| 23 | public static void main(String[] args) { |
---|
| 24 | //final String name = "RoutePlanCityTest"; |
---|
| 25 | final String name = "Reservation1"; |
---|
| 26 | try{ |
---|
| 27 | MakeScenarios.createMap(name, true, true, |
---|
| 28 | RoutingConstants.DYNAMIC_CITY_ROUTE); |
---|
| 29 | }catch(Exception e){ |
---|
| 30 | |
---|
| 31 | } |
---|
| 32 | ArrayList<Location> entries = new ArrayList<Location>(); |
---|
| 33 | ArrayList<Location> exits = new ArrayList<Location>(); |
---|
| 34 | ArrayList<Integer> entryFlows = new ArrayList<Integer>(); |
---|
| 35 | |
---|
| 36 | //entries.add(new Location(0, 0)); |
---|
| 37 | //exits.add(new Location(0, 768)); |
---|
| 38 | //entryFlows.add(400); |
---|
| 39 | |
---|
| 40 | for (int i=2;i<=2;i++) { |
---|
| 41 | entries.add(new Location(i, 0)); |
---|
| 42 | //entries.add(new Location(i, 768)); |
---|
| 43 | entries.add(new Location(i+5, 0)); |
---|
| 44 | //entries.add(new Location(i+5, 768)); |
---|
| 45 | //exits.add(new Location(i, 0)); |
---|
| 46 | exits.add(new Location(i, 768)); |
---|
| 47 | //exits.add(new Location(i+5, 0)); |
---|
| 48 | exits.add(new Location(i+5, 768)); |
---|
| 49 | for (int j=0; j<2;j++) { |
---|
| 50 | if (i==2) { |
---|
| 51 | entryFlows.add(350); |
---|
| 52 | } else { |
---|
| 53 | entryFlows.add(100); |
---|
| 54 | } |
---|
| 55 | } |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | Scenario s = MakeScenarios.createScenario(name, entries, exits, entryFlows); |
---|
| 59 | vnsim.map.object.Globals.variationsFile = null; |
---|
| 60 | try { |
---|
| 61 | Mobility.loadScenario(s); |
---|
| 62 | } catch (Exception ex) { |
---|
| 63 | JOptionPane.showMessageDialog(null, |
---|
| 64 | "<html>ERROR! Map structure has been modified<br> Try rebuilding the map " |
---|
| 65 | + s.mapFileName + "!</html>"); |
---|
| 66 | } |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | } |
---|