diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RouteSegmentResult.java b/OsmAnd-java/src/main/java/net/osmand/router/RouteSegmentResult.java index 6f8de67353..c57fdc8f1c 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RouteSegmentResult.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RouteSegmentResult.java @@ -315,7 +315,7 @@ public class RouteSegmentResult implements StringExternalizable int[] turnLanes = TurnType.lanesFromString(bundle.getString("turnLanes", null)); turnType.setLanes(turnLanes); } - object.id = bundle.getLong("id", object.id); + object.id = bundle.getLong("id", object.id) << 6; object.types = bundle.getIntArray("types", null); object.pointTypes = bundle.getIntIntArray("pointTypes", null); object.nameIds = bundle.getIntArray("names", null); diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java index 996ec6c092..160a5687ff 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java @@ -523,15 +523,15 @@ public class MeasurementEditingContext { public void splitPoints(int selectedPointPosition, boolean after) { int pointIndex = after ? selectedPointPosition : selectedPointPosition - 1; - if (pointIndex >= 0 && pointIndex < before.points.size()) { + if (pointIndex >= 0 && pointIndex + 1 < before.points.size()) { WptPt point = before.points.get(pointIndex); - WptPt newPoint = new WptPt(); - newPoint.lat = point.lat; - newPoint.lon = point.lon; + WptPt nextPoint = before.points.get(pointIndex + 1); + WptPt newPoint = new WptPt(point); newPoint.copyExtensions(point); newPoint.setGap(); before.points.remove(pointIndex); before.points.add(pointIndex, newPoint); + roadSegmentData.remove(new Pair<>(point, nextPoint)); updateSegmentsForSnap(false); } } @@ -549,9 +549,7 @@ public class MeasurementEditingContext { gapIndex = selectedPointPosition; } if (gapPoint != null) { - WptPt newPoint = new WptPt(); - newPoint.lat = gapPoint.lat; - newPoint.lon = gapPoint.lon; + WptPt newPoint = new WptPt(gapPoint); newPoint.copyExtensions(gapPoint); newPoint.removeProfileType(); before.points.remove(gapIndex); @@ -786,7 +784,7 @@ public class MeasurementEditingContext { pairPoints.add(points.get(j)); prevPointIndex = j; } - if (points.size() > prevPointIndex + 1) { + if (points.size() > prevPointIndex + 1 && i == routePoints.size() - 2) { pairPoints.add(points.get(prevPointIndex + 1)); } Iterator it = routeSegments.iterator();