Open blahami2 opened 8 years ago
public static void demo() {
OverlayCreator creator = new OverlayCreator();
OverlayCreator.SaraSetup setup = creator.setup;
setup.spatialModulePath = "c:/ProgWin/SqLite64/mod_spatialite.dll";
setup.dbFolder = "D:/";
setup.setRandomSeed(123);
setup.layerCount = 5;
setup.maxCellSize = 20;
setup.numberOfAssemblyRuns = 1;
// D://prog-20-5.sqlite
setup.dbName = "prg-20-5"; //L3
// punch and save
//setup.runPunch = true;
//no punch, load only
setup.runPunch = false;
OverlayBuilder builder = creator.createBuilder();
builder.buildOverlays();
SaraGraph sara = builder.graph;
DijkstraAlgorithm oneAlg = new DijkstraAlgorithm();
MultilevelDijkstraAlgorithm mldAlg = new MultilevelDijkstraAlgorithm();
long sourceId = 27793;
long targetId = 28194;
SaraNode source = sara.getNodeById(sourceId);
SaraNode target = sara.getNodeById(targetId);
Optional<Route<SaraNode, SaraEdge>> oneRoute
= oneAlg.route(sara, Metric.LENGTH, source, target);
MLDRecursiveRouteUnpacker unpacker = new MLDRecursiveRouteUnpacker();
Optional<Route<SaraNode, SaraEdge>> mldRoute
= mldAlg.route(sara, builder, Metric.LENGTH, source, target, unpacker);
// 114 edges expected
System.out.println("one=" + oneRoute.get().getEdgeList().size());
System.out.println("mld=" + mldRoute.get().getEdgeList().size());
}