Fix binary writer

This commit is contained in:
Victor Shcherb 2012-05-29 18:35:16 +02:00
parent c2f91aac3a
commit 56aaffd57f

View file

@ -353,7 +353,8 @@ public class BinaryMapIndexWriter {
private TByteArrayList mapDataBuf = new TByteArrayList();
public MapData writeMapData(long diffId, int pleft, int ptop, boolean area, byte[] coordinates, byte[] innerPolygonTypes, int[] typeUse,
int[] addtypeUse, Map<MapRulType, String> names, Map<String, Integer> stringTable, MapDataBlock.Builder dataBlock)
int[] addtypeUse, Map<MapRulType, String> names, Map<String, Integer> stringTable, MapDataBlock.Builder dataBlock,
boolean allowCoordinateSimplification)
throws IOException {
MapData.Builder data = MapData.newBuilder();
@ -372,8 +373,11 @@ public class BinaryMapIndexWriter {
writeRawVarint32(mapDataBuf, CodedOutputStream.encodeZigZag32(ty));
pcalcx = pcalcx + tx ;
pcalcy = pcalcy + ty ;
delta = 1;
if (allowCoordinateSimplification) {
delta = skipSomeNodes(coordinates, len, i, x, y, false);
}
}
COORDINATES_SIZE += CodedOutputStream.computeRawVarint32Size(mapDataBuf.size())
+ CodedOutputStream.computeTagSize(MapData.COORDINATES_FIELD_NUMBER) + mapDataBuf.size();
if (area) {
@ -406,7 +410,10 @@ public class BinaryMapIndexWriter {
pcalcx = pcalcx + tx ;
pcalcy = pcalcy + ty ;
delta = skipSomeNodes(innerPolygonTypes, len, i, x, y ,true);
delta = 1;
if (allowCoordinateSimplification) {
delta = skipSomeNodes(innerPolygonTypes, len, i, x, y, true);
}
}
}
}