From 92ff00ea30ee01fdc27b3b1c6c7706f35cf7a43d Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 7 Jul 2011 23:52:12 +0200 Subject: [PATCH] Fix small routing plans --- .../net/osmand/router/BinaryRoutePlanner.java | 1 + .../src/net/osmand/router/CarRouter.java | 17 ++++++++++++----- .../swing/OsmExtractionPreferencesDialog.java | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java b/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java index 6da9a3a03c..8435ebda99 100644 --- a/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java +++ b/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java @@ -391,6 +391,7 @@ public class BinaryRoutePlanner { } // 3.2 calculate possible ways to put into priority queue + // next.getRoad().getId() >> 1 while (next != null) { long nts = (next.road.getId() << 8l) + next.segmentStart; if(oppositeSegments.containsKey(nts)){ diff --git a/DataExtractionOSM/src/net/osmand/router/CarRouter.java b/DataExtractionOSM/src/net/osmand/router/CarRouter.java index 6d2e17f09f..5cd12493a9 100644 --- a/DataExtractionOSM/src/net/osmand/router/CarRouter.java +++ b/DataExtractionOSM/src/net/osmand/router/CarRouter.java @@ -32,13 +32,13 @@ public class CarRouter extends VehicleRouter { autoNotDefinedValues.put("living_street", 20d); autoPriorityValues.put("motorway", 1.5); - autoPriorityValues.put("motorway_link", 1.0); + autoPriorityValues.put("motorway_link", 0.9); autoPriorityValues.put("trunk", 1.5); - autoPriorityValues.put("trunk_link", 1d); + autoPriorityValues.put("trunk_link", 0.9); autoPriorityValues.put("primary", 1.3d); - autoPriorityValues.put("primary_link", 1d); - autoPriorityValues.put("secondary", 1.0d); - autoPriorityValues.put("secondary_link", 1.0d); + autoPriorityValues.put("primary_link", 0.9d); + autoPriorityValues.put("secondary", 1.1d); + autoPriorityValues.put("secondary_link", 0.9d); autoPriorityValues.put("tertiary", 0.85d); autoPriorityValues.put("tertiary_link", 0.85d); autoPriorityValues.put("residential", 0.7d); @@ -121,6 +121,13 @@ public class CarRouter extends VehicleRouter { TagValuePair pair = road.getTagValue(0); boolean highway = "highway".equals(pair.tag); double priority = highway && autoPriorityValues.containsKey(pair.value) ? autoPriorityValues.get(pair.value) : 0.5d; + // keep it in boundaries otherwise + // (it will use first founded exist for trunk even if it in another city and make Uturn there) + if(priority > 1.4){ + return 1.4d; + } else if(priority < 0.5d) { + return 0.5d; + } return priority; }; diff --git a/DataExtractionOSM/src/net/osmand/swing/OsmExtractionPreferencesDialog.java b/DataExtractionOSM/src/net/osmand/swing/OsmExtractionPreferencesDialog.java index 26fd3bbaf7..9c3177dd7d 100644 --- a/DataExtractionOSM/src/net/osmand/swing/OsmExtractionPreferencesDialog.java +++ b/DataExtractionOSM/src/net/osmand/swing/OsmExtractionPreferencesDialog.java @@ -102,7 +102,7 @@ public class OsmExtractionPreferencesDialog extends JDialog { constr.anchor = GridBagConstraints.WEST; l.setConstraints(useInternet, constr); - JLabel label = new JLabel("Path to obf file (test routing purpose) : "); + JLabel label = new JLabel("Path to obf files (test routing, comma separated) : "); panel.add(label); constr = new GridBagConstraints(); constr.ipadx = 5;