Update transport stops

This commit is contained in:
Victor Shcherb 2016-07-29 02:42:03 +02:00
parent fababf068b
commit 6de8e70a68
5 changed files with 278 additions and 88 deletions

View file

@ -2039,7 +2039,7 @@ public class BinaryMapIndexReader {
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
File fl = new File(System.getProperty("maps") + "/Synthetic_test_rendering.obf"); File fl = new File(System.getProperty("maps") + "/Synthetic_test_rendering.obf");
fl = new File(System.getProperty("maps") + "/Netherlands_noord-holland_europe.obf"); fl = new File(System.getProperty("maps") + "/Map.obf");
RandomAccessFile raf = new RandomAccessFile(fl, "r"); RandomAccessFile raf = new RandomAccessFile(fl, "r");
@ -2228,6 +2228,11 @@ public class BinaryMapIndexReader {
for (net.osmand.data.TransportRoute route : routes.valueCollection()) { for (net.osmand.data.TransportRoute route : routes.valueCollection()) {
println(" " + route.getRef() + " " + route.getName() + " " + route.getDistance() + " " println(" " + route.getRef() + " " + route.getName() + " " + route.getDistance() + " "
+ route.getAvgBothDistance()); + route.getAvgBothDistance());
StringBuilder b = new StringBuilder();
for(Way w : route.getForwardWays()) {
b.append(w.getNodes()).append(" ");
}
println(" forward ways: " + b.toString());
} }
} }
} }

View file

@ -4,11 +4,14 @@ import gnu.trove.list.array.TIntArrayList;
import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.map.hash.TIntObjectHashMap;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import net.osmand.binary.BinaryMapIndexReader.SearchRequest; import net.osmand.binary.BinaryMapIndexReader.SearchRequest;
import net.osmand.data.TransportStop; import net.osmand.data.TransportStop;
import net.osmand.osm.edit.Node;
import net.osmand.osm.edit.Way;
import net.osmand.util.MapUtils; import net.osmand.util.MapUtils;
import net.sf.junidecode.Junidecode; import net.sf.junidecode.Junidecode;
@ -276,6 +279,37 @@ public class BinaryMapTransportReaderAdapter {
case OsmandOdb.TransportRoute.OPERATOR_FIELD_NUMBER: case OsmandOdb.TransportRoute.OPERATOR_FIELD_NUMBER:
dataObject.setOperator(regStr(stringTable)); //$NON-NLS-1$ dataObject.setOperator(regStr(stringTable)); //$NON-NLS-1$
break; break;
case OsmandOdb.TransportRoute.DIRECTGEOMETRY_FIELD_NUMBER:
case OsmandOdb.TransportRoute.REVERSEGEOMETRY_FIELD_NUMBER:
case OsmandOdb.TransportRoute.SHAREDGEOMETRY_FIELD_NUMBER:
int dir = tag == OsmandOdb.TransportRoute.SHAREDGEOMETRY_FIELD_NUMBER ? 0 : (
tag == OsmandOdb.TransportRoute.DIRECTGEOMETRY_FIELD_NUMBER ? 1 : -1);
int sizeL = codedIS.readRawVarint32();
int pold = codedIS.pushLimit(sizeL);
int px = 0;
int py = 0;
Way w = new Way(-1);
while (codedIS.getBytesUntilLimit() > 0) {
int ddx = (codedIS.readSInt32() << BinaryMapIndexReader.SHIFT_COORDINATES);
int ddy = (codedIS.readSInt32() << BinaryMapIndexReader.SHIFT_COORDINATES);
if(ddx == 0 && ddy == 0) {
if(w.getNodes().size() > 0) {
dataObject.addWay(w, dir);
}
w = new Way(-1);
} else {
int x = ddx + px;
int y = ddy + py;
w.addNode(new Node(MapUtils.get31LatitudeY(y), MapUtils.get31LongitudeX(x), -1));
px = x;
py = y;
}
}
if(w.getNodes().size() > 0) {
dataObject.addWay(w, dir );
}
codedIS.popLimit(pold);
break;
case OsmandOdb.TransportRoute.REVERSESTOPS_FIELD_NUMBER: case OsmandOdb.TransportRoute.REVERSESTOPS_FIELD_NUMBER:
if(onlyDescription){ if(onlyDescription){
end = true; end = true;

View file

@ -29403,6 +29403,7 @@ public final class OsmandOdb {
* array of delta x,y sint32 (CodedIinputStream) &gt;&gt; 5 (precision 31 &gt;&gt; 5) * array of delta x,y sint32 (CodedIinputStream) &gt;&gt; 5 (precision 31 &gt;&gt; 5)
* first x,y - 31 coordinates (&gt;&gt;5), next points is delta to previous * first x,y - 31 coordinates (&gt;&gt;5), next points is delta to previous
* point, line or outer polygon coordinates * point, line or outer polygon coordinates
* 0, 0 split geometry (for not connected segments)
* </pre> * </pre>
*/ */
boolean hasDirectGeometry(); boolean hasDirectGeometry();
@ -29413,6 +29414,7 @@ public final class OsmandOdb {
* array of delta x,y sint32 (CodedIinputStream) &gt;&gt; 5 (precision 31 &gt;&gt; 5) * array of delta x,y sint32 (CodedIinputStream) &gt;&gt; 5 (precision 31 &gt;&gt; 5)
* first x,y - 31 coordinates (&gt;&gt;5), next points is delta to previous * first x,y - 31 coordinates (&gt;&gt;5), next points is delta to previous
* point, line or outer polygon coordinates * point, line or outer polygon coordinates
* 0, 0 split geometry (for not connected segments)
* </pre> * </pre>
*/ */
com.google.protobuf.ByteString getDirectGeometry(); com.google.protobuf.ByteString getDirectGeometry();
@ -29426,6 +29428,16 @@ public final class OsmandOdb {
* <code>optional bytes reverseGeometry = 18;</code> * <code>optional bytes reverseGeometry = 18;</code>
*/ */
com.google.protobuf.ByteString getReverseGeometry(); com.google.protobuf.ByteString getReverseGeometry();
// optional bytes sharedGeometry = 19;
/**
* <code>optional bytes sharedGeometry = 19;</code>
*/
boolean hasSharedGeometry();
/**
* <code>optional bytes sharedGeometry = 19;</code>
*/
com.google.protobuf.ByteString getSharedGeometry();
} }
/** /**
* Protobuf type {@code OsmAnd.OBF.TransportRoute} * Protobuf type {@code OsmAnd.OBF.TransportRoute}
@ -29539,6 +29551,11 @@ public final class OsmandOdb {
reverseGeometry_ = input.readBytes(); reverseGeometry_ = input.readBytes();
break; break;
} }
case 154: {
bitField0_ |= 0x00000200;
sharedGeometry_ = input.readBytes();
break;
}
} }
} }
} catch (com.google.protobuf.InvalidProtocolBufferException e) { } catch (com.google.protobuf.InvalidProtocolBufferException e) {
@ -29846,6 +29863,7 @@ public final class OsmandOdb {
* array of delta x,y sint32 (CodedIinputStream) &gt;&gt; 5 (precision 31 &gt;&gt; 5) * array of delta x,y sint32 (CodedIinputStream) &gt;&gt; 5 (precision 31 &gt;&gt; 5)
* first x,y - 31 coordinates (&gt;&gt;5), next points is delta to previous * first x,y - 31 coordinates (&gt;&gt;5), next points is delta to previous
* point, line or outer polygon coordinates * point, line or outer polygon coordinates
* 0, 0 split geometry (for not connected segments)
* </pre> * </pre>
*/ */
public boolean hasDirectGeometry() { public boolean hasDirectGeometry() {
@ -29858,6 +29876,7 @@ public final class OsmandOdb {
* array of delta x,y sint32 (CodedIinputStream) &gt;&gt; 5 (precision 31 &gt;&gt; 5) * array of delta x,y sint32 (CodedIinputStream) &gt;&gt; 5 (precision 31 &gt;&gt; 5)
* first x,y - 31 coordinates (&gt;&gt;5), next points is delta to previous * first x,y - 31 coordinates (&gt;&gt;5), next points is delta to previous
* point, line or outer polygon coordinates * point, line or outer polygon coordinates
* 0, 0 split geometry (for not connected segments)
* </pre> * </pre>
*/ */
public com.google.protobuf.ByteString getDirectGeometry() { public com.google.protobuf.ByteString getDirectGeometry() {
@ -29880,6 +29899,22 @@ public final class OsmandOdb {
return reverseGeometry_; return reverseGeometry_;
} }
// optional bytes sharedGeometry = 19;
public static final int SHAREDGEOMETRY_FIELD_NUMBER = 19;
private com.google.protobuf.ByteString sharedGeometry_;
/**
* <code>optional bytes sharedGeometry = 19;</code>
*/
public boolean hasSharedGeometry() {
return ((bitField0_ & 0x00000200) == 0x00000200);
}
/**
* <code>optional bytes sharedGeometry = 19;</code>
*/
public com.google.protobuf.ByteString getSharedGeometry() {
return sharedGeometry_;
}
private void initFields() { private void initFields() {
id_ = 0L; id_ = 0L;
type_ = 0; type_ = 0;
@ -29892,6 +29927,7 @@ public final class OsmandOdb {
reverseStops_ = java.util.Collections.emptyList(); reverseStops_ = java.util.Collections.emptyList();
directGeometry_ = com.google.protobuf.ByteString.EMPTY; directGeometry_ = com.google.protobuf.ByteString.EMPTY;
reverseGeometry_ = com.google.protobuf.ByteString.EMPTY; reverseGeometry_ = com.google.protobuf.ByteString.EMPTY;
sharedGeometry_ = com.google.protobuf.ByteString.EMPTY;
} }
private byte memoizedIsInitialized = -1; private byte memoizedIsInitialized = -1;
public final boolean isInitialized() { public final boolean isInitialized() {
@ -29954,6 +29990,9 @@ public final class OsmandOdb {
if (((bitField0_ & 0x00000100) == 0x00000100)) { if (((bitField0_ & 0x00000100) == 0x00000100)) {
output.writeBytes(18, reverseGeometry_); output.writeBytes(18, reverseGeometry_);
} }
if (((bitField0_ & 0x00000200) == 0x00000200)) {
output.writeBytes(19, sharedGeometry_);
}
getUnknownFields().writeTo(output); getUnknownFields().writeTo(output);
} }
@ -30007,6 +30046,10 @@ public final class OsmandOdb {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeBytesSize(18, reverseGeometry_); .computeBytesSize(18, reverseGeometry_);
} }
if (((bitField0_ & 0x00000200) == 0x00000200)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(19, sharedGeometry_);
}
size += getUnknownFields().getSerializedSize(); size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size; memoizedSerializedSize = size;
return size; return size;
@ -30155,6 +30198,8 @@ public final class OsmandOdb {
bitField0_ = (bitField0_ & ~0x00000200); bitField0_ = (bitField0_ & ~0x00000200);
reverseGeometry_ = com.google.protobuf.ByteString.EMPTY; reverseGeometry_ = com.google.protobuf.ByteString.EMPTY;
bitField0_ = (bitField0_ & ~0x00000400); bitField0_ = (bitField0_ & ~0x00000400);
sharedGeometry_ = com.google.protobuf.ByteString.EMPTY;
bitField0_ = (bitField0_ & ~0x00000800);
return this; return this;
} }
@ -30237,6 +30282,10 @@ public final class OsmandOdb {
to_bitField0_ |= 0x00000100; to_bitField0_ |= 0x00000100;
} }
result.reverseGeometry_ = reverseGeometry_; result.reverseGeometry_ = reverseGeometry_;
if (((from_bitField0_ & 0x00000800) == 0x00000800)) {
to_bitField0_ |= 0x00000200;
}
result.sharedGeometry_ = sharedGeometry_;
result.bitField0_ = to_bitField0_; result.bitField0_ = to_bitField0_;
onBuilt(); onBuilt();
return result; return result;
@ -30334,6 +30383,9 @@ public final class OsmandOdb {
if (other.hasReverseGeometry()) { if (other.hasReverseGeometry()) {
setReverseGeometry(other.getReverseGeometry()); setReverseGeometry(other.getReverseGeometry());
} }
if (other.hasSharedGeometry()) {
setSharedGeometry(other.getSharedGeometry());
}
this.mergeUnknownFields(other.getUnknownFields()); this.mergeUnknownFields(other.getUnknownFields());
return this; return this;
} }
@ -31218,6 +31270,7 @@ public final class OsmandOdb {
* array of delta x,y sint32 (CodedIinputStream) &gt;&gt; 5 (precision 31 &gt;&gt; 5) * array of delta x,y sint32 (CodedIinputStream) &gt;&gt; 5 (precision 31 &gt;&gt; 5)
* first x,y - 31 coordinates (&gt;&gt;5), next points is delta to previous * first x,y - 31 coordinates (&gt;&gt;5), next points is delta to previous
* point, line or outer polygon coordinates * point, line or outer polygon coordinates
* 0, 0 split geometry (for not connected segments)
* </pre> * </pre>
*/ */
public boolean hasDirectGeometry() { public boolean hasDirectGeometry() {
@ -31230,6 +31283,7 @@ public final class OsmandOdb {
* array of delta x,y sint32 (CodedIinputStream) &gt;&gt; 5 (precision 31 &gt;&gt; 5) * array of delta x,y sint32 (CodedIinputStream) &gt;&gt; 5 (precision 31 &gt;&gt; 5)
* first x,y - 31 coordinates (&gt;&gt;5), next points is delta to previous * first x,y - 31 coordinates (&gt;&gt;5), next points is delta to previous
* point, line or outer polygon coordinates * point, line or outer polygon coordinates
* 0, 0 split geometry (for not connected segments)
* </pre> * </pre>
*/ */
public com.google.protobuf.ByteString getDirectGeometry() { public com.google.protobuf.ByteString getDirectGeometry() {
@ -31242,6 +31296,7 @@ public final class OsmandOdb {
* array of delta x,y sint32 (CodedIinputStream) &gt;&gt; 5 (precision 31 &gt;&gt; 5) * array of delta x,y sint32 (CodedIinputStream) &gt;&gt; 5 (precision 31 &gt;&gt; 5)
* first x,y - 31 coordinates (&gt;&gt;5), next points is delta to previous * first x,y - 31 coordinates (&gt;&gt;5), next points is delta to previous
* point, line or outer polygon coordinates * point, line or outer polygon coordinates
* 0, 0 split geometry (for not connected segments)
* </pre> * </pre>
*/ */
public Builder setDirectGeometry(com.google.protobuf.ByteString value) { public Builder setDirectGeometry(com.google.protobuf.ByteString value) {
@ -31260,6 +31315,7 @@ public final class OsmandOdb {
* array of delta x,y sint32 (CodedIinputStream) &gt;&gt; 5 (precision 31 &gt;&gt; 5) * array of delta x,y sint32 (CodedIinputStream) &gt;&gt; 5 (precision 31 &gt;&gt; 5)
* first x,y - 31 coordinates (&gt;&gt;5), next points is delta to previous * first x,y - 31 coordinates (&gt;&gt;5), next points is delta to previous
* point, line or outer polygon coordinates * point, line or outer polygon coordinates
* 0, 0 split geometry (for not connected segments)
* </pre> * </pre>
*/ */
public Builder clearDirectGeometry() { public Builder clearDirectGeometry() {
@ -31305,6 +31361,42 @@ public final class OsmandOdb {
return this; return this;
} }
// optional bytes sharedGeometry = 19;
private com.google.protobuf.ByteString sharedGeometry_ = com.google.protobuf.ByteString.EMPTY;
/**
* <code>optional bytes sharedGeometry = 19;</code>
*/
public boolean hasSharedGeometry() {
return ((bitField0_ & 0x00000800) == 0x00000800);
}
/**
* <code>optional bytes sharedGeometry = 19;</code>
*/
public com.google.protobuf.ByteString getSharedGeometry() {
return sharedGeometry_;
}
/**
* <code>optional bytes sharedGeometry = 19;</code>
*/
public Builder setSharedGeometry(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000800;
sharedGeometry_ = value;
onChanged();
return this;
}
/**
* <code>optional bytes sharedGeometry = 19;</code>
*/
public Builder clearSharedGeometry() {
bitField0_ = (bitField0_ & ~0x00000800);
sharedGeometry_ = getDefaultInstance().getSharedGeometry();
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:OsmAnd.OBF.TransportRoute) // @@protoc_insertion_point(builder_scope:OsmAnd.OBF.TransportRoute)
} }
@ -57904,89 +57996,90 @@ public final class OsmandOdb {
" \003(\t\022\030\n\020attributeTagIds2\030\021 \003(\r\022\030\n\020attrib" + " \003(\t\022\030\n\020attributeTagIds2\030\021 \003(\r\022\030\n\020attrib" +
"uteValues2\030\022 \003(\t\"=\n\017TransportRoutes\022*\n\006r" + "uteValues2\030\022 \003(\t\"=\n\017TransportRoutes\022*\n\006r" +
"outes\030\006 \003(\0132\032.OsmAnd.OBF.TransportRoute\"" + "outes\030\006 \003(\0132\032.OsmAnd.OBF.TransportRoute\"" +
"\226\002\n\016TransportRoute\022\n\n\002id\030\001 \002(\004\022\014\n\004type\030\003" + "\256\002\n\016TransportRoute\022\n\n\002id\030\001 \002(\004\022\014\n\004type\030\003" +
" \001(\r\022\020\n\010operator\030\004 \001(\r\022\013\n\003ref\030\005 \001(\t\022\014\n\004n" + " \001(\r\022\020\n\010operator\030\004 \001(\r\022\013\n\003ref\030\005 \001(\t\022\014\n\004n" +
"ame\030\006 \001(\r\022\017\n\007name_en\030\007 \001(\r\022\020\n\010distance\030\010" + "ame\030\006 \001(\r\022\017\n\007name_en\030\007 \001(\r\022\020\n\010distance\030\010" +
" \001(\r\0223\n\013directStops\030\017 \003(\0132\036.OsmAnd.OBF.T" + " \001(\r\0223\n\013directStops\030\017 \003(\0132\036.OsmAnd.OBF.T" +
"ransportRouteStop\0224\n\014reverseStops\030\020 \003(\0132", "ransportRouteStop\0224\n\014reverseStops\030\020 \003(\0132",
"\036.OsmAnd.OBF.TransportRouteStop\022\026\n\016direc" + "\036.OsmAnd.OBF.TransportRouteStop\022\026\n\016direc" +
"tGeometry\030\021 \001(\014\022\027\n\017reverseGeometry\030\022 \001(\014" + "tGeometry\030\021 \001(\014\022\027\n\017reverseGeometry\030\022 \001(\014" +
"\"W\n\022TransportRouteStop\022\n\n\002id\030\001 \002(\022\022\n\n\002dx" + "\022\026\n\016sharedGeometry\030\023 \001(\014\"W\n\022TransportRou" +
"\030\002 \002(\021\022\n\n\002dy\030\003 \002(\021\022\014\n\004name\030\006 \002(\r\022\017\n\007name" + "teStop\022\n\n\002id\030\001 \002(\022\022\n\n\002dx\030\002 \002(\021\022\n\n\002dy\030\003 \002" +
"_en\030\007 \001(\r\"b\n\rTransportStop\022\n\n\002dx\030\001 \002(\021\022\n" + "(\021\022\014\n\004name\030\006 \002(\r\022\017\n\007name_en\030\007 \001(\r\"b\n\rTra" +
"\n\002dy\030\002 \002(\021\022\n\n\002id\030\005 \002(\022\022\014\n\004name\030\006 \002(\r\022\017\n\007" + "nsportStop\022\n\n\002dx\030\001 \002(\021\022\n\n\002dy\030\002 \002(\021\022\n\n\002id" +
"name_en\030\007 \001(\r\022\016\n\006routes\030\020 \003(\r\"\272\001\n\022Transp" + "\030\005 \002(\022\022\014\n\004name\030\006 \002(\r\022\017\n\007name_en\030\007 \001(\r\022\016\n" +
"ortStopsTree\022\014\n\004left\030\001 \002(\021\022\r\n\005right\030\002 \002(" + "\006routes\030\020 \003(\r\"\272\001\n\022TransportStopsTree\022\014\n\004" +
"\021\022\013\n\003top\030\003 \002(\021\022\016\n\006bottom\030\004 \002(\021\0220\n\010subtre" + "left\030\001 \002(\021\022\r\n\005right\030\002 \002(\021\022\013\n\003top\030\003 \002(\021\022\016" +
"es\030\007 \003(\0132\036.OsmAnd.OBF.TransportStopsTree", "\n\006bottom\030\004 \002(\021\0220\n\010subtrees\030\007 \003(\0132\036.OsmAn",
"\022(\n\005leafs\030\010 \003(\0132\031.OsmAnd.OBF.TransportSt" + "d.OBF.TransportStopsTree\022(\n\005leafs\030\010 \003(\0132" +
"op\022\016\n\006baseId\030\020 \001(\004\"\256\001\n\024OsmAndTransportIn" + "\031.OsmAnd.OBF.TransportStop\022\016\n\006baseId\030\020 \001" +
"dex\022\014\n\004name\030\001 \001(\t\022+\n\006routes\030\003 \001(\0132\033.OsmA" + "(\004\"\256\001\n\024OsmAndTransportIndex\022\014\n\004name\030\001 \001(" +
"nd.OBF.TransportRoutes\022-\n\005stops\030\006 \001(\0132\036." + "\t\022+\n\006routes\030\003 \001(\0132\033.OsmAnd.OBF.Transport" +
"OsmAnd.OBF.TransportStopsTree\022,\n\013stringT" + "Routes\022-\n\005stops\030\006 \001(\0132\036.OsmAnd.OBF.Trans" +
"able\030\t \002(\0132\027.OsmAnd.OBF.StringTable\"\312\002\n\016" + "portStopsTree\022,\n\013stringTable\030\t \002(\0132\027.Osm" +
"OsmAndPoiIndex\022\014\n\004name\030\001 \002(\t\022-\n\nboundari" + "And.OBF.StringTable\"\312\002\n\016OsmAndPoiIndex\022\014" +
"es\030\002 \002(\0132\031.OsmAnd.OBF.OsmAndTileBox\0228\n\017c" + "\n\004name\030\001 \002(\t\022-\n\nboundaries\030\002 \002(\0132\031.OsmAn" +
"ategoriesTable\030\003 \003(\0132\037.OsmAnd.OBF.OsmAnd" + "d.OBF.OsmAndTileBox\0228\n\017categoriesTable\030\003" +
"CategoryTable\0221\n\tnameIndex\030\004 \001(\0132\036.OsmAn", " \003(\0132\037.OsmAnd.OBF.OsmAndCategoryTable\0221\n",
"d.OBF.OsmAndPoiNameIndex\0226\n\rsubtypesTabl" + "\tnameIndex\030\004 \001(\0132\036.OsmAnd.OBF.OsmAndPoiN" +
"e\030\005 \001(\0132\037.OsmAnd.OBF.OsmAndSubtypesTable" + "ameIndex\0226\n\rsubtypesTable\030\005 \001(\0132\037.OsmAnd" +
"\022\'\n\005boxes\030\006 \003(\0132\030.OsmAnd.OBF.OsmAndPoiBo" + ".OBF.OsmAndSubtypesTable\022\'\n\005boxes\030\006 \003(\0132" +
"x\022-\n\007poiData\030\t \003(\0132\034.OsmAnd.OBF.OsmAndPo" + "\030.OsmAnd.OBF.OsmAndPoiBox\022-\n\007poiData\030\t \003" +
"iBoxData\"\331\001\n\022OsmAndPoiNameIndex\022-\n\005table" + "(\0132\034.OsmAnd.OBF.OsmAndPoiBoxData\"\331\001\n\022Osm" +
"\030\003 \002(\0132\036.OsmAnd.OBF.IndexedStringTable\022C" + "AndPoiNameIndex\022-\n\005table\030\003 \002(\0132\036.OsmAnd." +
"\n\004data\030\005 \003(\01325.OsmAnd.OBF.OsmAndPoiNameI" + "OBF.IndexedStringTable\022C\n\004data\030\005 \003(\01325.O" +
"ndex.OsmAndPoiNameIndexData\032O\n\026OsmAndPoi" + "smAnd.OBF.OsmAndPoiNameIndex.OsmAndPoiNa" +
"NameIndexData\0225\n\005atoms\030\003 \003(\0132&.OsmAnd.OB" + "meIndexData\032O\n\026OsmAndPoiNameIndexData\0225\n" +
"F.OsmAndPoiNameIndexDataAtom\"Q\n\032OsmAndPo", "\005atoms\030\003 \003(\0132&.OsmAnd.OBF.OsmAndPoiNameI",
"iNameIndexDataAtom\022\014\n\004zoom\030\002 \001(\r\022\t\n\001x\030\003 " + "ndexDataAtom\"Q\n\032OsmAndPoiNameIndexDataAt" +
"\001(\r\022\t\n\001y\030\004 \001(\r\022\017\n\007shiftTo\030\016 \001(\007\">\n\023OsmAn" + "om\022\014\n\004zoom\030\002 \001(\r\022\t\n\001x\030\003 \001(\r\022\t\n\001y\030\004 \001(\r\022\017" +
"dCategoryTable\022\020\n\010category\030\001 \002(\t\022\025\n\rsubc" + "\n\007shiftTo\030\016 \001(\007\">\n\023OsmAndCategoryTable\022\020" +
"ategories\030\003 \003(\t\"E\n\023OsmAndSubtypesTable\022." + "\n\010category\030\001 \002(\t\022\025\n\rsubcategories\030\003 \003(\t\"" +
"\n\010subtypes\030\004 \003(\0132\034.OsmAnd.OBF.OsmAndPoiS" + "E\n\023OsmAndSubtypesTable\022.\n\010subtypes\030\004 \003(\013" +
"ubtype\"\205\001\n\020OsmAndPoiSubtype\022\014\n\004name\030\001 \002(" + "2\034.OsmAnd.OBF.OsmAndPoiSubtype\"\205\001\n\020OsmAn" +
"\t\022\017\n\007tagname\030\002 \001(\t\022\016\n\006isText\030\003 \002(\010\022\021\n\tfr" + "dPoiSubtype\022\014\n\004name\030\001 \002(\t\022\017\n\007tagname\030\002 \001" +
"equency\030\005 \001(\r\022\031\n\021subtypeValuesSize\030\006 \001(\r" + "(\t\022\016\n\006isText\030\003 \002(\010\022\021\n\tfrequency\030\005 \001(\r\022\031\n" +
"\022\024\n\014subtypeValue\030\010 \003(\t\"\255\001\n\014OsmAndPoiBox\022" + "\021subtypeValuesSize\030\006 \001(\r\022\024\n\014subtypeValue" +
"\014\n\004zoom\030\001 \002(\r\022\014\n\004left\030\002 \002(\021\022\013\n\003top\030\003 \002(\021", "\030\010 \003(\t\"\255\001\n\014OsmAndPoiBox\022\014\n\004zoom\030\001 \002(\r\022\014\n",
"\0223\n\ncategories\030\004 \001(\0132\037.OsmAnd.OBF.OsmAnd" + "\004left\030\002 \002(\021\022\013\n\003top\030\003 \002(\021\0223\n\ncategories\030\004" +
"PoiCategories\022*\n\010subBoxes\030\n \003(\0132\030.OsmAnd" + " \001(\0132\037.OsmAnd.OBF.OsmAndPoiCategories\022*\n" +
".OBF.OsmAndPoiBox\022\023\n\013shiftToData\030\016 \001(\007\"@" + "\010subBoxes\030\n \003(\0132\030.OsmAnd.OBF.OsmAndPoiBo" +
"\n\023OsmAndPoiCategories\022\022\n\ncategories\030\003 \003(" + "x\022\023\n\013shiftToData\030\016 \001(\007\"@\n\023OsmAndPoiCateg" +
"\r\022\025\n\rsubcategories\030\005 \003(\r\"i\n\020OsmAndPoiBox" + "ories\022\022\n\ncategories\030\003 \003(\r\022\025\n\rsubcategori" +
"Data\022\014\n\004zoom\030\001 \001(\r\022\t\n\001x\030\002 \001(\r\022\t\n\001y\030\003 \001(\r" + "es\030\005 \003(\r\"i\n\020OsmAndPoiBoxData\022\014\n\004zoom\030\001 \001" +
"\0221\n\007poiData\030\005 \003(\0132 .OsmAnd.OBF.OsmAndPoi" + "(\r\022\t\n\001x\030\002 \001(\r\022\t\n\001y\030\003 \001(\r\0221\n\007poiData\030\005 \003(" +
"BoxDataAtom\"\360\001\n\024OsmAndPoiBoxDataAtom\022\n\n\002" + "\0132 .OsmAnd.OBF.OsmAndPoiBoxDataAtom\"\360\001\n\024" +
"dx\030\002 \002(\021\022\n\n\002dy\030\003 \002(\021\022\022\n\ncategories\030\004 \003(\r" + "OsmAndPoiBoxDataAtom\022\n\n\002dx\030\002 \002(\021\022\n\n\002dy\030\003" +
"\022\025\n\rsubcategories\030\005 \003(\r\022\014\n\004name\030\006 \001(\t\022\016\n", " \002(\021\022\022\n\ncategories\030\004 \003(\r\022\025\n\rsubcategorie",
"\006nameEn\030\007 \001(\t\022\n\n\002id\030\010 \001(\004\022\024\n\014openingHour" + "s\030\005 \003(\r\022\014\n\004name\030\006 \001(\t\022\016\n\006nameEn\030\007 \001(\t\022\n\n" +
"s\030\n \001(\t\022\014\n\004site\030\013 \001(\t\022\r\n\005phone\030\014 \001(\t\022\014\n\004" + "\002id\030\010 \001(\004\022\024\n\014openingHours\030\n \001(\t\022\014\n\004site\030" +
"note\030\r \001(\t\022\026\n\016textCategories\030\016 \003(\r\022\022\n\nte" + "\013 \001(\t\022\r\n\005phone\030\014 \001(\t\022\014\n\004note\030\r \001(\t\022\026\n\016te" +
"xtValues\030\017 \003(\t\"\032\n\007IdTable\022\017\n\007routeId\030\001 \003" + "xtCategories\030\016 \003(\r\022\022\n\ntextValues\030\017 \003(\t\"\032" +
"(\022\"F\n\017RestrictionData\022\014\n\004type\030\001 \002(\005\022\014\n\004f" + "\n\007IdTable\022\017\n\007routeId\030\001 \003(\022\"F\n\017Restrictio" +
"rom\030\002 \002(\005\022\n\n\002to\030\003 \002(\005\022\013\n\003via\030\004 \001(\005\"x\n\tRo" + "nData\022\014\n\004type\030\001 \002(\005\022\014\n\004from\030\002 \002(\005\022\n\n\002to\030" +
"uteData\022\016\n\006points\030\001 \002(\014\022\022\n\npointTypes\030\004 " + "\003 \002(\005\022\013\n\003via\030\004 \001(\005\"x\n\tRouteData\022\016\n\006point" +
"\001(\014\022\022\n\npointNames\030\005 \001(\014\022\r\n\005types\030\007 \002(\014\022\017" + "s\030\001 \002(\014\022\022\n\npointTypes\030\004 \001(\014\022\022\n\npointName" +
"\n\007routeId\030\014 \002(\005\022\023\n\013stringNames\030\016 \001(\014\"\304\005\n" + "s\030\005 \001(\014\022\r\n\005types\030\007 \002(\014\022\017\n\007routeId\030\014 \002(\005\022" +
"\022OsmAndRoutingIndex\022\014\n\004name\030\001 \002(\t\022?\n\005rul", "\023\n\013stringNames\030\016 \001(\014\"\304\005\n\022OsmAndRoutingIn",
"es\030\002 \003(\01320.OsmAnd.OBF.OsmAndRoutingIndex" + "dex\022\014\n\004name\030\001 \002(\t\022?\n\005rules\030\002 \003(\01320.OsmAn" +
".RouteEncodingRule\022>\n\trootBoxes\030\003 \003(\0132+." + "d.OBF.OsmAndRoutingIndex.RouteEncodingRu" +
"OsmAnd.OBF.OsmAndRoutingIndex.RouteDataB" + "le\022>\n\trootBoxes\030\003 \003(\0132+.OsmAnd.OBF.OsmAn" +
"ox\022A\n\014basemapBoxes\030\004 \003(\0132+.OsmAnd.OBF.Os" + "dRoutingIndex.RouteDataBox\022A\n\014basemapBox" +
"mAndRoutingIndex.RouteDataBox\022=\n\006blocks\030" + "es\030\004 \003(\0132+.OsmAnd.OBF.OsmAndRoutingIndex" +
"\005 \003(\0132-.OsmAnd.OBF.OsmAndRoutingIndex.Ro" + ".RouteDataBox\022=\n\006blocks\030\005 \003(\0132-.OsmAnd.O" +
"uteDataBlock\032;\n\021RouteEncodingRule\022\013\n\003tag" + "BF.OsmAndRoutingIndex.RouteDataBlock\032;\n\021" +
"\030\003 \002(\t\022\r\n\005value\030\005 \002(\t\022\n\n\002id\030\007 \001(\r\032\231\001\n\014Ro" + "RouteEncodingRule\022\013\n\003tag\030\003 \002(\t\022\r\n\005value\030" +
"uteDataBox\022\014\n\004left\030\001 \002(\021\022\r\n\005right\030\002 \002(\021\022" + "\005 \002(\t\022\n\n\002id\030\007 \001(\r\032\231\001\n\014RouteDataBox\022\014\n\004le" +
"\013\n\003top\030\003 \002(\021\022\016\n\006bottom\030\004 \002(\021\022\023\n\013shiftToD", "ft\030\001 \002(\021\022\r\n\005right\030\002 \002(\021\022\013\n\003top\030\003 \002(\021\022\016\n\006",
"ata\030\005 \001(\007\022:\n\005boxes\030\007 \003(\0132+.OsmAnd.OBF.Os" + "bottom\030\004 \002(\021\022\023\n\013shiftToData\030\005 \001(\007\022:\n\005box" +
"mAndRoutingIndex.RouteDataBox\032\303\001\n\016RouteD" + "es\030\007 \003(\0132+.OsmAnd.OBF.OsmAndRoutingIndex" +
"ataBlock\022$\n\007idTable\030\005 \001(\0132\023.OsmAnd.OBF.I" + ".RouteDataBox\032\303\001\n\016RouteDataBlock\022$\n\007idTa" +
"dTable\022*\n\013dataObjects\030\006 \003(\0132\025.OsmAnd.OBF" + "ble\030\005 \001(\0132\023.OsmAnd.OBF.IdTable\022*\n\013dataOb" +
".RouteData\0221\n\014restrictions\030\007 \003(\0132\033.OsmAn" + "jects\030\006 \003(\0132\025.OsmAnd.OBF.RouteData\0221\n\014re" +
"d.OBF.RestrictionData\022,\n\013stringTable\030\010 \001" + "strictions\030\007 \003(\0132\033.OsmAnd.OBF.Restrictio" +
"(\0132\027.OsmAnd.OBF.StringTableB\036\n\021net.osman" + "nData\022,\n\013stringTable\030\010 \001(\0132\027.OsmAnd.OBF." +
"d.binaryB\tOsmandOdb" "StringTableB\036\n\021net.osmand.binaryB\tOsmand" +
"Odb"
}; };
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@ -58124,7 +58217,7 @@ public final class OsmandOdb {
internal_static_OsmAnd_OBF_TransportRoute_fieldAccessorTable = new internal_static_OsmAnd_OBF_TransportRoute_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable( com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_OsmAnd_OBF_TransportRoute_descriptor, internal_static_OsmAnd_OBF_TransportRoute_descriptor,
new java.lang.String[] { "Id", "Type", "Operator", "Ref", "Name", "NameEn", "Distance", "DirectStops", "ReverseStops", "DirectGeometry", "ReverseGeometry", }); new java.lang.String[] { "Id", "Type", "Operator", "Ref", "Name", "NameEn", "Distance", "DirectStops", "ReverseStops", "DirectGeometry", "ReverseGeometry", "SharedGeometry", });
internal_static_OsmAnd_OBF_TransportRouteStop_descriptor = internal_static_OsmAnd_OBF_TransportRouteStop_descriptor =
getDescriptor().getMessageTypes().get(17); getDescriptor().getMessageTypes().get(17);
internal_static_OsmAnd_OBF_TransportRouteStop_fieldAccessorTable = new internal_static_OsmAnd_OBF_TransportRouteStop_fieldAccessorTable = new

View file

@ -15,7 +15,10 @@ public class TransportRoute extends MapObject {
private String type; private String type;
private Integer dist = null; private Integer dist = null;
private List<Way> forwardWays; private List<Way> forwardWays;
private List<Way> forwardAggWays;
private List<Way> backwardWays; private List<Way> backwardWays;
private List<Way> backwardAggWays;
private List<Way> sharedWays;
public TransportRoute(){ public TransportRoute(){
} }
@ -28,33 +31,65 @@ public class TransportRoute extends MapObject {
return backwardStops; return backwardStops;
} }
public List<Way> getForwardWays() { public List<Way> getAggregateForwardWays() {
if(forwardWays == null){ if(forwardAggWays != null){
return Collections.emptyList(); return forwardAggWays;
} }
forwardAggWays = new ArrayList<>();
if(forwardWays != null) {
forwardAggWays.addAll(forwardWays);
}
if(sharedWays != null) {
forwardAggWays.addAll(sharedWays);
}
return forwardAggWays;
}
public List<Way> getAggregateBackwardWays() {
if (backwardAggWays != null) {
return backwardAggWays;
}
backwardAggWays = new ArrayList<>();
if (backwardWays != null) {
backwardAggWays.addAll(backwardWays);
}
if (sharedWays != null) {
backwardAggWays.addAll(sharedWays);
}
return backwardAggWays;
}
public List<Way> getSharedWays() {
return sharedWays;
}
public List<Way> getForwardWays() {
return forwardWays; return forwardWays;
} }
public List<Way> getBackwardWays() { public List<Way> getBackwardWays() {
if(backwardWays == null){
return Collections.emptyList();
}
return backwardWays; return backwardWays;
} }
public void addWay(Way w, int direction){ public void addWay(Way w, int direction){
if(direction >= 0) { if(direction > 0) {
if(forwardWays == null) { if(forwardWays == null) {
forwardWays = new ArrayList<>(); forwardWays = new ArrayList<>();
} }
forwardWays.add(w); forwardWays.add(w);
} }
if(direction <= 0) { if(direction < 0) {
if(backwardWays == null) { if(backwardWays == null) {
backwardWays = new ArrayList<>(); backwardWays = new ArrayList<>();
} }
backwardWays.add(w); backwardWays.add(w);
} }
if(direction == 0) {
if(sharedWays == null) {
sharedWays = new ArrayList<>();
}
sharedWays.add(w);
}
} }
public String getRef() { public String getRef() {

View file

@ -367,7 +367,7 @@ public class MapUtils {
/** /**
* interleaves the bits of two 32-bit numbers. the result is known as a Morton code. * interleaves the bits of two 32-bit numbers. the result is known as a Morton code.
*/ */
private static long interleaveBits(long x, long y) { public static long interleaveBits(long x, long y) {
long c = 0; long c = 0;
for (byte b = 31; b >= 0; b--) { for (byte b = 31; b >= 0; b--) {
c = (c << 1) | ((x >> b) & 1); c = (c << 1) | ((x >> b) & 1);
@ -515,6 +515,29 @@ public class MapUtils {
return sa < 0; return sa < 0;
} }
public static long deinterleaveY(long coord) {
long x = 0;
for (byte b = 31; b >= 0; b--) {
x = (x << 1) | (1 & coord >> (b * 2));
}
return x;
}
public static long deinterleaveX(long coord) {
long x = 0;
for (byte b = 31; b >= 0; b--) {
x = (x << 1) | (1 & coord >> (b * 2 + 1));
}
return x;
}
} }