Implement precision result from 26 zoom

This commit is contained in:
ivanPyrohivskyi 2021-02-12 12:30:37 +02:00
parent eb3ecabf53
commit d51683778d
2 changed files with 284 additions and 28 deletions

View file

@ -714,6 +714,10 @@ public class BinaryMapPoiReaderAdapter {
Amenity am = null;
int x = 0;
int y = 0;
int preciseX = 0;
int preciseY = 0;
boolean isPrecised = false;
boolean hasLocation = false;
StringBuilder retValue = new StringBuilder();
PoiCategory amenityType = null;
LinkedList<String> textTags = null;
@ -740,6 +744,13 @@ public class BinaryMapPoiReaderAdapter {
am.setRoutePoint(arp);
}
}
if (hasLocation) {
if (isPrecised) {
am.setLocation(MapUtils.get31LatitudeY(preciseY), MapUtils.get31LongitudeX(preciseX));
} else {
am.setLocation(MapUtils.get31LatitudeY(y), MapUtils.get31LongitudeX(x));
}
}
return am;
case OsmandOdb.OsmAndPoiBoxDataAtom.DX_FIELD_NUMBER:
x = (codedIS.readSInt32() + (px << (24 - zoom))) << 7;
@ -754,7 +765,8 @@ public class BinaryMapPoiReaderAdapter {
}
}
am = new Amenity();
am.setLocation(MapUtils.get31LatitudeY(y), MapUtils.get31LongitudeX(x));
hasLocation = true;
//am.setLocation(MapUtils.get31LatitudeY(y), MapUtils.get31LongitudeX(x)); // set precise coordinates
break;
case OsmandOdb.OsmAndPoiBoxDataAtom.SUBCATEGORIES_FIELD_NUMBER:
int subtypev = codedIS.readUInt32();
@ -827,6 +839,23 @@ public class BinaryMapPoiReaderAdapter {
case OsmandOdb.OsmAndPoiBoxDataAtom.NOTE_FIELD_NUMBER:
am.setDescription(codedIS.readString());
break;
case OsmandOdb.OsmAndPoiBoxDataAtom.PRECISEDX_FIELD_NUMBER:
if (hasLocation) {
preciseX = codedIS.readSInt32() + x;
}
break;
case OsmandOdb.OsmAndPoiBoxDataAtom.PRECISEDY_FIELD_NUMBER:
if (hasLocation) {
preciseY = codedIS.readSInt32() + y;
if (checkBounds) {
if (left31 > preciseX || right31 < preciseX || top31 > preciseY || bottom31 < preciseY) {
codedIS.skipRawBytes(codedIS.getBytesUntilLimit());
return null;
}
}
isPrecised = true;
}
break;
default:
skipUnknownField(t);
break;

View file

@ -54371,6 +54371,42 @@ public final class OsmandOdb {
*/
com.google.protobuf.ByteString
getTextValuesBytes(int index);
// optional sint32 preciseDx = 16;
/**
* <code>optional sint32 preciseDx = 16;</code>
*
* <pre>
* diff between deltas of 28 and 24 zooms
* </pre>
*/
boolean hasPreciseDx();
/**
* <code>optional sint32 preciseDx = 16;</code>
*
* <pre>
* diff between deltas of 28 and 24 zooms
* </pre>
*/
int getPreciseDx();
// optional sint32 preciseDy = 17;
/**
* <code>optional sint32 preciseDy = 17;</code>
*
* <pre>
* diff between deltas of 28 and 24 zooms
* </pre>
*/
boolean hasPreciseDy();
/**
* <code>optional sint32 preciseDy = 17;</code>
*
* <pre>
* diff between deltas of 28 and 24 zooms
* </pre>
*/
int getPreciseDy();
}
/**
* Protobuf type {@code OsmAnd.OBF.OsmAndPoiBoxDataAtom}
@ -54539,6 +54575,16 @@ public final class OsmandOdb {
textValues_.add(input.readBytes());
break;
}
case 128: {
bitField0_ |= 0x00000200;
preciseDx_ = input.readSInt32();
break;
}
case 136: {
bitField0_ |= 0x00000400;
preciseDy_ = input.readSInt32();
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
@ -55048,6 +55094,54 @@ public final class OsmandOdb {
return textValues_.getByteString(index);
}
// optional sint32 preciseDx = 16;
public static final int PRECISEDX_FIELD_NUMBER = 16;
private int preciseDx_;
/**
* <code>optional sint32 preciseDx = 16;</code>
*
* <pre>
* diff between deltas of 28 and 24 zooms
* </pre>
*/
public boolean hasPreciseDx() {
return ((bitField0_ & 0x00000200) == 0x00000200);
}
/**
* <code>optional sint32 preciseDx = 16;</code>
*
* <pre>
* diff between deltas of 28 and 24 zooms
* </pre>
*/
public int getPreciseDx() {
return preciseDx_;
}
// optional sint32 preciseDy = 17;
public static final int PRECISEDY_FIELD_NUMBER = 17;
private int preciseDy_;
/**
* <code>optional sint32 preciseDy = 17;</code>
*
* <pre>
* diff between deltas of 28 and 24 zooms
* </pre>
*/
public boolean hasPreciseDy() {
return ((bitField0_ & 0x00000400) == 0x00000400);
}
/**
* <code>optional sint32 preciseDy = 17;</code>
*
* <pre>
* diff between deltas of 28 and 24 zooms
* </pre>
*/
public int getPreciseDy() {
return preciseDy_;
}
private void initFields() {
dx_ = 0;
dy_ = 0;
@ -55062,6 +55156,8 @@ public final class OsmandOdb {
note_ = "";
textCategories_ = java.util.Collections.emptyList();
textValues_ = com.google.protobuf.LazyStringArrayList.EMPTY;
preciseDx_ = 0;
preciseDy_ = 0;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@ -55122,6 +55218,12 @@ public final class OsmandOdb {
for (int i = 0; i < textValues_.size(); i++) {
output.writeBytes(15, textValues_.getByteString(i));
}
if (((bitField0_ & 0x00000200) == 0x00000200)) {
output.writeSInt32(16, preciseDx_);
}
if (((bitField0_ & 0x00000400) == 0x00000400)) {
output.writeSInt32(17, preciseDy_);
}
getUnknownFields().writeTo(output);
}
@ -55203,6 +55305,14 @@ public final class OsmandOdb {
size += dataSize;
size += 1 * getTextValuesList().size();
}
if (((bitField0_ & 0x00000200) == 0x00000200)) {
size += com.google.protobuf.CodedOutputStream
.computeSInt32Size(16, preciseDx_);
}
if (((bitField0_ & 0x00000400) == 0x00000400)) {
size += com.google.protobuf.CodedOutputStream
.computeSInt32Size(17, preciseDy_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
@ -55345,6 +55455,10 @@ public final class OsmandOdb {
bitField0_ = (bitField0_ & ~0x00000800);
textValues_ = com.google.protobuf.LazyStringArrayList.EMPTY;
bitField0_ = (bitField0_ & ~0x00001000);
preciseDx_ = 0;
bitField0_ = (bitField0_ & ~0x00002000);
preciseDy_ = 0;
bitField0_ = (bitField0_ & ~0x00004000);
return this;
}
@ -55430,6 +55544,14 @@ public final class OsmandOdb {
bitField0_ = (bitField0_ & ~0x00001000);
}
result.textValues_ = textValues_;
if (((from_bitField0_ & 0x00002000) == 0x00002000)) {
to_bitField0_ |= 0x00000200;
}
result.preciseDx_ = preciseDx_;
if (((from_bitField0_ & 0x00004000) == 0x00004000)) {
to_bitField0_ |= 0x00000400;
}
result.preciseDy_ = preciseDy_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
@ -55525,6 +55647,12 @@ public final class OsmandOdb {
}
onChanged();
}
if (other.hasPreciseDx()) {
setPreciseDx(other.getPreciseDx());
}
if (other.hasPreciseDy()) {
setPreciseDy(other.getPreciseDy());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
@ -56506,6 +56634,104 @@ public final class OsmandOdb {
return this;
}
// optional sint32 preciseDx = 16;
private int preciseDx_ ;
/**
* <code>optional sint32 preciseDx = 16;</code>
*
* <pre>
* diff between deltas of 28 and 24 zooms
* </pre>
*/
public boolean hasPreciseDx() {
return ((bitField0_ & 0x00002000) == 0x00002000);
}
/**
* <code>optional sint32 preciseDx = 16;</code>
*
* <pre>
* diff between deltas of 28 and 24 zooms
* </pre>
*/
public int getPreciseDx() {
return preciseDx_;
}
/**
* <code>optional sint32 preciseDx = 16;</code>
*
* <pre>
* diff between deltas of 28 and 24 zooms
* </pre>
*/
public Builder setPreciseDx(int value) {
bitField0_ |= 0x00002000;
preciseDx_ = value;
onChanged();
return this;
}
/**
* <code>optional sint32 preciseDx = 16;</code>
*
* <pre>
* diff between deltas of 28 and 24 zooms
* </pre>
*/
public Builder clearPreciseDx() {
bitField0_ = (bitField0_ & ~0x00002000);
preciseDx_ = 0;
onChanged();
return this;
}
// optional sint32 preciseDy = 17;
private int preciseDy_ ;
/**
* <code>optional sint32 preciseDy = 17;</code>
*
* <pre>
* diff between deltas of 28 and 24 zooms
* </pre>
*/
public boolean hasPreciseDy() {
return ((bitField0_ & 0x00004000) == 0x00004000);
}
/**
* <code>optional sint32 preciseDy = 17;</code>
*
* <pre>
* diff between deltas of 28 and 24 zooms
* </pre>
*/
public int getPreciseDy() {
return preciseDy_;
}
/**
* <code>optional sint32 preciseDy = 17;</code>
*
* <pre>
* diff between deltas of 28 and 24 zooms
* </pre>
*/
public Builder setPreciseDy(int value) {
bitField0_ |= 0x00004000;
preciseDy_ = value;
onChanged();
return this;
}
/**
* <code>optional sint32 preciseDy = 17;</code>
*
* <pre>
* diff between deltas of 28 and 24 zooms
* </pre>
*/
public Builder clearPreciseDy() {
bitField0_ = (bitField0_ & ~0x00004000);
preciseDy_ = 0;
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:OsmAnd.OBF.OsmAndPoiBoxDataAtom)
}
@ -65008,37 +65234,38 @@ public final class OsmandOdb {
"tegories\030\003 \003(\r\022\025\n\rsubcategories\030\005 \003(\r\"i\n" +
"\020OsmAndPoiBoxData\022\014\n\004zoom\030\001 \001(\r\022\t\n\001x\030\002 \001" +
"(\r\022\t\n\001y\030\003 \001(\r\0221\n\007poiData\030\005 \003(\0132 .OsmAnd." +
"OBF.OsmAndPoiBoxDataAtom\"\360\001\n\024OsmAndPoiBo",
"OBF.OsmAndPoiBoxDataAtom\"\226\002\n\024OsmAndPoiBo",
"xDataAtom\022\n\n\002dx\030\002 \002(\021\022\n\n\002dy\030\003 \002(\021\022\022\n\ncat" +
"egories\030\004 \003(\r\022\025\n\rsubcategories\030\005 \003(\r\022\014\n\004" +
"name\030\006 \001(\t\022\016\n\006nameEn\030\007 \001(\t\022\n\n\002id\030\010 \001(\004\022\024" +
"\n\014openingHours\030\n \001(\t\022\014\n\004site\030\013 \001(\t\022\r\n\005ph" +
"one\030\014 \001(\t\022\014\n\004note\030\r \001(\t\022\026\n\016textCategorie" +
"s\030\016 \003(\r\022\022\n\ntextValues\030\017 \003(\t\"\032\n\007IdTable\022\017" +
"\n\007routeId\030\001 \003(\022\"F\n\017RestrictionData\022\014\n\004ty" +
"pe\030\001 \002(\005\022\014\n\004from\030\002 \002(\005\022\n\n\002to\030\003 \002(\005\022\013\n\003vi" +
"a\030\004 \001(\005\"x\n\tRouteData\022\016\n\006points\030\001 \002(\014\022\022\n\n" +
"pointTypes\030\004 \001(\014\022\022\n\npointNames\030\005 \001(\014\022\r\n\005",
"types\030\007 \002(\014\022\017\n\007routeId\030\014 \002(\005\022\023\n\013stringNa" +
"mes\030\016 \001(\014\"\304\005\n\022OsmAndRoutingIndex\022\014\n\004name" +
"\030\001 \002(\t\022?\n\005rules\030\002 \003(\01320.OsmAnd.OBF.OsmAn" +
"dRoutingIndex.RouteEncodingRule\022>\n\trootB" +
"oxes\030\003 \003(\0132+.OsmAnd.OBF.OsmAndRoutingInd" +
"ex.RouteDataBox\022A\n\014basemapBoxes\030\004 \003(\0132+." +
"OsmAnd.OBF.OsmAndRoutingIndex.RouteDataB" +
"ox\022=\n\006blocks\030\005 \003(\0132-.OsmAnd.OBF.OsmAndRo" +
"utingIndex.RouteDataBlock\032;\n\021RouteEncodi" +
"ngRule\022\013\n\003tag\030\003 \002(\t\022\r\n\005value\030\005 \002(\t\022\n\n\002id",
"\030\007 \001(\r\032\231\001\n\014RouteDataBox\022\014\n\004left\030\001 \002(\021\022\r\n" +
"\005right\030\002 \002(\021\022\013\n\003top\030\003 \002(\021\022\016\n\006bottom\030\004 \002(" +
"\021\022\023\n\013shiftToData\030\005 \001(\007\022:\n\005boxes\030\007 \003(\0132+." +
"OsmAnd.OBF.OsmAndRoutingIndex.RouteDataB" +
"ox\032\303\001\n\016RouteDataBlock\022$\n\007idTable\030\005 \001(\0132\023" +
".OsmAnd.OBF.IdTable\022*\n\013dataObjects\030\006 \003(\013" +
"2\025.OsmAnd.OBF.RouteData\0221\n\014restrictions\030" +
"\007 \003(\0132\033.OsmAnd.OBF.RestrictionData\022,\n\013st" +
"ringTable\030\010 \001(\0132\027.OsmAnd.OBF.StringTable" +
"B\036\n\021net.osmand.binaryB\tOsmandOdb"
"s\030\016 \003(\r\022\022\n\ntextValues\030\017 \003(\t\022\021\n\tpreciseDx" +
"\030\020 \001(\021\022\021\n\tpreciseDy\030\021 \001(\021\"\032\n\007IdTable\022\017\n\007" +
"routeId\030\001 \003(\022\"F\n\017RestrictionData\022\014\n\004type" +
"\030\001 \002(\005\022\014\n\004from\030\002 \002(\005\022\n\n\002to\030\003 \002(\005\022\013\n\003via\030" +
"\004 \001(\005\"x\n\tRouteData\022\016\n\006points\030\001 \002(\014\022\022\n\npo",
"intTypes\030\004 \001(\014\022\022\n\npointNames\030\005 \001(\014\022\r\n\005ty" +
"pes\030\007 \002(\014\022\017\n\007routeId\030\014 \002(\005\022\023\n\013stringName" +
"s\030\016 \001(\014\"\304\005\n\022OsmAndRoutingIndex\022\014\n\004name\030\001" +
" \002(\t\022?\n\005rules\030\002 \003(\01320.OsmAnd.OBF.OsmAndR" +
"outingIndex.RouteEncodingRule\022>\n\trootBox" +
"es\030\003 \003(\0132+.OsmAnd.OBF.OsmAndRoutingIndex" +
".RouteDataBox\022A\n\014basemapBoxes\030\004 \003(\0132+.Os" +
"mAnd.OBF.OsmAndRoutingIndex.RouteDataBox" +
"\022=\n\006blocks\030\005 \003(\0132-.OsmAnd.OBF.OsmAndRout" +
"ingIndex.RouteDataBlock\032;\n\021RouteEncoding",
"Rule\022\013\n\003tag\030\003 \002(\t\022\r\n\005value\030\005 \002(\t\022\n\n\002id\030\007" +
" \001(\r\032\231\001\n\014RouteDataBox\022\014\n\004left\030\001 \002(\021\022\r\n\005r" +
"ight\030\002 \002(\021\022\013\n\003top\030\003 \002(\021\022\016\n\006bottom\030\004 \002(\021\022" +
"\023\n\013shiftToData\030\005 \001(\007\022:\n\005boxes\030\007 \003(\0132+.Os" +
"mAnd.OBF.OsmAndRoutingIndex.RouteDataBox" +
"\032\303\001\n\016RouteDataBlock\022$\n\007idTable\030\005 \001(\0132\023.O" +
"smAnd.OBF.IdTable\022*\n\013dataObjects\030\006 \003(\0132\025" +
".OsmAnd.OBF.RouteData\0221\n\014restrictions\030\007 " +
"\003(\0132\033.OsmAnd.OBF.RestrictionData\022,\n\013stri" +
"ngTable\030\010 \001(\0132\027.OsmAnd.OBF.StringTableB\036",
"\n\021net.osmand.binaryB\tOsmandOdb"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@ -65296,7 +65523,7 @@ public final class OsmandOdb {
internal_static_OsmAnd_OBF_OsmAndPoiBoxDataAtom_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_OsmAnd_OBF_OsmAndPoiBoxDataAtom_descriptor,
new java.lang.String[] { "Dx", "Dy", "Categories", "Subcategories", "Name", "NameEn", "Id", "OpeningHours", "Site", "Phone", "Note", "TextCategories", "TextValues", });
new java.lang.String[] { "Dx", "Dy", "Categories", "Subcategories", "Name", "NameEn", "Id", "OpeningHours", "Site", "Phone", "Note", "TextCategories", "TextValues", "PreciseDx", "PreciseDy", });
internal_static_OsmAnd_OBF_IdTable_descriptor =
getDescriptor().getMessageTypes().get(36);
internal_static_OsmAnd_OBF_IdTable_fieldAccessorTable = new