diff --git a/DataExtractionOSM/src-tests/net/osmand/router/JUnitRouteTest.java b/DataExtractionOSM/src-tests/net/osmand/router/JUnitRouteTest.java index adff5a0f1b..492991b7f4 100644 --- a/DataExtractionOSM/src-tests/net/osmand/router/JUnitRouteTest.java +++ b/DataExtractionOSM/src-tests/net/osmand/router/JUnitRouteTest.java @@ -9,7 +9,6 @@ import java.util.List; import net.osmand.Algoritms; import net.osmand.binary.BinaryMapIndexReader; -import net.osmand.router.BinaryRoutePlanner; import net.osmand.router.RoutingConfiguration; import net.osmand.swing.DataExtractionSettings; import net.osmand.swing.NativeSwingRendering; @@ -31,7 +30,7 @@ public class JUnitRouteTest { } // test without native because it is not present on the server // lib = NativeSwingRendering.getDefaultFromSettings(); - BinaryRoutePlanner.PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST = true; + RouteResultPreparation.PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST = true; String obfdir = System.getenv("OBF_DIR"); if(Algoritms.isEmpty(obfdir)){ obfdir = DataExtractionSettings.getSettings().getBinaryFilesDir(); diff --git a/DataExtractionOSM/src-tests/net/osmand/router/RouterTestsSuite.java b/DataExtractionOSM/src-tests/net/osmand/router/RouterTestsSuite.java index 0eae40827c..bb10a9fca3 100644 --- a/DataExtractionOSM/src-tests/net/osmand/router/RouterTestsSuite.java +++ b/DataExtractionOSM/src-tests/net/osmand/router/RouterTestsSuite.java @@ -41,12 +41,12 @@ public class RouterTestsSuite { Parameters p = new Parameters(); String routingXmlFile = null; String obfDirectory = null; - BinaryRoutePlanner.PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST = false; + RouteResultPreparation.PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST = false; for (String a : args) { if (a.startsWith("-routingXmlPath=")) { routingXmlFile = a.substring("-routingXmlPath=".length()); } else if (a.startsWith("-verbose")) { - BinaryRoutePlanner.PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST = true; + RouteResultPreparation.PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST = true; } else if (a.startsWith("-obfDir=")) { obfDirectory = a.substring("-obfDir=".length()); } else if (a.startsWith("-testDir=")) { diff --git a/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java b/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java index bc46a25215..7693bf1b37 100644 --- a/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java +++ b/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java @@ -744,7 +744,7 @@ public class IndexCreator { // creator.setIndexMap(true); // creator.setIndexAddress(true); // creator.setIndexPOI(true); -// creator.setInde xTransport(true); +// creator.setIndexTransport(true); creator.setIndexRouting(true); // creator.deleteDatabaseIndexes = false; @@ -755,8 +755,9 @@ public class IndexCreator { MapRenderingTypes rt = MapRenderingTypes.getDefault(); MapZooms zooms = MapZooms.getDefault(); // MapZooms.parseZooms("15-"); - String file = "/home/victor/projects/OsmAnd/temp/map.osm"; +// String file = "/home/victor/projects/OsmAnd/temp/map.osm"; // String file = "/home/victor/projects/OsmAnd/temp/belgium.osm.pbf"; + String file = "/home/victor/projects/OsmAnd/temp/poland.osm.pbf"; int st = file.lastIndexOf('/'); int e = file.indexOf('.', st); creator.setNodesDBFile(new File("/home/victor/projects/OsmAnd/data/osm-gen/"+file.substring(st, e) + ".tmp.odb")); diff --git a/DataExtractionOSM/src/net/osmand/data/preparation/IndexRouteCreator.java b/DataExtractionOSM/src/net/osmand/data/preparation/IndexRouteCreator.java index 100183ee1d..9dc70e58fc 100644 --- a/DataExtractionOSM/src/net/osmand/data/preparation/IndexRouteCreator.java +++ b/DataExtractionOSM/src/net/osmand/data/preparation/IndexRouteCreator.java @@ -614,6 +614,7 @@ public class IndexRouteCreator extends AbstractIndexPartCreator { return main; } + @SuppressWarnings("rawtypes") public void getAdjacentRoads(GeneralizedCluster gcluster, GeneralizedWay gw, int i, Collection collection){ gcluster = getCluster(gw, i, gcluster); Object o = gcluster.map.get(gw.getLocation(i)); @@ -628,10 +629,12 @@ public class IndexRouteCreator extends AbstractIndexPartCreator { } } + @SuppressWarnings("rawtypes") public int countAdjacentRoads(GeneralizedCluster gcluster, GeneralizedWay gw, int i){ gcluster = getCluster(gw, i, gcluster); Object o = gcluster.map.get(gw.getLocation(i)); if (o instanceof LinkedList) { + Iterator it = ((LinkedList) o).iterator(); int cnt = 0; while (it.hasNext()) { @@ -701,12 +704,14 @@ public class IndexRouteCreator extends AbstractIndexPartCreator { System.err.println(gw.id + " empty ? "); continue; } - Node prev = convertBaseToNode(gw.getLocation(0)); - nodes.add(prev); + long prev = 0; for (int i = 0; i < gw.size(); i++) { - Node c = convertBaseToNode(gw.getLocation(i)); - prev = c; - nodes.add(c); + long loc = gw.getLocation(i); + if(loc != prev) { + Node c = convertBaseToNode(loc); + prev = loc; + nodes.add(c); + } } outTypes.clear(); outTypes.add(gw.mainType); @@ -809,8 +814,7 @@ public class IndexRouteCreator extends AbstractIndexPartCreator { } } - private int checkDistanceToLine(GeneralizedWay line, int start, boolean directionPlus, - int px, int py, double distThreshold) { + public int checkDistanceToLine(GeneralizedWay line, int start, boolean directionPlus, int px, int py, double distThreshold) { int j = start; int next = directionPlus ? j + 1 : j - 1; while (next >= 0 && next < line.size()) { @@ -824,68 +828,6 @@ public class IndexRouteCreator extends AbstractIndexPartCreator { return -1; } - private void removeLineDuplication(Collection clusters) { - for(GeneralizedCluster cluster : clusters) { - ArrayList copy = new ArrayList(cluster.ways); - for(GeneralizedWay gw : copy) { - // already deleted - if(!cluster.ways.contains(gw)){ - continue; - } - if(gw.size() > 2) { - float p = DOUGLAS_PEUKER_DISTANCE / 3; - for (GeneralizedWay gn : copy) { - int kmin = checkDistanceToLine(gn, 0, true, gw.px.get(0), - gw.py.get(0), p); - int knext = kmin; - boolean dir = true; - if(kmin >= 0) { - knext = checkDistanceToLine(gn, kmin, dir, gw.px.get(1), - gw.py.get(1), p); - if(knext < 0) { - dir = false; - knext = checkDistanceToLine(gn, kmin, dir, gw.px.get(1), - gw.py.get(1), p); - } - } - if(knext > 0){ - int prevk = kmin; - while (gw.size() > 1) { - prevk = checkDistanceToLine(gn, prevk, dir, gw.px.get(1), - gw.py.get(1), p); - if(prevk < 0){ - break; - } - removePointFromWayAndReplace(cluster, gw, 1, gn.px.get(prevk), gn.py.get(prevk)); - } - removePointFromWayAndReplace(cluster, gw, 0, gn.px.get(kmin), gn.py.get(kmin)); - break; - } - } - } - } - } - } - - - private void removePointFromWayAndReplace(GeneralizedCluster cluster, GeneralizedWay gw, int i, int x31, int y31) { - GeneralizedCluster gcluster = getCluster(gw, i, cluster); - Object o = gcluster.map.get(gw.getLocation(i)); - if (o instanceof LinkedList) { - Iterator it = ((LinkedList) o).iterator(); - while (it.hasNext()) { - GeneralizedWay next = (GeneralizedWay) it.next(); - replacePointWithAnotherPoint(gcluster, gw, x31, y31, i, next); - } - } else if (o instanceof GeneralizedWay) { - replacePointWithAnotherPoint(gcluster, gw, x31, y31, i, (GeneralizedWay) o); - } - gcluster.removeWayFromLocation(gw, i); - gw.px.removeAt(i); - gw.py.removeAt(i); - } - - private void processRoundabouts(Collection clusters) { for(GeneralizedCluster cluster : clusters) { ArrayList copy = new ArrayList(cluster.ways); @@ -899,7 +841,6 @@ public class IndexRouteCreator extends AbstractIndexPartCreator { } } - private void removeSmall2RoadsConnectors(Collection clusters) { for(GeneralizedCluster cluster : clusters) { @@ -948,6 +889,7 @@ public class IndexRouteCreator extends AbstractIndexPartCreator { } + @SuppressWarnings("rawtypes") private void removeWayAndSubstituteWithPoint(GeneralizedWay gw, GeneralizedCluster gcluster) { // calculate center location long pxc = 0; diff --git a/DataExtractionOSM/src/net/osmand/render/default.render.xml b/DataExtractionOSM/src/net/osmand/render/default.render.xml index a45d503032..b929c19af5 100644 --- a/DataExtractionOSM/src/net/osmand/render/default.render.xml +++ b/DataExtractionOSM/src/net/osmand/render/default.render.xml @@ -59,11 +59,11 @@ - - - - - + + + + +