/************************************************************************************ * Copyright (C) 2008 by Politehnica University of Bucharest and Rutgers University * All rights reserved. * Refer to LICENSE for terms and conditions of use. ***********************************************************************************/ package vnsim.vehicular.scenarios; import java.io.*; import javax.swing.*; import java.util.logging.*; import vnsim.vehicular.generator.Mobility; import vnsim.gui.*; import vnsim.map.object.*; public class Main { /*public static void main(String args[]) throws Exception { ObjectInputStream ois=new ObjectInputStream(new FileInputStream(".//maps//fsc//"+args[0])); Scenario sc=null; try { sc=(Scenario)ois.readObject(); System.out.println("Sc name="+sc.name); } catch (Exception ex) { JOptionPane.showMessageDialog(null, "ERROR! Scenario could not be read!
Try rebuilding the map " + args[0] +"!"); throw ex; } int ret=JOptionPane.showConfirmDialog(null, "Do you want to specify a flow variations file?"); if(ret==JOptionPane.OK_OPTION) { JFileChooser fc=new JFileChooser(".//maps//variations//"); fc.setDialogTitle("Choose the file specifying the flow variations"); int retVal=fc.showOpenDialog(null); if(retVal==JFileChooser.APPROVE_OPTION) { vnsim.map.object.Globals.variationsFile=fc.getSelectedFile().getName(); } else { vnsim.map.object.Globals.variationsFile=null; } } else { vnsim.map.object.Globals.variationsFile=null; } try { Mobility.loadScenario(sc); } catch (Exception ex) { JOptionPane.showMessageDialog(null, "ERROR! Map structure has been modified
Try rebuilding the map " + sc.mapFileName +"!"); throw ex; } System.out.println("Scenario loaded..."); vnsim.gui.Main.startGui(); } }*/ /** Logger used by this class */ private static final transient Logger logger = Logger.getLogger("scenarios.Main"); public static void main(String args[]) throws Exception { Scenario sc=null; try { ObjectInputStream ois = null; File f = new File(System.getProperty("user.home")+File.separatorChar+"maps"+File.separatorChar+"fsc"+File.separatorChar+args[0]); if (f.exists() && f.isFile() && f.canRead()) { ois = new ObjectInputStream(new FileInputStream(f)); } else { ois = new ObjectInputStream(Utils.getInstance().openStream("maps/fsc/"+args[0])); } sc=(Scenario)ois.readObject(); logger.info("Sc name="+sc.name); ois.close(); } catch (Exception ex) { JOptionPane.showMessageDialog(null, "ERROR! Scenario could not be read!
Try rebuilding the map " + args[0] +"!"); throw ex; } int ret=JOptionPane.showConfirmDialog(null, "Do you want to specify a flow variations file?"); if(ret==JOptionPane.OK_OPTION) { JFileChooser fc=new JFileChooser("/maps/variations/", Utils.getInstance().getSystemView("/maps/variations")); fc.setDialogTitle("Choose the file specifying the flow variations"); int retVal=fc.showOpenDialog(null); if(retVal==JFileChooser.APPROVE_OPTION) { Globals.variationsFile=fc.getSelectedFile().getName(); } else { Globals.variationsFile = null; } } else { Globals.variationsFile = null; } try { Mobility.loadScenario(sc); } catch (Exception ex) { JOptionPane.showMessageDialog(null, "ERROR! Map structure has been modified
Try rebuilding the map " + sc.mapFileName +"!"); throw ex; } logger.info("Scenario loaded..."); vnsim.gui.Main.startGui(); } }