Example #1
0
  // Velocity init
  public static void initVelocity() {
    if (velocityCatch == null) {
      System.out.println("init VM");
      velocityCatch = new Object();

      Properties props = new Properties();
      props.setProperty("input.encoding", "UTF-8");
      props.setProperty("output.encoding", "UTF-8");

      if (getConfig().getChild("vmtemplatepath") != null) {
        props.setProperty("file.resource.loader.path", getConfig().getChildText("vmtemplatepath"));
      }
      if (System.getProperty("vmtemplatepath") != null) {
        props.setProperty("file.resource.loader.path", System.getProperty("vmtemplatepath"));
        // Velocity.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH,
        // System.getProperty("vmtemplatepath"));//oder new FIle()?
      }
      System.out.println("vmtemplatepath=" + props.getProperty("vmtemplatepath"));
      try {
        Velocity.setProperty(Velocity.RUNTIME_LOG_LOGSYSTEM, VeloLog.getInstance());
        Velocity.init(props);
      } catch (Exception ex) {
        ex.printStackTrace();
      }
    }
  }
  public static void main(String[] args) {
    String dir = System.getProperty("dir");
    String flowsFile = System.getProperty("flows");
    String turnsFile = System.getProperty("turns");
    String networkFile = System.getProperty("network");

    dir = "d:\\PP-rad\\inz-matsim\\input";
    // dir = "C:\\inzynierka\\demand";
    flowsFile = "flows.xml";
    turnsFile = "turns.xml";
    networkFile = "network.xml";

    MATSimJTRRouter jtrRouter = new MATSimJTRRouter();
    jtrRouter.readNetwork(dir, networkFile);
    jtrRouter.generate(dir, flowsFile, turnsFile);
  }