int ways = 0;
int tls = 0;
PersistenceManager.getInstance().loadFromFile("./resources/export/berlin_test.ewd");
ModelManager model = ModelManager.getInstance();
for (ModelElement el : model.getAllModelElements()) {
if (el.getClass().equals(NodeModel.class))
nodes++;
else if (el.getClass().equals(WayModel.class)) {
ways++;
WayModel curWay = (WayModel) el;
edges += (curWay.getBackwardEdges().size() + curWay.getForwardEdges().size());
} else if (el.getClass().equals(TrafficLightModel.class))
tls++;
}
System.out.println("ModelElements: " + model.getAllModelElements().size());
System.out.println("Edges: " + edges);
System.out.println("Nodes: " + nodes);
System.out.println("Ways: " + ways);
System.out.println("TrafficLights: " + tls);
EWorld2sumo ew2s = new EWorld2sumo();
ew2s.setData(DIR_SUMO_TESTRES, RES_FILE_PREFIX, true /* doNetconvert */,
EWorldConstants.getNetConvertFile(), "", true /* doDuarouter */,
EWorldConstants.getDuaRouterFile(), "", true /* doTlsFile */, false, false,
false, true, new Integer[]{10000}, false);
ew2s.run();
model.clearModel();
model.notifyObservers(new ObserverNotification(NotificationType.startBatchProcess));
Sumo2ModelDOM s2m = new Sumo2ModelDOM("./resources/sumo_test/original/berlin_test.net.xml", model, true,
false, "");
s2m.run();
model.notifyObservers(new ObserverNotification(NotificationType.endBatchProcess, true, false));
int edges2 = 0;
int nodes2 = 0;
int ways2 = 0;
int tls2 = 0;
for (ModelElement el : model.getAllModelElements()) {
if (el.getClass().equals(NodeModel.class))
nodes2++;
else if (el.getClass().equals(WayModel.class)) {
ways2++;
WayModel curWay = (WayModel) el;
edges2 += (curWay.getBackwardEdges().size() + curWay.getForwardEdges().size());
} else if (el.getClass().equals(TrafficLightModel.class))
tls2++;
}
System.out.println("ModelElements: " + model.getAllModelElements().size());
System.out.println("Edges: " + edges2);
System.out.println("Nodes: " + nodes2);
System.out.println("Ways: " + ways2);
System.out.println("TrafficLights: " + tls2);