Esempio n. 1
0
 public void loadSecondStage(Dictionary dictionaries)
     throws XMLInvalidInputException, XMLTreeException {
   super.loadSecondStage(dictionaries);
   // Load roads
   Dictionary roadDictionary = (Dictionary) (dictionaries.get("road"));
   allRoads = new Road[loadData.roads.length];
   for (int t = 0; t < loadData.roads.length; t++) {
     allRoads[t] = (Road) (roadDictionary.get(new Integer(loadData.roads[t])));
     if (allRoads[t] == null && loadData.roads[t] != -1)
       System.out.println("Warning : " + getName() + " could not find road " + loadData.roads[t]);
   }
   // Load normal signs
   Dictionary laneDictionary = (Dictionary) (dictionaries.get("lane"));
   signs = new Sign[loadData.signs.length];
   for (int t = 0; t < loadData.signs.length; t++)
     signs[t] = getSign(laneDictionary, loadData.signs[t]);
   // Load Signconfigurations
   signconfigs = new Sign[loadData.signconfigs.length][2];
   for (int t = 0; t < signconfigs.length; t++) {
     signconfigs[t] = new Sign[loadData.signconfigs[t].length];
     for (int u = 0; u < signconfigs[t].length; u++) {
       signconfigs[t][u] = getSign(laneDictionary, loadData.signconfigs[t][u]);
     }
   }
   // Tell *all* roads to load themselves
   // It's possible that this Node has a BetaLane that has not been SecondStageLoaded
   // And so we cant do an UpdateLanes() as that one needs secondStageData to proceed.
   // Hence, we need to 2ndStage all Roads.
   Enumeration e = new ArrayEnumeration(allRoads);
   Road tmpRoad;
   while (e.hasMoreElements()) {
     tmpRoad = (Road) e.nextElement();
     if (tmpRoad != null) tmpRoad.loadSecondStage(dictionaries);
   }
   try { // System.out.println("Trying to updateLanes()");
     updateLanes();
   } catch (InfraException x) {
     throw new XMLInvalidInputException("Cannot initialize lanes of node " + nodeId);
   }
 }