From 3d87b2051a9819cd1fdbb58450d30f1efe4860d2 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 30 Oct 2010 09:23:51 +0000 Subject: [PATCH] fix issues git-svn-id: https://osmand.googlecode.com/svn/trunk@612 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8 --- .../src/net/osmand/binary/BinaryMapIndexWriter.java | 12 ++++++------ DataExtractionOSM/src/osmand_odb.proto | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/DataExtractionOSM/src/net/osmand/binary/BinaryMapIndexWriter.java b/DataExtractionOSM/src/net/osmand/binary/BinaryMapIndexWriter.java index 778c21ba54..887290c368 100644 --- a/DataExtractionOSM/src/net/osmand/binary/BinaryMapIndexWriter.java +++ b/DataExtractionOSM/src/net/osmand/binary/BinaryMapIndexWriter.java @@ -192,8 +192,8 @@ public class BinaryMapIndexWriter { public static int STRING_TABLE_SIZE = 0; - protected static int codeCoordinateDifference(int diff){ - return diff >> SHIFT_COORDINATES; + protected static int codeCoordinateDifference(int x, int px){ + return (x >> SHIFT_COORDINATES) - (px >> SHIFT_COORDINATES); } @@ -215,8 +215,8 @@ public class BinaryMapIndexWriter { for(int i=0; i< nodes.length / 8; i++){ int x = Algoritms.parseIntFromBytes(nodes, i * 8); int y = Algoritms.parseIntFromBytes(nodes, i * 8 + 4); - sizeCoordinates += CodedOutputStream.computeSInt32SizeNoTag(codeCoordinateDifference(x - px)); - sizeCoordinates += CodedOutputStream.computeSInt32SizeNoTag(codeCoordinateDifference(y - py)); + sizeCoordinates += CodedOutputStream.computeSInt32SizeNoTag(codeCoordinateDifference(x, px)); + sizeCoordinates += CodedOutputStream.computeSInt32SizeNoTag(codeCoordinateDifference(y, py)); px = x; py = y; COORDINATES_COUNT += 2; @@ -287,8 +287,8 @@ public class BinaryMapIndexWriter { for (int i = 0; i < nodes.length / 8; i++) { int x = Algoritms.parseIntFromBytes(nodes, i * 8); int y = Algoritms.parseIntFromBytes(nodes, i * 8 + 4); - codedOutStream.writeSInt32NoTag(codeCoordinateDifference(x - px)); - codedOutStream.writeSInt32NoTag(codeCoordinateDifference(y - py)); + codedOutStream.writeSInt32NoTag(codeCoordinateDifference(x, px)); + codedOutStream.writeSInt32NoTag(codeCoordinateDifference(y, py)); px = x; py = y; } diff --git a/DataExtractionOSM/src/osmand_odb.proto b/DataExtractionOSM/src/osmand_odb.proto index 448a893969..1d3278aa40 100644 --- a/DataExtractionOSM/src/osmand_odb.proto +++ b/DataExtractionOSM/src/osmand_odb.proto @@ -59,7 +59,7 @@ message StringTable { /// Simple messages message MapData { - required bytes coordinates = 1; // array of delta x,y sint32 could be read by codedinputstream + required bytes coordinates = 1; // array of delta x,y sint32 (CodedIinputStream) >> 5 // first x delta to Tree.left, y to delta Tree.top (next delta to previous) required bytes types = 2; // array of fixed int16