fix issues

git-svn-id: https://osmand.googlecode.com/svn/trunk@612 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-10-30 09:23:51 +00:00
parent 593b697f7d
commit 3d87b2051a
2 changed files with 7 additions and 7 deletions

View file

@ -192,8 +192,8 @@ public class BinaryMapIndexWriter {
public static int STRING_TABLE_SIZE = 0; public static int STRING_TABLE_SIZE = 0;
protected static int codeCoordinateDifference(int diff){ protected static int codeCoordinateDifference(int x, int px){
return diff >> SHIFT_COORDINATES; return (x >> SHIFT_COORDINATES) - (px >> SHIFT_COORDINATES);
} }
@ -215,8 +215,8 @@ public class BinaryMapIndexWriter {
for(int i=0; i< nodes.length / 8; i++){ for(int i=0; i< nodes.length / 8; i++){
int x = Algoritms.parseIntFromBytes(nodes, i * 8); int x = Algoritms.parseIntFromBytes(nodes, i * 8);
int y = Algoritms.parseIntFromBytes(nodes, i * 8 + 4); int y = Algoritms.parseIntFromBytes(nodes, i * 8 + 4);
sizeCoordinates += CodedOutputStream.computeSInt32SizeNoTag(codeCoordinateDifference(x - px)); sizeCoordinates += CodedOutputStream.computeSInt32SizeNoTag(codeCoordinateDifference(x, px));
sizeCoordinates += CodedOutputStream.computeSInt32SizeNoTag(codeCoordinateDifference(y - py)); sizeCoordinates += CodedOutputStream.computeSInt32SizeNoTag(codeCoordinateDifference(y, py));
px = x; px = x;
py = y; py = y;
COORDINATES_COUNT += 2; COORDINATES_COUNT += 2;
@ -287,8 +287,8 @@ public class BinaryMapIndexWriter {
for (int i = 0; i < nodes.length / 8; i++) { for (int i = 0; i < nodes.length / 8; i++) {
int x = Algoritms.parseIntFromBytes(nodes, i * 8); int x = Algoritms.parseIntFromBytes(nodes, i * 8);
int y = Algoritms.parseIntFromBytes(nodes, i * 8 + 4); int y = Algoritms.parseIntFromBytes(nodes, i * 8 + 4);
codedOutStream.writeSInt32NoTag(codeCoordinateDifference(x - px)); codedOutStream.writeSInt32NoTag(codeCoordinateDifference(x, px));
codedOutStream.writeSInt32NoTag(codeCoordinateDifference(y - py)); codedOutStream.writeSInt32NoTag(codeCoordinateDifference(y, py));
px = x; px = x;
py = y; py = y;
} }

View file

@ -59,7 +59,7 @@ message StringTable {
/// Simple messages /// Simple messages
message MapData { 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) // first x delta to Tree.left, y to delta Tree.top (next delta to previous)
required bytes types = 2; // array of fixed int16 required bytes types = 2; // array of fixed int16