diff --git a/DataExtractionOSM/src/net/osmand/binary/BinaryInspector.java b/DataExtractionOSM/src/net/osmand/binary/BinaryInspector.java index 42f9d3b3fe..d3ccda897b 100644 --- a/DataExtractionOSM/src/net/osmand/binary/BinaryInspector.java +++ b/DataExtractionOSM/src/net/osmand/binary/BinaryInspector.java @@ -49,7 +49,7 @@ public class BinaryInspector { // test cases show info -// inspector(new String[]{/*"-vmap", "-bbox=-121.785,37.35,-121.744,37.33", */"/home/victor/projects/OsmAnd/data/osm-gen/Belarus_europe_2.obf/Belarus_europe_2_new.obf"}); +// inspector(new String[]{/*"-vmap", "-bbox=-121.785,37.35,-121.744,37.33", */"/home/victor/projects/OsmAnd/data/osm-gen/Map.obf"}); // test case extract parts // test case } diff --git a/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java b/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java index 9499795d97..2d7085e603 100644 --- a/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java +++ b/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java @@ -730,11 +730,11 @@ public class IndexCreator { public static void main(String[] args) throws IOException, SAXException, SQLException, InterruptedException { long time = System.currentTimeMillis(); IndexCreator creator = new IndexCreator(new File("/home/victor/projects/OsmAnd/data/osm-gen/")); //$NON-NLS-1$ - creator.setIndexMap(true); - creator.setIndexAddress(true); + creator.setIndexMap(false); + creator.setIndexAddress(false); creator.setIndexPOI(true); - creator.setIndexTransport(true); - creator.setIndexRouting(true); + creator.setIndexTransport(false); + creator.setIndexRouting(false); // creator.deleteDatabaseIndexes = false; // creator.recreateOnlyBinaryFile = true; diff --git a/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java b/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java index 600136c534..dd0eb5b244 100644 --- a/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java +++ b/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java @@ -869,6 +869,7 @@ public class BinaryRoutePlanner { additional.append("distance = \"").append(res.getDistance()).append("\" "); if (res.getTurnType() != null) { additional.append("turn = \"").append(res.getTurnType()).append("\" "); + additional.append("turn_angle = \"").append(res.getTurnType().getTurnAngle()).append("\" "); if (res.getTurnType().getLanes() != null) { additional.append("lanes = \"").append(Arrays.toString(res.getTurnType().getLanes())).append("\" "); } @@ -901,10 +902,10 @@ public class BinaryRoutePlanner { if(tl || tr) { TurnType tnext = getTurnInfo(result, i + 1, leftside); if(tnext != null && result.get(i).getDistance() < 55) { - if(tl && TurnType.TL.equals(t.getValue()) ) { + if(tl && TurnType.TL.equals(tnext.getValue()) ) { next = i + 2; t = TurnType.valueOf(TurnType.TU, true); - } else if(tr && TurnType.TR.equals(t.getValue()) ) { + } else if(tr && TurnType.TR.equals(tnext.getValue()) ) { next = i + 2; t = TurnType.valueOf(TurnType.TU, false); } @@ -996,8 +997,8 @@ public class BinaryRoutePlanner { RouteSegmentResult last = rr; for (int j = i; j < result.size(); j++) { RouteSegmentResult rnext = result.get(j); + last = rnext; if (rnext.getObject().roundabout()) { - last = rnext; boolean plus = rnext.getStartPointIndex() < rnext.getEndPointIndex(); int k = rnext.getStartPointIndex(); if (j == i) { @@ -1015,7 +1016,7 @@ public class BinaryRoutePlanner { } // combine all roundabouts TurnType t = TurnType.valueOf("EXIT"+exit, leftSide); - t.setTurnAngle((float) MapUtils.degreesDiff(last.getBearingBegin(), prev.getBearingEnd())); + t.setTurnAngle((float) MapUtils.degreesDiff(last.getBearingBegin(), prev.getBearingEnd())) ; return t; } diff --git a/DataExtractionOSM/src/net/osmand/router/TurnType.java b/DataExtractionOSM/src/net/osmand/router/TurnType.java index 27190729da..42b8b05674 100644 --- a/DataExtractionOSM/src/net/osmand/router/TurnType.java +++ b/DataExtractionOSM/src/net/osmand/router/TurnType.java @@ -32,7 +32,7 @@ public class TurnType { private final String value; private int exitOut; private boolean isLeftSide; - // calculated CW head rotation if previous direction to NORTH + // calculated clockwise head rotation if previous direction to NORTH private float turnAngle; private boolean skipToSpeak; private int[] lanes; @@ -49,7 +49,7 @@ public class TurnType { this.isLeftSide = leftSide; } - // calculated CW head rotation if previous direction to NORTH + // calculated Clockwise head rotation if previous direction to NORTH public float getTurnAngle() { return turnAngle; } diff --git a/DataExtractionOSM/src/net/osmand/swing/MapRouterLayer.java b/DataExtractionOSM/src/net/osmand/swing/MapRouterLayer.java index 5c0c4a19ac..fa38442785 100644 --- a/DataExtractionOSM/src/net/osmand/swing/MapRouterLayer.java +++ b/DataExtractionOSM/src/net/osmand/swing/MapRouterLayer.java @@ -262,6 +262,18 @@ public class MapRouterLayer implements MapPanelLayer { } }; menu.add(route_CloudMate); + Action swapLocations = new AbstractAction("Swap locations") { + private static final long serialVersionUID = 507156107455281238L; + + @Override + public void actionPerformed(ActionEvent e) { + LatLon l = endRoute; + endRoute = startRoute; + startRoute = l; + map.repaint(); + } + }; + menu.add(swapLocations); } @@ -674,6 +686,9 @@ public class MapRouterLayer implements MapPanelLayer { Way way = new Way(-1); // String name = String.format("time %.2f ", s.getSegmentTime()); String name = s.getDescription(); + if(s.getTurnType() != null) { + name += " (TA " + s.getTurnType().getTurnAngle() + ") "; + } // String name = String.format("beg %.2f end %.2f ", s.getBearingBegin(), s.getBearingEnd()); way.putTag(OSMTagKey.NAME.getValue(),name); boolean plus = s.getStartPointIndex() < s.getEndPointIndex();