From 880b5e55411c1704f49e5734529e284d979d29aa Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 5 Nov 2010 12:11:09 +0000 Subject: [PATCH] fix indexing issues git-svn-id: https://osmand.googlecode.com/svn/trunk@631 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8 --- .../src/net/osmand/ToDoConstants.java | 3 +- .../osmand/binary/BinaryMapIndexWriter.java | 159 +- .../src/net/osmand/binary/OsmandOdb.java | 3686 +++++++++++++++-- .../osmand/data/index/DataIndexWriter.java | 20 +- .../osmand/data/index/IndexBatchCreator.java | 24 +- .../net/osmand/data/index/IndexConstants.java | 40 - .../osmand/data/preparation/IndexCreator.java | 385 +- DataExtractionOSM/src/osmand_odb.proto | 85 +- DataExtractionOSM/src/rtree/Pack.java | 11 +- 9 files changed, 3825 insertions(+), 588 deletions(-) diff --git a/DataExtractionOSM/src/net/osmand/ToDoConstants.java b/DataExtractionOSM/src/net/osmand/ToDoConstants.java index 5b3b8becb1..8600b37340 100644 --- a/DataExtractionOSM/src/net/osmand/ToDoConstants.java +++ b/DataExtractionOSM/src/net/osmand/ToDoConstants.java @@ -8,9 +8,8 @@ package net.osmand; public class ToDoConstants { // TODO max 101 - + // introduce bidforfix on site // !!! Fix progress in DataExtractionOsm - // !!! Fix files in IndexCreator (create one file!) // Outside base 0.4 release // 69. Add phone and site information to POI (enable call to POI and open site) diff --git a/DataExtractionOSM/src/net/osmand/binary/BinaryMapIndexWriter.java b/DataExtractionOSM/src/net/osmand/binary/BinaryMapIndexWriter.java index 99c2ae5347..2fe01ce254 100644 --- a/DataExtractionOSM/src/net/osmand/binary/BinaryMapIndexWriter.java +++ b/DataExtractionOSM/src/net/osmand/binary/BinaryMapIndexWriter.java @@ -5,20 +5,26 @@ import java.io.OutputStream; import java.io.RandomAccessFile; import java.util.Collection; import java.util.LinkedHashMap; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.Stack; import net.osmand.Algoritms; import net.osmand.binary.OsmandOdb.CityIndex; import net.osmand.binary.OsmandOdb.InteresectedStreets; +import net.osmand.binary.OsmandOdb.OsmAndTransportIndex; import net.osmand.binary.OsmandOdb.PostcodeIndex; import net.osmand.binary.OsmandOdb.StreetIndex; import net.osmand.binary.OsmandOdb.StreetIntersection; +import net.osmand.binary.OsmandOdb.TransportRoute; +import net.osmand.binary.OsmandOdb.TransportRouteStop; import net.osmand.data.Building; import net.osmand.data.City; import net.osmand.data.MapObject; import net.osmand.data.Street; +import net.osmand.data.TransportStop; import net.osmand.data.index.IndexConstants; import net.osmand.osm.LatLon; import net.osmand.osm.MapUtils; @@ -68,6 +74,9 @@ public class BinaryMapIndexWriter { private final static int CITY_INDEX_INIT = 6; private final static int POSTCODES_INDEX_INIT = 7; private final static int VILLAGES_INDEX_INIT = 8; + + private final static int TRANSPORT_INDEX_INIT = 9; + private final static int TRANSPORT_STOPS_TREE = 10; public BinaryMapIndexWriter(final RandomAccessFile raf) throws IOException{ this.raf = raf; @@ -386,24 +395,26 @@ public class BinaryMapIndexWriter { if(wayNodes != null){ InteresectedStreets.Builder sbuilders = OsmandOdb.InteresectedStreets.newBuilder(); - + Map> reverseMap = new LinkedHashMap>(); for (int i = 0; i < streets.size(); i++) { - for (int j = i + 1; j < streets.size(); j++) { - Node intersection = null; - List l1 = wayNodes.get(streets.get(i)); - List l2 = wayNodes.get(streets.get(j)); - if (l1 != null && l2 != null) { - loop: for (Node n : l1) { - for (Node n2 : l2) { - if (n.getId() == n2.getId()) { - intersection = n; - break loop; - } - } - } + streets.get(i).setIndexInCity(i); + for (Node n : wayNodes.get(streets.get(i))) { + if(!reverseMap.containsKey(n.getId())){ + reverseMap.put(n.getId(), new LinkedHashSet(3)); } - - if(intersection != null){ + reverseMap.get(n.getId()).add(i); + } + } + Set checkedStreets = new LinkedHashSet(); + for (int i = 0; i < streets.size(); i++) { + Street s1 = streets.get(i); + checkedStreets.clear(); + for(Node intersection : wayNodes.get(s1)){ + for(Integer j : reverseMap.get(intersection.getId())){ + if(i >= j || checkedStreets.contains(j)){ + continue; + } + checkedStreets.add(j); StreetIntersection.Builder builder = OsmandOdb.StreetIntersection.newBuilder(); builder.setIntersectedStreet1(i); builder.setIntersectedStreet2(j); @@ -515,6 +526,120 @@ public class BinaryMapIndexWriter { return streetBuilder.build(); } + public void startWriteTransportIndex() throws IOException { + pushState(TRANSPORT_INDEX_INIT, OSMAND_STRUCTURE_INIT); + codedOutStream.writeTag(OsmandOdb.OsmAndStructure.TRANSPORTINDEX_FIELD_NUMBER, WireFormat.WIRETYPE_FIXED32_LENGTH_DELIMITED); + stackBounds.push(new Bounds(0, 0, 0, 0)); // for transport stops tree + preserveInt32Size(); + } + + public void endWriteTransportIndex() throws IOException { + popState(TRANSPORT_INDEX_INIT); + int len = writeInt32Size(); + stackBounds.pop(); + System.out.println("TRANSPORT INDEX SIZE : " + len); + } + + private int registerString(Map stringTable, String s) { + if (stringTable.containsKey(s)) { + return stringTable.get(s); + } + int size = stringTable.size(); + stringTable.put(s, size); + return size; + } + + public void writeTransportRoute(long idRoute, String routeName, String routeEnName, String ref, String operator, String type, + int dist, List directStops, List reverseStops, Map stringTable) throws IOException { + checkPeekState(TRANSPORT_INDEX_INIT); + TransportRoute.Builder tRoute = OsmandOdb.TransportRoute.newBuilder(); + tRoute.setRef(ref); + tRoute.setOperator(registerString(stringTable, operator)); + tRoute.setType(registerString(stringTable, type)); + tRoute.setId(idRoute); + tRoute.setName(registerString(stringTable, routeName)); + tRoute.setDistance(dist); + + if(routeEnName != null){ + tRoute.setNameEn(registerString(stringTable, routeEnName)); + } + for (int i = 0; i < 2; i++) { + List stops = i == 0 ? directStops : reverseStops; + long id = 0; + int x24 = 0; + int y24 = 0; + for (TransportStop st : stops) { + TransportRouteStop.Builder tStop = OsmandOdb.TransportRouteStop.newBuilder(); + tStop.setId(st.getId() - id); + id = st.getId(); + int x = (int) MapUtils.getTileNumberX(24, st.getLocation().getLongitude()); + int y = (int) MapUtils.getTileNumberY(24, st.getLocation().getLatitude()); + tStop.setDx(x - x24); + tStop.setDy(y - y24); + x24 = x; + y24 = y; + tStop.setName(registerString(stringTable, st.getName())); + if (st.getEnName() != null) { + tStop.setNameEn(registerString(stringTable, st.getEnName())); + } + if (i == 0) { + tRoute.addDirectStops(tStop.build()); + } else { + tRoute.addReverseStops(tStop.build()); + } + } + } + codedOutStream.writeMessage(OsmandOdb.OsmAndTransportIndex.ROUTES_FIELD_NUMBER, tRoute.build()); + } + + public void startTransportTreeElement(int leftX, int rightX, int topY, int bottomY) throws IOException { + checkPeekState(TRANSPORT_STOPS_TREE, TRANSPORT_INDEX_INIT); + if(state.peek() == TRANSPORT_STOPS_TREE){ + codedOutStream.writeTag(OsmandOdb.TransportStopsTree.SUBTREES_FIELD_NUMBER, WireFormat.WIRETYPE_FIXED32_LENGTH_DELIMITED); + } else { + codedOutStream.writeTag(OsmandOdb.OsmAndTransportIndex.STOPS_FIELD_NUMBER, WireFormat.WIRETYPE_FIXED32_LENGTH_DELIMITED); + } + state.push(TRANSPORT_STOPS_TREE); + preserveInt32Size(); + + + Bounds bounds = stackBounds.peek(); + + codedOutStream.writeSInt32(OsmandOdb.TransportStopsTree.LEFT_FIELD_NUMBER, leftX - bounds.leftX); + codedOutStream.writeSInt32(OsmandOdb.TransportStopsTree.RIGHT_FIELD_NUMBER, rightX - bounds.rightX); + codedOutStream.writeSInt32(OsmandOdb.TransportStopsTree.TOP_FIELD_NUMBER, topY - bounds.topY); + codedOutStream.writeSInt32(OsmandOdb.TransportStopsTree.BOTTOM_FIELD_NUMBER, bottomY - bounds.bottomY); + stackBounds.push(new Bounds(leftX, rightX, topY, bottomY)); + stackBaseIds.push(-1L); + + + } + + public void endWriteTransportTreeElement() throws IOException { + Long baseId = stackBaseIds.pop(); + if(baseId >= 0){ + codedOutStream.writeUInt64(OsmandOdb.TransportStopsTree.BASEID_FIELD_NUMBER, baseId); + } + popState(TRANSPORT_STOPS_TREE); + stackBounds.pop(); + writeInt32Size(); + } + + + public void writeTransportStringTable(Map stringTable) throws IOException { + checkPeekState(TRANSPORT_INDEX_INIT); + // expect linked hash map + int i = 0; + OsmandOdb.StringTable.Builder st = OsmandOdb.StringTable.newBuilder(); + for(String s : stringTable.keySet()){ + if(stringTable.get(s) != i++){ + throw new IllegalStateException(); + } + st.addS(s); + } + codedOutStream.writeMessage(OsmAndTransportIndex.STRINGTABLE_FIELD_NUMBER, st.build()); + } + private void pushState(int push, int peek){ if(state.peek() != peek){ @@ -544,4 +669,6 @@ public class BinaryMapIndexWriter { codedOutStream.writeInt32(OsmandOdb.OsmAndStructure.VERSIONCONFIRM_FIELD_NUMBER, IndexConstants.BINARY_MAP_VERSION); codedOutStream.flush(); } + + } diff --git a/DataExtractionOSM/src/net/osmand/binary/OsmandOdb.java b/DataExtractionOSM/src/net/osmand/binary/OsmandOdb.java index 456b578bb9..5720bd27f5 100644 --- a/DataExtractionOSM/src/net/osmand/binary/OsmandOdb.java +++ b/DataExtractionOSM/src/net/osmand/binary/OsmandOdb.java @@ -66,6 +66,18 @@ public final class OsmandOdb { return addressIndex_.get(index); } + // repeated .OsmAndTransportIndex transportIndex = 4; + public static final int TRANSPORTINDEX_FIELD_NUMBER = 4; + private java.util.List transportIndex_ = + java.util.Collections.emptyList(); + public java.util.List getTransportIndexList() { + return transportIndex_; + } + public int getTransportIndexCount() { return transportIndex_.size(); } + public net.osmand.binary.OsmandOdb.OsmAndTransportIndex getTransportIndex(int index) { + return transportIndex_.get(index); + } + // required uint32 versionConfirm = 32; public static final int VERSIONCONFIRM_FIELD_NUMBER = 32; private boolean hasVersionConfirm; @@ -84,6 +96,9 @@ public final class OsmandOdb { for (net.osmand.binary.OsmandOdb.OsmAndAddressIndex element : getAddressIndexList()) { if (!element.isInitialized()) return false; } + for (net.osmand.binary.OsmandOdb.OsmAndTransportIndex element : getTransportIndexList()) { + if (!element.isInitialized()) return false; + } return true; } @@ -99,6 +114,9 @@ public final class OsmandOdb { for (net.osmand.binary.OsmandOdb.OsmAndAddressIndex element : getAddressIndexList()) { output.writeMessage(3, element); } + for (net.osmand.binary.OsmandOdb.OsmAndTransportIndex element : getTransportIndexList()) { + output.writeMessage(4, element); + } if (hasVersionConfirm()) { output.writeUInt32(32, getVersionConfirm()); } @@ -123,6 +141,10 @@ public final class OsmandOdb { size += com.google.protobuf.CodedOutputStream .computeMessageSize(3, element); } + for (net.osmand.binary.OsmandOdb.OsmAndTransportIndex element : getTransportIndexList()) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, element); + } if (hasVersionConfirm()) { size += com.google.protobuf.CodedOutputStream .computeUInt32Size(32, getVersionConfirm()); @@ -277,6 +299,10 @@ public final class OsmandOdb { result.addressIndex_ = java.util.Collections.unmodifiableList(result.addressIndex_); } + if (result.transportIndex_ != java.util.Collections.EMPTY_LIST) { + result.transportIndex_ = + java.util.Collections.unmodifiableList(result.transportIndex_); + } net.osmand.binary.OsmandOdb.OsmAndStructure returnMe = result; result = null; return returnMe; @@ -308,6 +334,12 @@ public final class OsmandOdb { } result.addressIndex_.addAll(other.addressIndex_); } + if (!other.transportIndex_.isEmpty()) { + if (result.transportIndex_.isEmpty()) { + result.transportIndex_ = new java.util.ArrayList(); + } + result.transportIndex_.addAll(other.transportIndex_); + } if (other.hasVersionConfirm()) { setVersionConfirm(other.getVersionConfirm()); } @@ -352,6 +384,12 @@ public final class OsmandOdb { addAddressIndex(subBuilder.buildPartial()); break; } + case 34: { + net.osmand.binary.OsmandOdb.OsmAndTransportIndex.Builder subBuilder = net.osmand.binary.OsmandOdb.OsmAndTransportIndex.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addTransportIndex(subBuilder.buildPartial()); + break; + } case 256: { setVersionConfirm(input.readUInt32()); break; @@ -481,6 +519,57 @@ public final class OsmandOdb { return this; } + // repeated .OsmAndTransportIndex transportIndex = 4; + public java.util.List getTransportIndexList() { + return java.util.Collections.unmodifiableList(result.transportIndex_); + } + public int getTransportIndexCount() { + return result.getTransportIndexCount(); + } + public net.osmand.binary.OsmandOdb.OsmAndTransportIndex getTransportIndex(int index) { + return result.getTransportIndex(index); + } + public Builder setTransportIndex(int index, net.osmand.binary.OsmandOdb.OsmAndTransportIndex value) { + if (value == null) { + throw new NullPointerException(); + } + result.transportIndex_.set(index, value); + return this; + } + public Builder setTransportIndex(int index, net.osmand.binary.OsmandOdb.OsmAndTransportIndex.Builder builderForValue) { + result.transportIndex_.set(index, builderForValue.build()); + return this; + } + public Builder addTransportIndex(net.osmand.binary.OsmandOdb.OsmAndTransportIndex value) { + if (value == null) { + throw new NullPointerException(); + } + if (result.transportIndex_.isEmpty()) { + result.transportIndex_ = new java.util.ArrayList(); + } + result.transportIndex_.add(value); + return this; + } + public Builder addTransportIndex(net.osmand.binary.OsmandOdb.OsmAndTransportIndex.Builder builderForValue) { + if (result.transportIndex_.isEmpty()) { + result.transportIndex_ = new java.util.ArrayList(); + } + result.transportIndex_.add(builderForValue.build()); + return this; + } + public Builder addAllTransportIndex( + java.lang.Iterable values) { + if (result.transportIndex_.isEmpty()) { + result.transportIndex_ = new java.util.ArrayList(); + } + super.addAll(values, result.transportIndex_); + return this; + } + public Builder clearTransportIndex() { + result.transportIndex_ = java.util.Collections.emptyList(); + return this; + } + // required uint32 versionConfirm = 32; public boolean hasVersionConfirm() { return result.hasVersionConfirm(); @@ -511,6 +600,329 @@ public final class OsmandOdb { // @@protoc_insertion_point(class_scope:OsmAndStructure) } + public static final class StringTable extends + com.google.protobuf.GeneratedMessage { + // Use StringTable.newBuilder() to construct. + private StringTable() { + initFields(); + } + private StringTable(boolean noInit) {} + + private static final StringTable defaultInstance; + public static StringTable getDefaultInstance() { + return defaultInstance; + } + + public StringTable getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return net.osmand.binary.OsmandOdb.internal_static_StringTable_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return net.osmand.binary.OsmandOdb.internal_static_StringTable_fieldAccessorTable; + } + + // repeated string s = 1; + public static final int S_FIELD_NUMBER = 1; + private java.util.List s_ = + java.util.Collections.emptyList(); + public java.util.List getSList() { + return s_; + } + public int getSCount() { return s_.size(); } + public java.lang.String getS(int index) { + return s_.get(index); + } + + private void initFields() { + } + public final boolean isInitialized() { + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + for (java.lang.String element : getSList()) { + output.writeString(1, element); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (java.lang.String element : getSList()) { + dataSize += com.google.protobuf.CodedOutputStream + .computeStringSizeNoTag(element); + } + size += dataSize; + size += 1 * getSList().size(); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + public static net.osmand.binary.OsmandOdb.StringTable parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static net.osmand.binary.OsmandOdb.StringTable parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static net.osmand.binary.OsmandOdb.StringTable parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static net.osmand.binary.OsmandOdb.StringTable parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static net.osmand.binary.OsmandOdb.StringTable parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static net.osmand.binary.OsmandOdb.StringTable parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static net.osmand.binary.OsmandOdb.StringTable parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static net.osmand.binary.OsmandOdb.StringTable parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static net.osmand.binary.OsmandOdb.StringTable parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static net.osmand.binary.OsmandOdb.StringTable parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(net.osmand.binary.OsmandOdb.StringTable prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder { + private net.osmand.binary.OsmandOdb.StringTable result; + + // Construct using net.osmand.binary.OsmandOdb.StringTable.newBuilder() + private Builder() {} + + private static Builder create() { + Builder builder = new Builder(); + builder.result = new net.osmand.binary.OsmandOdb.StringTable(); + return builder; + } + + protected net.osmand.binary.OsmandOdb.StringTable internalGetResult() { + return result; + } + + public Builder clear() { + if (result == null) { + throw new IllegalStateException( + "Cannot call clear() after build()."); + } + result = new net.osmand.binary.OsmandOdb.StringTable(); + return this; + } + + public Builder clone() { + return create().mergeFrom(result); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return net.osmand.binary.OsmandOdb.StringTable.getDescriptor(); + } + + public net.osmand.binary.OsmandOdb.StringTable getDefaultInstanceForType() { + return net.osmand.binary.OsmandOdb.StringTable.getDefaultInstance(); + } + + public boolean isInitialized() { + return result.isInitialized(); + } + public net.osmand.binary.OsmandOdb.StringTable build() { + if (result != null && !isInitialized()) { + throw newUninitializedMessageException(result); + } + return buildPartial(); + } + + private net.osmand.binary.OsmandOdb.StringTable buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + if (!isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return buildPartial(); + } + + public net.osmand.binary.OsmandOdb.StringTable buildPartial() { + if (result == null) { + throw new IllegalStateException( + "build() has already been called on this Builder."); + } + if (result.s_ != java.util.Collections.EMPTY_LIST) { + result.s_ = + java.util.Collections.unmodifiableList(result.s_); + } + net.osmand.binary.OsmandOdb.StringTable returnMe = result; + result = null; + return returnMe; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof net.osmand.binary.OsmandOdb.StringTable) { + return mergeFrom((net.osmand.binary.OsmandOdb.StringTable)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(net.osmand.binary.OsmandOdb.StringTable other) { + if (other == net.osmand.binary.OsmandOdb.StringTable.getDefaultInstance()) return this; + if (!other.s_.isEmpty()) { + if (result.s_.isEmpty()) { + result.s_ = new java.util.ArrayList(); + } + result.s_.addAll(other.s_); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + return this; + } + break; + } + case 10: { + addS(input.readString()); + break; + } + } + } + } + + + // repeated string s = 1; + public java.util.List getSList() { + return java.util.Collections.unmodifiableList(result.s_); + } + public int getSCount() { + return result.getSCount(); + } + public java.lang.String getS(int index) { + return result.getS(index); + } + public Builder setS(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + result.s_.set(index, value); + return this; + } + public Builder addS(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + if (result.s_.isEmpty()) { + result.s_ = new java.util.ArrayList(); + } + result.s_.add(value); + return this; + } + public Builder addAllS( + java.lang.Iterable values) { + if (result.s_.isEmpty()) { + result.s_ = new java.util.ArrayList(); + } + super.addAll(values, result.s_); + return this; + } + public Builder clearS() { + result.s_ = java.util.Collections.emptyList(); + return this; + } + + // @@protoc_insertion_point(builder_scope:StringTable) + } + + static { + defaultInstance = new StringTable(true); + net.osmand.binary.OsmandOdb.internalForceInit(); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:StringTable) + } + public static final class OsmAndMapIndex extends com.google.protobuf.GeneratedMessage { // Use OsmAndMapIndex.newBuilder() to construct. @@ -2105,329 +2517,6 @@ public final class OsmandOdb { // @@protoc_insertion_point(class_scope:MapTree) } - public static final class StringTable extends - com.google.protobuf.GeneratedMessage { - // Use StringTable.newBuilder() to construct. - private StringTable() { - initFields(); - } - private StringTable(boolean noInit) {} - - private static final StringTable defaultInstance; - public static StringTable getDefaultInstance() { - return defaultInstance; - } - - public StringTable getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return net.osmand.binary.OsmandOdb.internal_static_StringTable_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return net.osmand.binary.OsmandOdb.internal_static_StringTable_fieldAccessorTable; - } - - // repeated string s = 1; - public static final int S_FIELD_NUMBER = 1; - private java.util.List s_ = - java.util.Collections.emptyList(); - public java.util.List getSList() { - return s_; - } - public int getSCount() { return s_.size(); } - public java.lang.String getS(int index) { - return s_.get(index); - } - - private void initFields() { - } - public final boolean isInitialized() { - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - for (java.lang.String element : getSList()) { - output.writeString(1, element); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - { - int dataSize = 0; - for (java.lang.String element : getSList()) { - dataSize += com.google.protobuf.CodedOutputStream - .computeStringSizeNoTag(element); - } - size += dataSize; - size += 1 * getSList().size(); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - public static net.osmand.binary.OsmandOdb.StringTable parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static net.osmand.binary.OsmandOdb.StringTable parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static net.osmand.binary.OsmandOdb.StringTable parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static net.osmand.binary.OsmandOdb.StringTable parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static net.osmand.binary.OsmandOdb.StringTable parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static net.osmand.binary.OsmandOdb.StringTable parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static net.osmand.binary.OsmandOdb.StringTable parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static net.osmand.binary.OsmandOdb.StringTable parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static net.osmand.binary.OsmandOdb.StringTable parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static net.osmand.binary.OsmandOdb.StringTable parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(net.osmand.binary.OsmandOdb.StringTable prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder { - private net.osmand.binary.OsmandOdb.StringTable result; - - // Construct using net.osmand.binary.OsmandOdb.StringTable.newBuilder() - private Builder() {} - - private static Builder create() { - Builder builder = new Builder(); - builder.result = new net.osmand.binary.OsmandOdb.StringTable(); - return builder; - } - - protected net.osmand.binary.OsmandOdb.StringTable internalGetResult() { - return result; - } - - public Builder clear() { - if (result == null) { - throw new IllegalStateException( - "Cannot call clear() after build()."); - } - result = new net.osmand.binary.OsmandOdb.StringTable(); - return this; - } - - public Builder clone() { - return create().mergeFrom(result); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return net.osmand.binary.OsmandOdb.StringTable.getDescriptor(); - } - - public net.osmand.binary.OsmandOdb.StringTable getDefaultInstanceForType() { - return net.osmand.binary.OsmandOdb.StringTable.getDefaultInstance(); - } - - public boolean isInitialized() { - return result.isInitialized(); - } - public net.osmand.binary.OsmandOdb.StringTable build() { - if (result != null && !isInitialized()) { - throw newUninitializedMessageException(result); - } - return buildPartial(); - } - - private net.osmand.binary.OsmandOdb.StringTable buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return buildPartial(); - } - - public net.osmand.binary.OsmandOdb.StringTable buildPartial() { - if (result == null) { - throw new IllegalStateException( - "build() has already been called on this Builder."); - } - if (result.s_ != java.util.Collections.EMPTY_LIST) { - result.s_ = - java.util.Collections.unmodifiableList(result.s_); - } - net.osmand.binary.OsmandOdb.StringTable returnMe = result; - result = null; - return returnMe; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof net.osmand.binary.OsmandOdb.StringTable) { - return mergeFrom((net.osmand.binary.OsmandOdb.StringTable)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(net.osmand.binary.OsmandOdb.StringTable other) { - if (other == net.osmand.binary.OsmandOdb.StringTable.getDefaultInstance()) return this; - if (!other.s_.isEmpty()) { - if (result.s_.isEmpty()) { - result.s_ = new java.util.ArrayList(); - } - result.s_.addAll(other.s_); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder( - this.getUnknownFields()); - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - this.setUnknownFields(unknownFields.build()); - return this; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - this.setUnknownFields(unknownFields.build()); - return this; - } - break; - } - case 10: { - addS(input.readString()); - break; - } - } - } - } - - - // repeated string s = 1; - public java.util.List getSList() { - return java.util.Collections.unmodifiableList(result.s_); - } - public int getSCount() { - return result.getSCount(); - } - public java.lang.String getS(int index) { - return result.getS(index); - } - public Builder setS(int index, java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - result.s_.set(index, value); - return this; - } - public Builder addS(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - if (result.s_.isEmpty()) { - result.s_ = new java.util.ArrayList(); - } - result.s_.add(value); - return this; - } - public Builder addAllS( - java.lang.Iterable values) { - if (result.s_.isEmpty()) { - result.s_ = new java.util.ArrayList(); - } - super.addAll(values, result.s_); - return this; - } - public Builder clearS() { - result.s_ = java.util.Collections.emptyList(); - return this; - } - - // @@protoc_insertion_point(builder_scope:StringTable) - } - - static { - defaultInstance = new StringTable(true); - net.osmand.binary.OsmandOdb.internalForceInit(); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:StringTable) - } - public static final class MapData extends com.google.protobuf.GeneratedMessage { // Use MapData.newBuilder() to construct. @@ -6988,11 +7077,2773 @@ public final class OsmandOdb { // @@protoc_insertion_point(class_scope:BuildingIndex) } + public static final class TransportRoute extends + com.google.protobuf.GeneratedMessage { + // Use TransportRoute.newBuilder() to construct. + private TransportRoute() { + initFields(); + } + private TransportRoute(boolean noInit) {} + + private static final TransportRoute defaultInstance; + public static TransportRoute getDefaultInstance() { + return defaultInstance; + } + + public TransportRoute getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return net.osmand.binary.OsmandOdb.internal_static_TransportRoute_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return net.osmand.binary.OsmandOdb.internal_static_TransportRoute_fieldAccessorTable; + } + + // required uint64 id = 1; + public static final int ID_FIELD_NUMBER = 1; + private boolean hasId; + private long id_ = 0L; + public boolean hasId() { return hasId; } + public long getId() { return id_; } + + // optional uint32 type = 3; + public static final int TYPE_FIELD_NUMBER = 3; + private boolean hasType; + private int type_ = 0; + public boolean hasType() { return hasType; } + public int getType() { return type_; } + + // optional uint32 operator = 4; + public static final int OPERATOR_FIELD_NUMBER = 4; + private boolean hasOperator; + private int operator_ = 0; + public boolean hasOperator() { return hasOperator; } + public int getOperator() { return operator_; } + + // optional string ref = 5; + public static final int REF_FIELD_NUMBER = 5; + private boolean hasRef; + private java.lang.String ref_ = ""; + public boolean hasRef() { return hasRef; } + public java.lang.String getRef() { return ref_; } + + // optional uint32 name = 6; + public static final int NAME_FIELD_NUMBER = 6; + private boolean hasName; + private int name_ = 0; + public boolean hasName() { return hasName; } + public int getName() { return name_; } + + // optional uint32 name_en = 7; + public static final int NAME_EN_FIELD_NUMBER = 7; + private boolean hasNameEn; + private int nameEn_ = 0; + public boolean hasNameEn() { return hasNameEn; } + public int getNameEn() { return nameEn_; } + + // optional uint32 distance = 8; + public static final int DISTANCE_FIELD_NUMBER = 8; + private boolean hasDistance; + private int distance_ = 0; + public boolean hasDistance() { return hasDistance; } + public int getDistance() { return distance_; } + + // repeated .TransportRouteStop directStops = 15; + public static final int DIRECTSTOPS_FIELD_NUMBER = 15; + private java.util.List directStops_ = + java.util.Collections.emptyList(); + public java.util.List getDirectStopsList() { + return directStops_; + } + public int getDirectStopsCount() { return directStops_.size(); } + public net.osmand.binary.OsmandOdb.TransportRouteStop getDirectStops(int index) { + return directStops_.get(index); + } + + // repeated .TransportRouteStop reverseStops = 16; + public static final int REVERSESTOPS_FIELD_NUMBER = 16; + private java.util.List reverseStops_ = + java.util.Collections.emptyList(); + public java.util.List getReverseStopsList() { + return reverseStops_; + } + public int getReverseStopsCount() { return reverseStops_.size(); } + public net.osmand.binary.OsmandOdb.TransportRouteStop getReverseStops(int index) { + return reverseStops_.get(index); + } + + private void initFields() { + } + public final boolean isInitialized() { + if (!hasId) return false; + for (net.osmand.binary.OsmandOdb.TransportRouteStop element : getDirectStopsList()) { + if (!element.isInitialized()) return false; + } + for (net.osmand.binary.OsmandOdb.TransportRouteStop element : getReverseStopsList()) { + if (!element.isInitialized()) return false; + } + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (hasId()) { + output.writeUInt64(1, getId()); + } + if (hasType()) { + output.writeUInt32(3, getType()); + } + if (hasOperator()) { + output.writeUInt32(4, getOperator()); + } + if (hasRef()) { + output.writeString(5, getRef()); + } + if (hasName()) { + output.writeUInt32(6, getName()); + } + if (hasNameEn()) { + output.writeUInt32(7, getNameEn()); + } + if (hasDistance()) { + output.writeUInt32(8, getDistance()); + } + for (net.osmand.binary.OsmandOdb.TransportRouteStop element : getDirectStopsList()) { + output.writeMessage(15, element); + } + for (net.osmand.binary.OsmandOdb.TransportRouteStop element : getReverseStopsList()) { + output.writeMessage(16, element); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasId()) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(1, getId()); + } + if (hasType()) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(3, getType()); + } + if (hasOperator()) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(4, getOperator()); + } + if (hasRef()) { + size += com.google.protobuf.CodedOutputStream + .computeStringSize(5, getRef()); + } + if (hasName()) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(6, getName()); + } + if (hasNameEn()) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(7, getNameEn()); + } + if (hasDistance()) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(8, getDistance()); + } + for (net.osmand.binary.OsmandOdb.TransportRouteStop element : getDirectStopsList()) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(15, element); + } + for (net.osmand.binary.OsmandOdb.TransportRouteStop element : getReverseStopsList()) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(16, element); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + public static net.osmand.binary.OsmandOdb.TransportRoute parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportRoute parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportRoute parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportRoute parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportRoute parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportRoute parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportRoute parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static net.osmand.binary.OsmandOdb.TransportRoute parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static net.osmand.binary.OsmandOdb.TransportRoute parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportRoute parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(net.osmand.binary.OsmandOdb.TransportRoute prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder { + private net.osmand.binary.OsmandOdb.TransportRoute result; + + // Construct using net.osmand.binary.OsmandOdb.TransportRoute.newBuilder() + private Builder() {} + + private static Builder create() { + Builder builder = new Builder(); + builder.result = new net.osmand.binary.OsmandOdb.TransportRoute(); + return builder; + } + + protected net.osmand.binary.OsmandOdb.TransportRoute internalGetResult() { + return result; + } + + public Builder clear() { + if (result == null) { + throw new IllegalStateException( + "Cannot call clear() after build()."); + } + result = new net.osmand.binary.OsmandOdb.TransportRoute(); + return this; + } + + public Builder clone() { + return create().mergeFrom(result); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return net.osmand.binary.OsmandOdb.TransportRoute.getDescriptor(); + } + + public net.osmand.binary.OsmandOdb.TransportRoute getDefaultInstanceForType() { + return net.osmand.binary.OsmandOdb.TransportRoute.getDefaultInstance(); + } + + public boolean isInitialized() { + return result.isInitialized(); + } + public net.osmand.binary.OsmandOdb.TransportRoute build() { + if (result != null && !isInitialized()) { + throw newUninitializedMessageException(result); + } + return buildPartial(); + } + + private net.osmand.binary.OsmandOdb.TransportRoute buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + if (!isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return buildPartial(); + } + + public net.osmand.binary.OsmandOdb.TransportRoute buildPartial() { + if (result == null) { + throw new IllegalStateException( + "build() has already been called on this Builder."); + } + if (result.directStops_ != java.util.Collections.EMPTY_LIST) { + result.directStops_ = + java.util.Collections.unmodifiableList(result.directStops_); + } + if (result.reverseStops_ != java.util.Collections.EMPTY_LIST) { + result.reverseStops_ = + java.util.Collections.unmodifiableList(result.reverseStops_); + } + net.osmand.binary.OsmandOdb.TransportRoute returnMe = result; + result = null; + return returnMe; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof net.osmand.binary.OsmandOdb.TransportRoute) { + return mergeFrom((net.osmand.binary.OsmandOdb.TransportRoute)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(net.osmand.binary.OsmandOdb.TransportRoute other) { + if (other == net.osmand.binary.OsmandOdb.TransportRoute.getDefaultInstance()) return this; + if (other.hasId()) { + setId(other.getId()); + } + if (other.hasType()) { + setType(other.getType()); + } + if (other.hasOperator()) { + setOperator(other.getOperator()); + } + if (other.hasRef()) { + setRef(other.getRef()); + } + if (other.hasName()) { + setName(other.getName()); + } + if (other.hasNameEn()) { + setNameEn(other.getNameEn()); + } + if (other.hasDistance()) { + setDistance(other.getDistance()); + } + if (!other.directStops_.isEmpty()) { + if (result.directStops_.isEmpty()) { + result.directStops_ = new java.util.ArrayList(); + } + result.directStops_.addAll(other.directStops_); + } + if (!other.reverseStops_.isEmpty()) { + if (result.reverseStops_.isEmpty()) { + result.reverseStops_ = new java.util.ArrayList(); + } + result.reverseStops_.addAll(other.reverseStops_); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + return this; + } + break; + } + case 8: { + setId(input.readUInt64()); + break; + } + case 24: { + setType(input.readUInt32()); + break; + } + case 32: { + setOperator(input.readUInt32()); + break; + } + case 42: { + setRef(input.readString()); + break; + } + case 48: { + setName(input.readUInt32()); + break; + } + case 56: { + setNameEn(input.readUInt32()); + break; + } + case 64: { + setDistance(input.readUInt32()); + break; + } + case 122: { + net.osmand.binary.OsmandOdb.TransportRouteStop.Builder subBuilder = net.osmand.binary.OsmandOdb.TransportRouteStop.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addDirectStops(subBuilder.buildPartial()); + break; + } + case 130: { + net.osmand.binary.OsmandOdb.TransportRouteStop.Builder subBuilder = net.osmand.binary.OsmandOdb.TransportRouteStop.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addReverseStops(subBuilder.buildPartial()); + break; + } + } + } + } + + + // required uint64 id = 1; + public boolean hasId() { + return result.hasId(); + } + public long getId() { + return result.getId(); + } + public Builder setId(long value) { + result.hasId = true; + result.id_ = value; + return this; + } + public Builder clearId() { + result.hasId = false; + result.id_ = 0L; + return this; + } + + // optional uint32 type = 3; + public boolean hasType() { + return result.hasType(); + } + public int getType() { + return result.getType(); + } + public Builder setType(int value) { + result.hasType = true; + result.type_ = value; + return this; + } + public Builder clearType() { + result.hasType = false; + result.type_ = 0; + return this; + } + + // optional uint32 operator = 4; + public boolean hasOperator() { + return result.hasOperator(); + } + public int getOperator() { + return result.getOperator(); + } + public Builder setOperator(int value) { + result.hasOperator = true; + result.operator_ = value; + return this; + } + public Builder clearOperator() { + result.hasOperator = false; + result.operator_ = 0; + return this; + } + + // optional string ref = 5; + public boolean hasRef() { + return result.hasRef(); + } + public java.lang.String getRef() { + return result.getRef(); + } + public Builder setRef(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + result.hasRef = true; + result.ref_ = value; + return this; + } + public Builder clearRef() { + result.hasRef = false; + result.ref_ = getDefaultInstance().getRef(); + return this; + } + + // optional uint32 name = 6; + public boolean hasName() { + return result.hasName(); + } + public int getName() { + return result.getName(); + } + public Builder setName(int value) { + result.hasName = true; + result.name_ = value; + return this; + } + public Builder clearName() { + result.hasName = false; + result.name_ = 0; + return this; + } + + // optional uint32 name_en = 7; + public boolean hasNameEn() { + return result.hasNameEn(); + } + public int getNameEn() { + return result.getNameEn(); + } + public Builder setNameEn(int value) { + result.hasNameEn = true; + result.nameEn_ = value; + return this; + } + public Builder clearNameEn() { + result.hasNameEn = false; + result.nameEn_ = 0; + return this; + } + + // optional uint32 distance = 8; + public boolean hasDistance() { + return result.hasDistance(); + } + public int getDistance() { + return result.getDistance(); + } + public Builder setDistance(int value) { + result.hasDistance = true; + result.distance_ = value; + return this; + } + public Builder clearDistance() { + result.hasDistance = false; + result.distance_ = 0; + return this; + } + + // repeated .TransportRouteStop directStops = 15; + public java.util.List getDirectStopsList() { + return java.util.Collections.unmodifiableList(result.directStops_); + } + public int getDirectStopsCount() { + return result.getDirectStopsCount(); + } + public net.osmand.binary.OsmandOdb.TransportRouteStop getDirectStops(int index) { + return result.getDirectStops(index); + } + public Builder setDirectStops(int index, net.osmand.binary.OsmandOdb.TransportRouteStop value) { + if (value == null) { + throw new NullPointerException(); + } + result.directStops_.set(index, value); + return this; + } + public Builder setDirectStops(int index, net.osmand.binary.OsmandOdb.TransportRouteStop.Builder builderForValue) { + result.directStops_.set(index, builderForValue.build()); + return this; + } + public Builder addDirectStops(net.osmand.binary.OsmandOdb.TransportRouteStop value) { + if (value == null) { + throw new NullPointerException(); + } + if (result.directStops_.isEmpty()) { + result.directStops_ = new java.util.ArrayList(); + } + result.directStops_.add(value); + return this; + } + public Builder addDirectStops(net.osmand.binary.OsmandOdb.TransportRouteStop.Builder builderForValue) { + if (result.directStops_.isEmpty()) { + result.directStops_ = new java.util.ArrayList(); + } + result.directStops_.add(builderForValue.build()); + return this; + } + public Builder addAllDirectStops( + java.lang.Iterable values) { + if (result.directStops_.isEmpty()) { + result.directStops_ = new java.util.ArrayList(); + } + super.addAll(values, result.directStops_); + return this; + } + public Builder clearDirectStops() { + result.directStops_ = java.util.Collections.emptyList(); + return this; + } + + // repeated .TransportRouteStop reverseStops = 16; + public java.util.List getReverseStopsList() { + return java.util.Collections.unmodifiableList(result.reverseStops_); + } + public int getReverseStopsCount() { + return result.getReverseStopsCount(); + } + public net.osmand.binary.OsmandOdb.TransportRouteStop getReverseStops(int index) { + return result.getReverseStops(index); + } + public Builder setReverseStops(int index, net.osmand.binary.OsmandOdb.TransportRouteStop value) { + if (value == null) { + throw new NullPointerException(); + } + result.reverseStops_.set(index, value); + return this; + } + public Builder setReverseStops(int index, net.osmand.binary.OsmandOdb.TransportRouteStop.Builder builderForValue) { + result.reverseStops_.set(index, builderForValue.build()); + return this; + } + public Builder addReverseStops(net.osmand.binary.OsmandOdb.TransportRouteStop value) { + if (value == null) { + throw new NullPointerException(); + } + if (result.reverseStops_.isEmpty()) { + result.reverseStops_ = new java.util.ArrayList(); + } + result.reverseStops_.add(value); + return this; + } + public Builder addReverseStops(net.osmand.binary.OsmandOdb.TransportRouteStop.Builder builderForValue) { + if (result.reverseStops_.isEmpty()) { + result.reverseStops_ = new java.util.ArrayList(); + } + result.reverseStops_.add(builderForValue.build()); + return this; + } + public Builder addAllReverseStops( + java.lang.Iterable values) { + if (result.reverseStops_.isEmpty()) { + result.reverseStops_ = new java.util.ArrayList(); + } + super.addAll(values, result.reverseStops_); + return this; + } + public Builder clearReverseStops() { + result.reverseStops_ = java.util.Collections.emptyList(); + return this; + } + + // @@protoc_insertion_point(builder_scope:TransportRoute) + } + + static { + defaultInstance = new TransportRoute(true); + net.osmand.binary.OsmandOdb.internalForceInit(); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:TransportRoute) + } + + public static final class TransportRouteStop extends + com.google.protobuf.GeneratedMessage { + // Use TransportRouteStop.newBuilder() to construct. + private TransportRouteStop() { + initFields(); + } + private TransportRouteStop(boolean noInit) {} + + private static final TransportRouteStop defaultInstance; + public static TransportRouteStop getDefaultInstance() { + return defaultInstance; + } + + public TransportRouteStop getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return net.osmand.binary.OsmandOdb.internal_static_TransportRouteStop_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return net.osmand.binary.OsmandOdb.internal_static_TransportRouteStop_fieldAccessorTable; + } + + // required sint64 id = 1; + public static final int ID_FIELD_NUMBER = 1; + private boolean hasId; + private long id_ = 0L; + public boolean hasId() { return hasId; } + public long getId() { return id_; } + + // required sint32 dx = 2; + public static final int DX_FIELD_NUMBER = 2; + private boolean hasDx; + private int dx_ = 0; + public boolean hasDx() { return hasDx; } + public int getDx() { return dx_; } + + // required sint32 dy = 3; + public static final int DY_FIELD_NUMBER = 3; + private boolean hasDy; + private int dy_ = 0; + public boolean hasDy() { return hasDy; } + public int getDy() { return dy_; } + + // required uint32 name = 6; + public static final int NAME_FIELD_NUMBER = 6; + private boolean hasName; + private int name_ = 0; + public boolean hasName() { return hasName; } + public int getName() { return name_; } + + // optional uint32 name_en = 7; + public static final int NAME_EN_FIELD_NUMBER = 7; + private boolean hasNameEn; + private int nameEn_ = 0; + public boolean hasNameEn() { return hasNameEn; } + public int getNameEn() { return nameEn_; } + + private void initFields() { + } + public final boolean isInitialized() { + if (!hasId) return false; + if (!hasDx) return false; + if (!hasDy) return false; + if (!hasName) return false; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (hasId()) { + output.writeSInt64(1, getId()); + } + if (hasDx()) { + output.writeSInt32(2, getDx()); + } + if (hasDy()) { + output.writeSInt32(3, getDy()); + } + if (hasName()) { + output.writeUInt32(6, getName()); + } + if (hasNameEn()) { + output.writeUInt32(7, getNameEn()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasId()) { + size += com.google.protobuf.CodedOutputStream + .computeSInt64Size(1, getId()); + } + if (hasDx()) { + size += com.google.protobuf.CodedOutputStream + .computeSInt32Size(2, getDx()); + } + if (hasDy()) { + size += com.google.protobuf.CodedOutputStream + .computeSInt32Size(3, getDy()); + } + if (hasName()) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(6, getName()); + } + if (hasNameEn()) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(7, getNameEn()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + public static net.osmand.binary.OsmandOdb.TransportRouteStop parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportRouteStop parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportRouteStop parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportRouteStop parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportRouteStop parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportRouteStop parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportRouteStop parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static net.osmand.binary.OsmandOdb.TransportRouteStop parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static net.osmand.binary.OsmandOdb.TransportRouteStop parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportRouteStop parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(net.osmand.binary.OsmandOdb.TransportRouteStop prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder { + private net.osmand.binary.OsmandOdb.TransportRouteStop result; + + // Construct using net.osmand.binary.OsmandOdb.TransportRouteStop.newBuilder() + private Builder() {} + + private static Builder create() { + Builder builder = new Builder(); + builder.result = new net.osmand.binary.OsmandOdb.TransportRouteStop(); + return builder; + } + + protected net.osmand.binary.OsmandOdb.TransportRouteStop internalGetResult() { + return result; + } + + public Builder clear() { + if (result == null) { + throw new IllegalStateException( + "Cannot call clear() after build()."); + } + result = new net.osmand.binary.OsmandOdb.TransportRouteStop(); + return this; + } + + public Builder clone() { + return create().mergeFrom(result); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return net.osmand.binary.OsmandOdb.TransportRouteStop.getDescriptor(); + } + + public net.osmand.binary.OsmandOdb.TransportRouteStop getDefaultInstanceForType() { + return net.osmand.binary.OsmandOdb.TransportRouteStop.getDefaultInstance(); + } + + public boolean isInitialized() { + return result.isInitialized(); + } + public net.osmand.binary.OsmandOdb.TransportRouteStop build() { + if (result != null && !isInitialized()) { + throw newUninitializedMessageException(result); + } + return buildPartial(); + } + + private net.osmand.binary.OsmandOdb.TransportRouteStop buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + if (!isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return buildPartial(); + } + + public net.osmand.binary.OsmandOdb.TransportRouteStop buildPartial() { + if (result == null) { + throw new IllegalStateException( + "build() has already been called on this Builder."); + } + net.osmand.binary.OsmandOdb.TransportRouteStop returnMe = result; + result = null; + return returnMe; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof net.osmand.binary.OsmandOdb.TransportRouteStop) { + return mergeFrom((net.osmand.binary.OsmandOdb.TransportRouteStop)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(net.osmand.binary.OsmandOdb.TransportRouteStop other) { + if (other == net.osmand.binary.OsmandOdb.TransportRouteStop.getDefaultInstance()) return this; + if (other.hasId()) { + setId(other.getId()); + } + if (other.hasDx()) { + setDx(other.getDx()); + } + if (other.hasDy()) { + setDy(other.getDy()); + } + if (other.hasName()) { + setName(other.getName()); + } + if (other.hasNameEn()) { + setNameEn(other.getNameEn()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + return this; + } + break; + } + case 8: { + setId(input.readSInt64()); + break; + } + case 16: { + setDx(input.readSInt32()); + break; + } + case 24: { + setDy(input.readSInt32()); + break; + } + case 48: { + setName(input.readUInt32()); + break; + } + case 56: { + setNameEn(input.readUInt32()); + break; + } + } + } + } + + + // required sint64 id = 1; + public boolean hasId() { + return result.hasId(); + } + public long getId() { + return result.getId(); + } + public Builder setId(long value) { + result.hasId = true; + result.id_ = value; + return this; + } + public Builder clearId() { + result.hasId = false; + result.id_ = 0L; + return this; + } + + // required sint32 dx = 2; + public boolean hasDx() { + return result.hasDx(); + } + public int getDx() { + return result.getDx(); + } + public Builder setDx(int value) { + result.hasDx = true; + result.dx_ = value; + return this; + } + public Builder clearDx() { + result.hasDx = false; + result.dx_ = 0; + return this; + } + + // required sint32 dy = 3; + public boolean hasDy() { + return result.hasDy(); + } + public int getDy() { + return result.getDy(); + } + public Builder setDy(int value) { + result.hasDy = true; + result.dy_ = value; + return this; + } + public Builder clearDy() { + result.hasDy = false; + result.dy_ = 0; + return this; + } + + // required uint32 name = 6; + public boolean hasName() { + return result.hasName(); + } + public int getName() { + return result.getName(); + } + public Builder setName(int value) { + result.hasName = true; + result.name_ = value; + return this; + } + public Builder clearName() { + result.hasName = false; + result.name_ = 0; + return this; + } + + // optional uint32 name_en = 7; + public boolean hasNameEn() { + return result.hasNameEn(); + } + public int getNameEn() { + return result.getNameEn(); + } + public Builder setNameEn(int value) { + result.hasNameEn = true; + result.nameEn_ = value; + return this; + } + public Builder clearNameEn() { + result.hasNameEn = false; + result.nameEn_ = 0; + return this; + } + + // @@protoc_insertion_point(builder_scope:TransportRouteStop) + } + + static { + defaultInstance = new TransportRouteStop(true); + net.osmand.binary.OsmandOdb.internalForceInit(); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:TransportRouteStop) + } + + public static final class TransportStop extends + com.google.protobuf.GeneratedMessage { + // Use TransportStop.newBuilder() to construct. + private TransportStop() { + initFields(); + } + private TransportStop(boolean noInit) {} + + private static final TransportStop defaultInstance; + public static TransportStop getDefaultInstance() { + return defaultInstance; + } + + public TransportStop getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return net.osmand.binary.OsmandOdb.internal_static_TransportStop_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return net.osmand.binary.OsmandOdb.internal_static_TransportStop_fieldAccessorTable; + } + + // required sint64 id = 1; + public static final int ID_FIELD_NUMBER = 1; + private boolean hasId; + private long id_ = 0L; + public boolean hasId() { return hasId; } + public long getId() { return id_; } + + // required sint32 dx = 2; + public static final int DX_FIELD_NUMBER = 2; + private boolean hasDx; + private int dx_ = 0; + public boolean hasDx() { return hasDx; } + public int getDx() { return dx_; } + + // required sint32 dy = 3; + public static final int DY_FIELD_NUMBER = 3; + private boolean hasDy; + private int dy_ = 0; + public boolean hasDy() { return hasDy; } + public int getDy() { return dy_; } + + // required uint32 name = 6; + public static final int NAME_FIELD_NUMBER = 6; + private boolean hasName; + private int name_ = 0; + public boolean hasName() { return hasName; } + public int getName() { return name_; } + + // optional uint32 name_en = 7; + public static final int NAME_EN_FIELD_NUMBER = 7; + private boolean hasNameEn; + private int nameEn_ = 0; + public boolean hasNameEn() { return hasNameEn; } + public int getNameEn() { return nameEn_; } + + // repeated uint32 routes = 16; + public static final int ROUTES_FIELD_NUMBER = 16; + private java.util.List routes_ = + java.util.Collections.emptyList(); + public java.util.List getRoutesList() { + return routes_; + } + public int getRoutesCount() { return routes_.size(); } + public int getRoutes(int index) { + return routes_.get(index); + } + + private void initFields() { + } + public final boolean isInitialized() { + if (!hasId) return false; + if (!hasDx) return false; + if (!hasDy) return false; + if (!hasName) return false; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (hasId()) { + output.writeSInt64(1, getId()); + } + if (hasDx()) { + output.writeSInt32(2, getDx()); + } + if (hasDy()) { + output.writeSInt32(3, getDy()); + } + if (hasName()) { + output.writeUInt32(6, getName()); + } + if (hasNameEn()) { + output.writeUInt32(7, getNameEn()); + } + for (int element : getRoutesList()) { + output.writeUInt32(16, element); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasId()) { + size += com.google.protobuf.CodedOutputStream + .computeSInt64Size(1, getId()); + } + if (hasDx()) { + size += com.google.protobuf.CodedOutputStream + .computeSInt32Size(2, getDx()); + } + if (hasDy()) { + size += com.google.protobuf.CodedOutputStream + .computeSInt32Size(3, getDy()); + } + if (hasName()) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(6, getName()); + } + if (hasNameEn()) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(7, getNameEn()); + } + { + int dataSize = 0; + for (int element : getRoutesList()) { + dataSize += com.google.protobuf.CodedOutputStream + .computeUInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * getRoutesList().size(); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + public static net.osmand.binary.OsmandOdb.TransportStop parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportStop parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportStop parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportStop parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportStop parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportStop parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportStop parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static net.osmand.binary.OsmandOdb.TransportStop parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static net.osmand.binary.OsmandOdb.TransportStop parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportStop parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(net.osmand.binary.OsmandOdb.TransportStop prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder { + private net.osmand.binary.OsmandOdb.TransportStop result; + + // Construct using net.osmand.binary.OsmandOdb.TransportStop.newBuilder() + private Builder() {} + + private static Builder create() { + Builder builder = new Builder(); + builder.result = new net.osmand.binary.OsmandOdb.TransportStop(); + return builder; + } + + protected net.osmand.binary.OsmandOdb.TransportStop internalGetResult() { + return result; + } + + public Builder clear() { + if (result == null) { + throw new IllegalStateException( + "Cannot call clear() after build()."); + } + result = new net.osmand.binary.OsmandOdb.TransportStop(); + return this; + } + + public Builder clone() { + return create().mergeFrom(result); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return net.osmand.binary.OsmandOdb.TransportStop.getDescriptor(); + } + + public net.osmand.binary.OsmandOdb.TransportStop getDefaultInstanceForType() { + return net.osmand.binary.OsmandOdb.TransportStop.getDefaultInstance(); + } + + public boolean isInitialized() { + return result.isInitialized(); + } + public net.osmand.binary.OsmandOdb.TransportStop build() { + if (result != null && !isInitialized()) { + throw newUninitializedMessageException(result); + } + return buildPartial(); + } + + private net.osmand.binary.OsmandOdb.TransportStop buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + if (!isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return buildPartial(); + } + + public net.osmand.binary.OsmandOdb.TransportStop buildPartial() { + if (result == null) { + throw new IllegalStateException( + "build() has already been called on this Builder."); + } + if (result.routes_ != java.util.Collections.EMPTY_LIST) { + result.routes_ = + java.util.Collections.unmodifiableList(result.routes_); + } + net.osmand.binary.OsmandOdb.TransportStop returnMe = result; + result = null; + return returnMe; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof net.osmand.binary.OsmandOdb.TransportStop) { + return mergeFrom((net.osmand.binary.OsmandOdb.TransportStop)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(net.osmand.binary.OsmandOdb.TransportStop other) { + if (other == net.osmand.binary.OsmandOdb.TransportStop.getDefaultInstance()) return this; + if (other.hasId()) { + setId(other.getId()); + } + if (other.hasDx()) { + setDx(other.getDx()); + } + if (other.hasDy()) { + setDy(other.getDy()); + } + if (other.hasName()) { + setName(other.getName()); + } + if (other.hasNameEn()) { + setNameEn(other.getNameEn()); + } + if (!other.routes_.isEmpty()) { + if (result.routes_.isEmpty()) { + result.routes_ = new java.util.ArrayList(); + } + result.routes_.addAll(other.routes_); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + return this; + } + break; + } + case 8: { + setId(input.readSInt64()); + break; + } + case 16: { + setDx(input.readSInt32()); + break; + } + case 24: { + setDy(input.readSInt32()); + break; + } + case 48: { + setName(input.readUInt32()); + break; + } + case 56: { + setNameEn(input.readUInt32()); + break; + } + case 128: { + addRoutes(input.readUInt32()); + break; + } + case 130: { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + while (input.getBytesUntilLimit() > 0) { + addRoutes(input.readUInt32()); + } + input.popLimit(limit); + break; + } + } + } + } + + + // required sint64 id = 1; + public boolean hasId() { + return result.hasId(); + } + public long getId() { + return result.getId(); + } + public Builder setId(long value) { + result.hasId = true; + result.id_ = value; + return this; + } + public Builder clearId() { + result.hasId = false; + result.id_ = 0L; + return this; + } + + // required sint32 dx = 2; + public boolean hasDx() { + return result.hasDx(); + } + public int getDx() { + return result.getDx(); + } + public Builder setDx(int value) { + result.hasDx = true; + result.dx_ = value; + return this; + } + public Builder clearDx() { + result.hasDx = false; + result.dx_ = 0; + return this; + } + + // required sint32 dy = 3; + public boolean hasDy() { + return result.hasDy(); + } + public int getDy() { + return result.getDy(); + } + public Builder setDy(int value) { + result.hasDy = true; + result.dy_ = value; + return this; + } + public Builder clearDy() { + result.hasDy = false; + result.dy_ = 0; + return this; + } + + // required uint32 name = 6; + public boolean hasName() { + return result.hasName(); + } + public int getName() { + return result.getName(); + } + public Builder setName(int value) { + result.hasName = true; + result.name_ = value; + return this; + } + public Builder clearName() { + result.hasName = false; + result.name_ = 0; + return this; + } + + // optional uint32 name_en = 7; + public boolean hasNameEn() { + return result.hasNameEn(); + } + public int getNameEn() { + return result.getNameEn(); + } + public Builder setNameEn(int value) { + result.hasNameEn = true; + result.nameEn_ = value; + return this; + } + public Builder clearNameEn() { + result.hasNameEn = false; + result.nameEn_ = 0; + return this; + } + + // repeated uint32 routes = 16; + public java.util.List getRoutesList() { + return java.util.Collections.unmodifiableList(result.routes_); + } + public int getRoutesCount() { + return result.getRoutesCount(); + } + public int getRoutes(int index) { + return result.getRoutes(index); + } + public Builder setRoutes(int index, int value) { + result.routes_.set(index, value); + return this; + } + public Builder addRoutes(int value) { + if (result.routes_.isEmpty()) { + result.routes_ = new java.util.ArrayList(); + } + result.routes_.add(value); + return this; + } + public Builder addAllRoutes( + java.lang.Iterable values) { + if (result.routes_.isEmpty()) { + result.routes_ = new java.util.ArrayList(); + } + super.addAll(values, result.routes_); + return this; + } + public Builder clearRoutes() { + result.routes_ = java.util.Collections.emptyList(); + return this; + } + + // @@protoc_insertion_point(builder_scope:TransportStop) + } + + static { + defaultInstance = new TransportStop(true); + net.osmand.binary.OsmandOdb.internalForceInit(); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:TransportStop) + } + + public static final class TransportStopsTree extends + com.google.protobuf.GeneratedMessage { + // Use TransportStopsTree.newBuilder() to construct. + private TransportStopsTree() { + initFields(); + } + private TransportStopsTree(boolean noInit) {} + + private static final TransportStopsTree defaultInstance; + public static TransportStopsTree getDefaultInstance() { + return defaultInstance; + } + + public TransportStopsTree getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return net.osmand.binary.OsmandOdb.internal_static_TransportStopsTree_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return net.osmand.binary.OsmandOdb.internal_static_TransportStopsTree_fieldAccessorTable; + } + + // required sint32 left = 1; + public static final int LEFT_FIELD_NUMBER = 1; + private boolean hasLeft; + private int left_ = 0; + public boolean hasLeft() { return hasLeft; } + public int getLeft() { return left_; } + + // required sint32 right = 2; + public static final int RIGHT_FIELD_NUMBER = 2; + private boolean hasRight; + private int right_ = 0; + public boolean hasRight() { return hasRight; } + public int getRight() { return right_; } + + // required sint32 top = 3; + public static final int TOP_FIELD_NUMBER = 3; + private boolean hasTop; + private int top_ = 0; + public boolean hasTop() { return hasTop; } + public int getTop() { return top_; } + + // required sint32 bottom = 4; + public static final int BOTTOM_FIELD_NUMBER = 4; + private boolean hasBottom; + private int bottom_ = 0; + public boolean hasBottom() { return hasBottom; } + public int getBottom() { return bottom_; } + + // repeated .TransportStopsTree subtrees = 7; + public static final int SUBTREES_FIELD_NUMBER = 7; + private java.util.List subtrees_ = + java.util.Collections.emptyList(); + public java.util.List getSubtreesList() { + return subtrees_; + } + public int getSubtreesCount() { return subtrees_.size(); } + public net.osmand.binary.OsmandOdb.TransportStopsTree getSubtrees(int index) { + return subtrees_.get(index); + } + + // repeated .TransportStop leafs = 8; + public static final int LEAFS_FIELD_NUMBER = 8; + private java.util.List leafs_ = + java.util.Collections.emptyList(); + public java.util.List getLeafsList() { + return leafs_; + } + public int getLeafsCount() { return leafs_.size(); } + public net.osmand.binary.OsmandOdb.TransportStop getLeafs(int index) { + return leafs_.get(index); + } + + // optional uint64 baseId = 16; + public static final int BASEID_FIELD_NUMBER = 16; + private boolean hasBaseId; + private long baseId_ = 0L; + public boolean hasBaseId() { return hasBaseId; } + public long getBaseId() { return baseId_; } + + private void initFields() { + } + public final boolean isInitialized() { + if (!hasLeft) return false; + if (!hasRight) return false; + if (!hasTop) return false; + if (!hasBottom) return false; + for (net.osmand.binary.OsmandOdb.TransportStopsTree element : getSubtreesList()) { + if (!element.isInitialized()) return false; + } + for (net.osmand.binary.OsmandOdb.TransportStop element : getLeafsList()) { + if (!element.isInitialized()) return false; + } + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (hasLeft()) { + output.writeSInt32(1, getLeft()); + } + if (hasRight()) { + output.writeSInt32(2, getRight()); + } + if (hasTop()) { + output.writeSInt32(3, getTop()); + } + if (hasBottom()) { + output.writeSInt32(4, getBottom()); + } + for (net.osmand.binary.OsmandOdb.TransportStopsTree element : getSubtreesList()) { + output.writeMessage(7, element); + } + for (net.osmand.binary.OsmandOdb.TransportStop element : getLeafsList()) { + output.writeMessage(8, element); + } + if (hasBaseId()) { + output.writeUInt64(16, getBaseId()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasLeft()) { + size += com.google.protobuf.CodedOutputStream + .computeSInt32Size(1, getLeft()); + } + if (hasRight()) { + size += com.google.protobuf.CodedOutputStream + .computeSInt32Size(2, getRight()); + } + if (hasTop()) { + size += com.google.protobuf.CodedOutputStream + .computeSInt32Size(3, getTop()); + } + if (hasBottom()) { + size += com.google.protobuf.CodedOutputStream + .computeSInt32Size(4, getBottom()); + } + for (net.osmand.binary.OsmandOdb.TransportStopsTree element : getSubtreesList()) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(7, element); + } + for (net.osmand.binary.OsmandOdb.TransportStop element : getLeafsList()) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(8, element); + } + if (hasBaseId()) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(16, getBaseId()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + public static net.osmand.binary.OsmandOdb.TransportStopsTree parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportStopsTree parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportStopsTree parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportStopsTree parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportStopsTree parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportStopsTree parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportStopsTree parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static net.osmand.binary.OsmandOdb.TransportStopsTree parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static net.osmand.binary.OsmandOdb.TransportStopsTree parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static net.osmand.binary.OsmandOdb.TransportStopsTree parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(net.osmand.binary.OsmandOdb.TransportStopsTree prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder { + private net.osmand.binary.OsmandOdb.TransportStopsTree result; + + // Construct using net.osmand.binary.OsmandOdb.TransportStopsTree.newBuilder() + private Builder() {} + + private static Builder create() { + Builder builder = new Builder(); + builder.result = new net.osmand.binary.OsmandOdb.TransportStopsTree(); + return builder; + } + + protected net.osmand.binary.OsmandOdb.TransportStopsTree internalGetResult() { + return result; + } + + public Builder clear() { + if (result == null) { + throw new IllegalStateException( + "Cannot call clear() after build()."); + } + result = new net.osmand.binary.OsmandOdb.TransportStopsTree(); + return this; + } + + public Builder clone() { + return create().mergeFrom(result); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return net.osmand.binary.OsmandOdb.TransportStopsTree.getDescriptor(); + } + + public net.osmand.binary.OsmandOdb.TransportStopsTree getDefaultInstanceForType() { + return net.osmand.binary.OsmandOdb.TransportStopsTree.getDefaultInstance(); + } + + public boolean isInitialized() { + return result.isInitialized(); + } + public net.osmand.binary.OsmandOdb.TransportStopsTree build() { + if (result != null && !isInitialized()) { + throw newUninitializedMessageException(result); + } + return buildPartial(); + } + + private net.osmand.binary.OsmandOdb.TransportStopsTree buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + if (!isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return buildPartial(); + } + + public net.osmand.binary.OsmandOdb.TransportStopsTree buildPartial() { + if (result == null) { + throw new IllegalStateException( + "build() has already been called on this Builder."); + } + if (result.subtrees_ != java.util.Collections.EMPTY_LIST) { + result.subtrees_ = + java.util.Collections.unmodifiableList(result.subtrees_); + } + if (result.leafs_ != java.util.Collections.EMPTY_LIST) { + result.leafs_ = + java.util.Collections.unmodifiableList(result.leafs_); + } + net.osmand.binary.OsmandOdb.TransportStopsTree returnMe = result; + result = null; + return returnMe; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof net.osmand.binary.OsmandOdb.TransportStopsTree) { + return mergeFrom((net.osmand.binary.OsmandOdb.TransportStopsTree)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(net.osmand.binary.OsmandOdb.TransportStopsTree other) { + if (other == net.osmand.binary.OsmandOdb.TransportStopsTree.getDefaultInstance()) return this; + if (other.hasLeft()) { + setLeft(other.getLeft()); + } + if (other.hasRight()) { + setRight(other.getRight()); + } + if (other.hasTop()) { + setTop(other.getTop()); + } + if (other.hasBottom()) { + setBottom(other.getBottom()); + } + if (!other.subtrees_.isEmpty()) { + if (result.subtrees_.isEmpty()) { + result.subtrees_ = new java.util.ArrayList(); + } + result.subtrees_.addAll(other.subtrees_); + } + if (!other.leafs_.isEmpty()) { + if (result.leafs_.isEmpty()) { + result.leafs_ = new java.util.ArrayList(); + } + result.leafs_.addAll(other.leafs_); + } + if (other.hasBaseId()) { + setBaseId(other.getBaseId()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + return this; + } + break; + } + case 8: { + setLeft(input.readSInt32()); + break; + } + case 16: { + setRight(input.readSInt32()); + break; + } + case 24: { + setTop(input.readSInt32()); + break; + } + case 32: { + setBottom(input.readSInt32()); + break; + } + case 58: { + net.osmand.binary.OsmandOdb.TransportStopsTree.Builder subBuilder = net.osmand.binary.OsmandOdb.TransportStopsTree.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addSubtrees(subBuilder.buildPartial()); + break; + } + case 66: { + net.osmand.binary.OsmandOdb.TransportStop.Builder subBuilder = net.osmand.binary.OsmandOdb.TransportStop.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addLeafs(subBuilder.buildPartial()); + break; + } + case 128: { + setBaseId(input.readUInt64()); + break; + } + } + } + } + + + // required sint32 left = 1; + public boolean hasLeft() { + return result.hasLeft(); + } + public int getLeft() { + return result.getLeft(); + } + public Builder setLeft(int value) { + result.hasLeft = true; + result.left_ = value; + return this; + } + public Builder clearLeft() { + result.hasLeft = false; + result.left_ = 0; + return this; + } + + // required sint32 right = 2; + public boolean hasRight() { + return result.hasRight(); + } + public int getRight() { + return result.getRight(); + } + public Builder setRight(int value) { + result.hasRight = true; + result.right_ = value; + return this; + } + public Builder clearRight() { + result.hasRight = false; + result.right_ = 0; + return this; + } + + // required sint32 top = 3; + public boolean hasTop() { + return result.hasTop(); + } + public int getTop() { + return result.getTop(); + } + public Builder setTop(int value) { + result.hasTop = true; + result.top_ = value; + return this; + } + public Builder clearTop() { + result.hasTop = false; + result.top_ = 0; + return this; + } + + // required sint32 bottom = 4; + public boolean hasBottom() { + return result.hasBottom(); + } + public int getBottom() { + return result.getBottom(); + } + public Builder setBottom(int value) { + result.hasBottom = true; + result.bottom_ = value; + return this; + } + public Builder clearBottom() { + result.hasBottom = false; + result.bottom_ = 0; + return this; + } + + // repeated .TransportStopsTree subtrees = 7; + public java.util.List getSubtreesList() { + return java.util.Collections.unmodifiableList(result.subtrees_); + } + public int getSubtreesCount() { + return result.getSubtreesCount(); + } + public net.osmand.binary.OsmandOdb.TransportStopsTree getSubtrees(int index) { + return result.getSubtrees(index); + } + public Builder setSubtrees(int index, net.osmand.binary.OsmandOdb.TransportStopsTree value) { + if (value == null) { + throw new NullPointerException(); + } + result.subtrees_.set(index, value); + return this; + } + public Builder setSubtrees(int index, net.osmand.binary.OsmandOdb.TransportStopsTree.Builder builderForValue) { + result.subtrees_.set(index, builderForValue.build()); + return this; + } + public Builder addSubtrees(net.osmand.binary.OsmandOdb.TransportStopsTree value) { + if (value == null) { + throw new NullPointerException(); + } + if (result.subtrees_.isEmpty()) { + result.subtrees_ = new java.util.ArrayList(); + } + result.subtrees_.add(value); + return this; + } + public Builder addSubtrees(net.osmand.binary.OsmandOdb.TransportStopsTree.Builder builderForValue) { + if (result.subtrees_.isEmpty()) { + result.subtrees_ = new java.util.ArrayList(); + } + result.subtrees_.add(builderForValue.build()); + return this; + } + public Builder addAllSubtrees( + java.lang.Iterable values) { + if (result.subtrees_.isEmpty()) { + result.subtrees_ = new java.util.ArrayList(); + } + super.addAll(values, result.subtrees_); + return this; + } + public Builder clearSubtrees() { + result.subtrees_ = java.util.Collections.emptyList(); + return this; + } + + // repeated .TransportStop leafs = 8; + public java.util.List getLeafsList() { + return java.util.Collections.unmodifiableList(result.leafs_); + } + public int getLeafsCount() { + return result.getLeafsCount(); + } + public net.osmand.binary.OsmandOdb.TransportStop getLeafs(int index) { + return result.getLeafs(index); + } + public Builder setLeafs(int index, net.osmand.binary.OsmandOdb.TransportStop value) { + if (value == null) { + throw new NullPointerException(); + } + result.leafs_.set(index, value); + return this; + } + public Builder setLeafs(int index, net.osmand.binary.OsmandOdb.TransportStop.Builder builderForValue) { + result.leafs_.set(index, builderForValue.build()); + return this; + } + public Builder addLeafs(net.osmand.binary.OsmandOdb.TransportStop value) { + if (value == null) { + throw new NullPointerException(); + } + if (result.leafs_.isEmpty()) { + result.leafs_ = new java.util.ArrayList(); + } + result.leafs_.add(value); + return this; + } + public Builder addLeafs(net.osmand.binary.OsmandOdb.TransportStop.Builder builderForValue) { + if (result.leafs_.isEmpty()) { + result.leafs_ = new java.util.ArrayList(); + } + result.leafs_.add(builderForValue.build()); + return this; + } + public Builder addAllLeafs( + java.lang.Iterable values) { + if (result.leafs_.isEmpty()) { + result.leafs_ = new java.util.ArrayList(); + } + super.addAll(values, result.leafs_); + return this; + } + public Builder clearLeafs() { + result.leafs_ = java.util.Collections.emptyList(); + return this; + } + + // optional uint64 baseId = 16; + public boolean hasBaseId() { + return result.hasBaseId(); + } + public long getBaseId() { + return result.getBaseId(); + } + public Builder setBaseId(long value) { + result.hasBaseId = true; + result.baseId_ = value; + return this; + } + public Builder clearBaseId() { + result.hasBaseId = false; + result.baseId_ = 0L; + return this; + } + + // @@protoc_insertion_point(builder_scope:TransportStopsTree) + } + + static { + defaultInstance = new TransportStopsTree(true); + net.osmand.binary.OsmandOdb.internalForceInit(); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:TransportStopsTree) + } + + public static final class OsmAndTransportIndex extends + com.google.protobuf.GeneratedMessage { + // Use OsmAndTransportIndex.newBuilder() to construct. + private OsmAndTransportIndex() { + initFields(); + } + private OsmAndTransportIndex(boolean noInit) {} + + private static final OsmAndTransportIndex defaultInstance; + public static OsmAndTransportIndex getDefaultInstance() { + return defaultInstance; + } + + public OsmAndTransportIndex getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return net.osmand.binary.OsmandOdb.internal_static_OsmAndTransportIndex_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return net.osmand.binary.OsmandOdb.internal_static_OsmAndTransportIndex_fieldAccessorTable; + } + + // repeated .TransportRoute routes = 3; + public static final int ROUTES_FIELD_NUMBER = 3; + private java.util.List routes_ = + java.util.Collections.emptyList(); + public java.util.List getRoutesList() { + return routes_; + } + public int getRoutesCount() { return routes_.size(); } + public net.osmand.binary.OsmandOdb.TransportRoute getRoutes(int index) { + return routes_.get(index); + } + + // optional .TransportStopsTree stops = 6; + public static final int STOPS_FIELD_NUMBER = 6; + private boolean hasStops; + private net.osmand.binary.OsmandOdb.TransportStopsTree stops_; + public boolean hasStops() { return hasStops; } + public net.osmand.binary.OsmandOdb.TransportStopsTree getStops() { return stops_; } + + // required .StringTable stringTable = 9; + public static final int STRINGTABLE_FIELD_NUMBER = 9; + private boolean hasStringTable; + private net.osmand.binary.OsmandOdb.StringTable stringTable_; + public boolean hasStringTable() { return hasStringTable; } + public net.osmand.binary.OsmandOdb.StringTable getStringTable() { return stringTable_; } + + private void initFields() { + stops_ = net.osmand.binary.OsmandOdb.TransportStopsTree.getDefaultInstance(); + stringTable_ = net.osmand.binary.OsmandOdb.StringTable.getDefaultInstance(); + } + public final boolean isInitialized() { + if (!hasStringTable) return false; + for (net.osmand.binary.OsmandOdb.TransportRoute element : getRoutesList()) { + if (!element.isInitialized()) return false; + } + if (hasStops()) { + if (!getStops().isInitialized()) return false; + } + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + for (net.osmand.binary.OsmandOdb.TransportRoute element : getRoutesList()) { + output.writeMessage(3, element); + } + if (hasStops()) { + output.writeMessage(6, getStops()); + } + if (hasStringTable()) { + output.writeMessage(9, getStringTable()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + for (net.osmand.binary.OsmandOdb.TransportRoute element : getRoutesList()) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, element); + } + if (hasStops()) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(6, getStops()); + } + if (hasStringTable()) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(9, getStringTable()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + public static net.osmand.binary.OsmandOdb.OsmAndTransportIndex parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static net.osmand.binary.OsmandOdb.OsmAndTransportIndex parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static net.osmand.binary.OsmandOdb.OsmAndTransportIndex parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static net.osmand.binary.OsmandOdb.OsmAndTransportIndex parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static net.osmand.binary.OsmandOdb.OsmAndTransportIndex parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static net.osmand.binary.OsmandOdb.OsmAndTransportIndex parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static net.osmand.binary.OsmandOdb.OsmAndTransportIndex parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static net.osmand.binary.OsmandOdb.OsmAndTransportIndex parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static net.osmand.binary.OsmandOdb.OsmAndTransportIndex parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static net.osmand.binary.OsmandOdb.OsmAndTransportIndex parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(net.osmand.binary.OsmandOdb.OsmAndTransportIndex prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder { + private net.osmand.binary.OsmandOdb.OsmAndTransportIndex result; + + // Construct using net.osmand.binary.OsmandOdb.OsmAndTransportIndex.newBuilder() + private Builder() {} + + private static Builder create() { + Builder builder = new Builder(); + builder.result = new net.osmand.binary.OsmandOdb.OsmAndTransportIndex(); + return builder; + } + + protected net.osmand.binary.OsmandOdb.OsmAndTransportIndex internalGetResult() { + return result; + } + + public Builder clear() { + if (result == null) { + throw new IllegalStateException( + "Cannot call clear() after build()."); + } + result = new net.osmand.binary.OsmandOdb.OsmAndTransportIndex(); + return this; + } + + public Builder clone() { + return create().mergeFrom(result); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return net.osmand.binary.OsmandOdb.OsmAndTransportIndex.getDescriptor(); + } + + public net.osmand.binary.OsmandOdb.OsmAndTransportIndex getDefaultInstanceForType() { + return net.osmand.binary.OsmandOdb.OsmAndTransportIndex.getDefaultInstance(); + } + + public boolean isInitialized() { + return result.isInitialized(); + } + public net.osmand.binary.OsmandOdb.OsmAndTransportIndex build() { + if (result != null && !isInitialized()) { + throw newUninitializedMessageException(result); + } + return buildPartial(); + } + + private net.osmand.binary.OsmandOdb.OsmAndTransportIndex buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + if (!isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return buildPartial(); + } + + public net.osmand.binary.OsmandOdb.OsmAndTransportIndex buildPartial() { + if (result == null) { + throw new IllegalStateException( + "build() has already been called on this Builder."); + } + if (result.routes_ != java.util.Collections.EMPTY_LIST) { + result.routes_ = + java.util.Collections.unmodifiableList(result.routes_); + } + net.osmand.binary.OsmandOdb.OsmAndTransportIndex returnMe = result; + result = null; + return returnMe; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof net.osmand.binary.OsmandOdb.OsmAndTransportIndex) { + return mergeFrom((net.osmand.binary.OsmandOdb.OsmAndTransportIndex)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(net.osmand.binary.OsmandOdb.OsmAndTransportIndex other) { + if (other == net.osmand.binary.OsmandOdb.OsmAndTransportIndex.getDefaultInstance()) return this; + if (!other.routes_.isEmpty()) { + if (result.routes_.isEmpty()) { + result.routes_ = new java.util.ArrayList(); + } + result.routes_.addAll(other.routes_); + } + if (other.hasStops()) { + mergeStops(other.getStops()); + } + if (other.hasStringTable()) { + mergeStringTable(other.getStringTable()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + return this; + } + break; + } + case 26: { + net.osmand.binary.OsmandOdb.TransportRoute.Builder subBuilder = net.osmand.binary.OsmandOdb.TransportRoute.newBuilder(); + input.readMessage(subBuilder, extensionRegistry); + addRoutes(subBuilder.buildPartial()); + break; + } + case 50: { + net.osmand.binary.OsmandOdb.TransportStopsTree.Builder subBuilder = net.osmand.binary.OsmandOdb.TransportStopsTree.newBuilder(); + if (hasStops()) { + subBuilder.mergeFrom(getStops()); + } + input.readMessage(subBuilder, extensionRegistry); + setStops(subBuilder.buildPartial()); + break; + } + case 74: { + net.osmand.binary.OsmandOdb.StringTable.Builder subBuilder = net.osmand.binary.OsmandOdb.StringTable.newBuilder(); + if (hasStringTable()) { + subBuilder.mergeFrom(getStringTable()); + } + input.readMessage(subBuilder, extensionRegistry); + setStringTable(subBuilder.buildPartial()); + break; + } + } + } + } + + + // repeated .TransportRoute routes = 3; + public java.util.List getRoutesList() { + return java.util.Collections.unmodifiableList(result.routes_); + } + public int getRoutesCount() { + return result.getRoutesCount(); + } + public net.osmand.binary.OsmandOdb.TransportRoute getRoutes(int index) { + return result.getRoutes(index); + } + public Builder setRoutes(int index, net.osmand.binary.OsmandOdb.TransportRoute value) { + if (value == null) { + throw new NullPointerException(); + } + result.routes_.set(index, value); + return this; + } + public Builder setRoutes(int index, net.osmand.binary.OsmandOdb.TransportRoute.Builder builderForValue) { + result.routes_.set(index, builderForValue.build()); + return this; + } + public Builder addRoutes(net.osmand.binary.OsmandOdb.TransportRoute value) { + if (value == null) { + throw new NullPointerException(); + } + if (result.routes_.isEmpty()) { + result.routes_ = new java.util.ArrayList(); + } + result.routes_.add(value); + return this; + } + public Builder addRoutes(net.osmand.binary.OsmandOdb.TransportRoute.Builder builderForValue) { + if (result.routes_.isEmpty()) { + result.routes_ = new java.util.ArrayList(); + } + result.routes_.add(builderForValue.build()); + return this; + } + public Builder addAllRoutes( + java.lang.Iterable values) { + if (result.routes_.isEmpty()) { + result.routes_ = new java.util.ArrayList(); + } + super.addAll(values, result.routes_); + return this; + } + public Builder clearRoutes() { + result.routes_ = java.util.Collections.emptyList(); + return this; + } + + // optional .TransportStopsTree stops = 6; + public boolean hasStops() { + return result.hasStops(); + } + public net.osmand.binary.OsmandOdb.TransportStopsTree getStops() { + return result.getStops(); + } + public Builder setStops(net.osmand.binary.OsmandOdb.TransportStopsTree value) { + if (value == null) { + throw new NullPointerException(); + } + result.hasStops = true; + result.stops_ = value; + return this; + } + public Builder setStops(net.osmand.binary.OsmandOdb.TransportStopsTree.Builder builderForValue) { + result.hasStops = true; + result.stops_ = builderForValue.build(); + return this; + } + public Builder mergeStops(net.osmand.binary.OsmandOdb.TransportStopsTree value) { + if (result.hasStops() && + result.stops_ != net.osmand.binary.OsmandOdb.TransportStopsTree.getDefaultInstance()) { + result.stops_ = + net.osmand.binary.OsmandOdb.TransportStopsTree.newBuilder(result.stops_).mergeFrom(value).buildPartial(); + } else { + result.stops_ = value; + } + result.hasStops = true; + return this; + } + public Builder clearStops() { + result.hasStops = false; + result.stops_ = net.osmand.binary.OsmandOdb.TransportStopsTree.getDefaultInstance(); + return this; + } + + // required .StringTable stringTable = 9; + public boolean hasStringTable() { + return result.hasStringTable(); + } + public net.osmand.binary.OsmandOdb.StringTable getStringTable() { + return result.getStringTable(); + } + public Builder setStringTable(net.osmand.binary.OsmandOdb.StringTable value) { + if (value == null) { + throw new NullPointerException(); + } + result.hasStringTable = true; + result.stringTable_ = value; + return this; + } + public Builder setStringTable(net.osmand.binary.OsmandOdb.StringTable.Builder builderForValue) { + result.hasStringTable = true; + result.stringTable_ = builderForValue.build(); + return this; + } + public Builder mergeStringTable(net.osmand.binary.OsmandOdb.StringTable value) { + if (result.hasStringTable() && + result.stringTable_ != net.osmand.binary.OsmandOdb.StringTable.getDefaultInstance()) { + result.stringTable_ = + net.osmand.binary.OsmandOdb.StringTable.newBuilder(result.stringTable_).mergeFrom(value).buildPartial(); + } else { + result.stringTable_ = value; + } + result.hasStringTable = true; + return this; + } + public Builder clearStringTable() { + result.hasStringTable = false; + result.stringTable_ = net.osmand.binary.OsmandOdb.StringTable.getDefaultInstance(); + return this; + } + + // @@protoc_insertion_point(builder_scope:OsmAndTransportIndex) + } + + static { + defaultInstance = new OsmAndTransportIndex(true); + net.osmand.binary.OsmandOdb.internalForceInit(); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:OsmAndTransportIndex) + } + private static com.google.protobuf.Descriptors.Descriptor internal_static_OsmAndStructure_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_OsmAndStructure_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_StringTable_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_StringTable_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_OsmAndMapIndex_descriptor; private static @@ -7008,11 +9859,6 @@ public final class OsmandOdb { private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_MapTree_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_StringTable_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_StringTable_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_MapData_descriptor; private static @@ -7063,6 +9909,31 @@ public final class OsmandOdb { private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_BuildingIndex_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_TransportRoute_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_TransportRoute_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_TransportRouteStop_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_TransportRouteStop_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_TransportStop_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_TransportStop_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_TransportStopsTree_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_TransportStopsTree_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_OsmAndTransportIndex_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_OsmAndTransportIndex_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { @@ -7072,46 +9943,65 @@ public final class OsmandOdb { descriptor; static { java.lang.String[] descriptorData = { - "\n\024src/osmand_odb.proto\"\210\001\n\017OsmAndStructu" + + "\n\024src/osmand_odb.proto\"\267\001\n\017OsmAndStructu" + "re\022\017\n\007version\030\001 \002(\r\022!\n\010mapIndex\030\002 \003(\0132\017." + "OsmAndMapIndex\022)\n\014addressIndex\030\003 \003(\0132\023.O" + - "smAndAddressIndex\022\026\n\016versionConfirm\030 \002(" + - "\r\"/\n\016OsmAndMapIndex\022\035\n\006levels\030\001 \003(\0132\r.Ma" + - "pRootLevel\"\202\001\n\014MapRootLevel\022\017\n\007maxZoom\030\001" + - " \002(\005\022\017\n\007minZoom\030\002 \002(\005\022\014\n\004left\030\003 \002(\005\022\r\n\005r" + - "ight\030\004 \002(\005\022\013\n\003top\030\005 \002(\005\022\016\n\006bottom\030\006 \002(\005\022" + - "\026\n\004root\030\007 \003(\0132\010.MapTree\"\253\001\n\007MapTree\022\014\n\004l" + - "eft\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!\n\013stringTable\030\005 \001(\0132\014.Str" + - "ingTable\022\016\n\006baseId\030\006 \001(\004\022\032\n\010subtrees\030\007 \003" + - "(\0132\010.MapTree\022\027\n\005leafs\030\010 \003(\0132\010.MapData\"\030\n" + - "\013StringTable\022\t\n\001s\030\001 \003(\t\"v\n\007MapData\022\023\n\013co" + - "ordinates\030\001 \002(\014\022\r\n\005types\030\002 \002(\014\022\n\n\002id\030\003 \002" + - "(\022\022\020\n\010stringId\030\004 \001(\r\022\024\n\014restrictions\030\005 \001" + - "(\014\022\023\n\013highwayMeta\030\006 \001(\005\"\225\001\n\022OsmAndAddres" + - "sIndex\022\014\n\004name\030\001 \002(\t\022\017\n\007name_en\030\002 \001(\t\022\034\n" + - "\006cities\030\005 \001(\0132\014.CitiesIndex\022\"\n\tpostcodes" + - "\030\006 \001(\0132\017.PostcodesIndex\022\036\n\010villages\030\007 \001(", - "\0132\014.CitiesIndex\")\n\013CitiesIndex\022\032\n\006cities" + - "\030\001 \003(\0132\n.CityIndex\"3\n\016PostcodesIndex\022!\n\t" + - "postcodes\030\001 \003(\0132\016.PostcodeIndex\"\253\001\n\tCity" + - "Index\022\021\n\tcity_type\030\001 \002(\r\022\014\n\004name\030\002 \002(\t\022\017" + - "\n\007name_en\030\003 \001(\t\022\n\n\002id\030\004 \001(\004\022\t\n\001x\030\005 \002(\007\022\t" + - "\n\001y\030\006 \002(\007\022+\n\rintersections\030\016 \001(\0132\024.Inter" + - "esectedStreets\022\035\n\007streets\030\022 \003(\0132\014.Street" + - "Index\"A\n\023InteresectedStreets\022*\n\rintersec" + - "tions\030\005 \003(\0132\023.StreetIntersection\"x\n\022Stre" + - "etIntersection\022\032\n\022intersectedStreet1\030\002 \002", - "(\r\022\032\n\022intersectedStreet2\030\003 \002(\r\022\024\n\014inters" + - "ectedX\030\004 \002(\021\022\024\n\014intersectedY\030\005 \002(\021\"V\n\rPo" + - "stcodeIndex\022\020\n\010postcode\030\001 \002(\t\022\t\n\001x\030\002 \002(\007" + - "\022\t\n\001y\030\003 \002(\007\022\035\n\007streets\030\005 \003(\0132\014.StreetInd" + - "ex\"q\n\013StreetIndex\022\014\n\004name\030\001 \002(\t\022\017\n\007name_" + - "en\030\002 \001(\t\022\t\n\001x\030\003 \002(\021\022\t\n\001y\030\004 \002(\021\022\n\n\002id\030\006 \001" + - "(\004\022!\n\tbuildings\030\022 \003(\0132\016.BuildingIndex\"b\n" + - "\rBuildingIndex\022\014\n\004name\030\001 \002(\t\022\017\n\007name_en\030" + - "\002 \001(\t\022\n\n\002id\030\005 \001(\004\022\020\n\010postcode\030\006 \001(\t\022\t\n\001x" + - "\030\003 \002(\021\022\t\n\001y\030\004 \002(\021B\023\n\021net.osmand.binary" + "smAndAddressIndex\022-\n\016transportIndex\030\004 \003(" + + "\0132\025.OsmAndTransportIndex\022\026\n\016versionConfi" + + "rm\030 \002(\r\"\030\n\013StringTable\022\t\n\001s\030\001 \003(\t\"/\n\016Os" + + "mAndMapIndex\022\035\n\006levels\030\001 \003(\0132\r.MapRootLe" + + "vel\"\202\001\n\014MapRootLevel\022\017\n\007maxZoom\030\001 \002(\005\022\017\n" + + "\007minZoom\030\002 \002(\005\022\014\n\004left\030\003 \002(\005\022\r\n\005right\030\004 " + + "\002(\005\022\013\n\003top\030\005 \002(\005\022\016\n\006bottom\030\006 \002(\005\022\026\n\004root", + "\030\007 \003(\0132\010.MapTree\"\253\001\n\007MapTree\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!\n\013stringTable\030\005 \001(\0132\014.StringTabl" + + "e\022\016\n\006baseId\030\006 \001(\004\022\032\n\010subtrees\030\007 \003(\0132\010.Ma" + + "pTree\022\027\n\005leafs\030\010 \003(\0132\010.MapData\"v\n\007MapDat" + + "a\022\023\n\013coordinates\030\001 \002(\014\022\r\n\005types\030\002 \002(\014\022\n\n" + + "\002id\030\003 \002(\022\022\020\n\010stringId\030\004 \001(\r\022\024\n\014restricti" + + "ons\030\005 \001(\014\022\023\n\013highwayMeta\030\006 \001(\005\"\225\001\n\022OsmAn" + + "dAddressIndex\022\014\n\004name\030\001 \002(\t\022\017\n\007name_en\030\002" + + " \001(\t\022\034\n\006cities\030\005 \001(\0132\014.CitiesIndex\022\"\n\tpo", + "stcodes\030\006 \001(\0132\017.PostcodesIndex\022\036\n\010villag" + + "es\030\007 \001(\0132\014.CitiesIndex\")\n\013CitiesIndex\022\032\n" + + "\006cities\030\001 \003(\0132\n.CityIndex\"3\n\016PostcodesIn" + + "dex\022!\n\tpostcodes\030\001 \003(\0132\016.PostcodeIndex\"\253" + + "\001\n\tCityIndex\022\021\n\tcity_type\030\001 \002(\r\022\014\n\004name\030" + + "\002 \002(\t\022\017\n\007name_en\030\003 \001(\t\022\n\n\002id\030\004 \001(\004\022\t\n\001x\030" + + "\005 \002(\007\022\t\n\001y\030\006 \002(\007\022+\n\rintersections\030\016 \001(\0132" + + "\024.InteresectedStreets\022\035\n\007streets\030\022 \003(\0132\014" + + ".StreetIndex\"A\n\023InteresectedStreets\022*\n\ri" + + "ntersections\030\005 \003(\0132\023.StreetIntersection\"", + "x\n\022StreetIntersection\022\032\n\022intersectedStre" + + "et1\030\002 \002(\r\022\032\n\022intersectedStreet2\030\003 \002(\r\022\024\n" + + "\014intersectedX\030\004 \002(\021\022\024\n\014intersectedY\030\005 \002(" + + "\021\"V\n\rPostcodeIndex\022\020\n\010postcode\030\001 \002(\t\022\t\n\001" + + "x\030\002 \002(\007\022\t\n\001y\030\003 \002(\007\022\035\n\007streets\030\005 \003(\0132\014.St" + + "reetIndex\"q\n\013StreetIndex\022\014\n\004name\030\001 \002(\t\022\017" + + "\n\007name_en\030\002 \001(\t\022\t\n\001x\030\003 \002(\021\022\t\n\001y\030\004 \002(\021\022\n\n" + + "\002id\030\006 \001(\004\022!\n\tbuildings\030\022 \003(\0132\016.BuildingI" + + "ndex\"b\n\rBuildingIndex\022\014\n\004name\030\001 \002(\t\022\017\n\007n" + + "ame_en\030\002 \001(\t\022\n\n\002id\030\005 \001(\004\022\020\n\010postcode\030\006 \001", + "(\t\022\t\n\001x\030\003 \002(\021\022\t\n\001y\030\004 \002(\021\"\317\001\n\016TransportRo" + + "ute\022\n\n\002id\030\001 \002(\004\022\014\n\004type\030\003 \001(\r\022\020\n\010operato" + + "r\030\004 \001(\r\022\013\n\003ref\030\005 \001(\t\022\014\n\004name\030\006 \001(\r\022\017\n\007na" + + "me_en\030\007 \001(\r\022\020\n\010distance\030\010 \001(\r\022(\n\013directS" + + "tops\030\017 \003(\0132\023.TransportRouteStop\022)\n\014rever" + + "seStops\030\020 \003(\0132\023.TransportRouteStop\"W\n\022Tr" + + "ansportRouteStop\022\n\n\002id\030\001 \002(\022\022\n\n\002dx\030\002 \002(\021" + + "\022\n\n\002dy\030\003 \002(\021\022\014\n\004name\030\006 \002(\r\022\017\n\007name_en\030\007 " + + "\001(\r\"b\n\rTransportStop\022\n\n\002id\030\001 \002(\022\022\n\n\002dx\030\002" + + " \002(\021\022\n\n\002dy\030\003 \002(\021\022\014\n\004name\030\006 \002(\r\022\017\n\007name_e", + "n\030\007 \001(\r\022\016\n\006routes\030\020 \003(\r\"\244\001\n\022TransportSto" + + "psTree\022\014\n\004left\030\001 \002(\021\022\r\n\005right\030\002 \002(\021\022\013\n\003t" + + "op\030\003 \002(\021\022\016\n\006bottom\030\004 \002(\021\022%\n\010subtrees\030\007 \003" + + "(\0132\023.TransportStopsTree\022\035\n\005leafs\030\010 \003(\0132\016" + + ".TransportStop\022\016\n\006baseId\030\020 \001(\004\"~\n\024OsmAnd" + + "TransportIndex\022\037\n\006routes\030\003 \003(\0132\017.Transpo" + + "rtRoute\022\"\n\005stops\030\006 \001(\0132\023.TransportStopsT" + + "ree\022!\n\013stringTable\030\t \002(\0132\014.StringTableB\023" + + "\n\021net.osmand.binary" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -7123,11 +10013,19 @@ public final class OsmandOdb { internal_static_OsmAndStructure_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_OsmAndStructure_descriptor, - new java.lang.String[] { "Version", "MapIndex", "AddressIndex", "VersionConfirm", }, + new java.lang.String[] { "Version", "MapIndex", "AddressIndex", "TransportIndex", "VersionConfirm", }, net.osmand.binary.OsmandOdb.OsmAndStructure.class, net.osmand.binary.OsmandOdb.OsmAndStructure.Builder.class); - internal_static_OsmAndMapIndex_descriptor = + internal_static_StringTable_descriptor = getDescriptor().getMessageTypes().get(1); + internal_static_StringTable_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_StringTable_descriptor, + new java.lang.String[] { "S", }, + net.osmand.binary.OsmandOdb.StringTable.class, + net.osmand.binary.OsmandOdb.StringTable.Builder.class); + internal_static_OsmAndMapIndex_descriptor = + getDescriptor().getMessageTypes().get(2); internal_static_OsmAndMapIndex_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_OsmAndMapIndex_descriptor, @@ -7135,7 +10033,7 @@ public final class OsmandOdb { net.osmand.binary.OsmandOdb.OsmAndMapIndex.class, net.osmand.binary.OsmandOdb.OsmAndMapIndex.Builder.class); internal_static_MapRootLevel_descriptor = - getDescriptor().getMessageTypes().get(2); + getDescriptor().getMessageTypes().get(3); internal_static_MapRootLevel_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_MapRootLevel_descriptor, @@ -7143,21 +10041,13 @@ public final class OsmandOdb { net.osmand.binary.OsmandOdb.MapRootLevel.class, net.osmand.binary.OsmandOdb.MapRootLevel.Builder.class); internal_static_MapTree_descriptor = - getDescriptor().getMessageTypes().get(3); + getDescriptor().getMessageTypes().get(4); internal_static_MapTree_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_MapTree_descriptor, new java.lang.String[] { "Left", "Right", "Top", "Bottom", "StringTable", "BaseId", "Subtrees", "Leafs", }, net.osmand.binary.OsmandOdb.MapTree.class, net.osmand.binary.OsmandOdb.MapTree.Builder.class); - internal_static_StringTable_descriptor = - getDescriptor().getMessageTypes().get(4); - internal_static_StringTable_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_StringTable_descriptor, - new java.lang.String[] { "S", }, - net.osmand.binary.OsmandOdb.StringTable.class, - net.osmand.binary.OsmandOdb.StringTable.Builder.class); internal_static_MapData_descriptor = getDescriptor().getMessageTypes().get(5); internal_static_MapData_fieldAccessorTable = new @@ -7238,6 +10128,46 @@ public final class OsmandOdb { new java.lang.String[] { "Name", "NameEn", "Id", "Postcode", "X", "Y", }, net.osmand.binary.OsmandOdb.BuildingIndex.class, net.osmand.binary.OsmandOdb.BuildingIndex.Builder.class); + internal_static_TransportRoute_descriptor = + getDescriptor().getMessageTypes().get(15); + internal_static_TransportRoute_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_TransportRoute_descriptor, + new java.lang.String[] { "Id", "Type", "Operator", "Ref", "Name", "NameEn", "Distance", "DirectStops", "ReverseStops", }, + net.osmand.binary.OsmandOdb.TransportRoute.class, + net.osmand.binary.OsmandOdb.TransportRoute.Builder.class); + internal_static_TransportRouteStop_descriptor = + getDescriptor().getMessageTypes().get(16); + internal_static_TransportRouteStop_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_TransportRouteStop_descriptor, + new java.lang.String[] { "Id", "Dx", "Dy", "Name", "NameEn", }, + net.osmand.binary.OsmandOdb.TransportRouteStop.class, + net.osmand.binary.OsmandOdb.TransportRouteStop.Builder.class); + internal_static_TransportStop_descriptor = + getDescriptor().getMessageTypes().get(17); + internal_static_TransportStop_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_TransportStop_descriptor, + new java.lang.String[] { "Id", "Dx", "Dy", "Name", "NameEn", "Routes", }, + net.osmand.binary.OsmandOdb.TransportStop.class, + net.osmand.binary.OsmandOdb.TransportStop.Builder.class); + internal_static_TransportStopsTree_descriptor = + getDescriptor().getMessageTypes().get(18); + internal_static_TransportStopsTree_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_TransportStopsTree_descriptor, + new java.lang.String[] { "Left", "Right", "Top", "Bottom", "Subtrees", "Leafs", "BaseId", }, + net.osmand.binary.OsmandOdb.TransportStopsTree.class, + net.osmand.binary.OsmandOdb.TransportStopsTree.Builder.class); + internal_static_OsmAndTransportIndex_descriptor = + getDescriptor().getMessageTypes().get(19); + internal_static_OsmAndTransportIndex_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_OsmAndTransportIndex_descriptor, + new java.lang.String[] { "Routes", "Stops", "StringTable", }, + net.osmand.binary.OsmandOdb.OsmAndTransportIndex.class, + net.osmand.binary.OsmandOdb.OsmAndTransportIndex.Builder.class); return null; } }; diff --git a/DataExtractionOSM/src/net/osmand/data/index/DataIndexWriter.java b/DataExtractionOSM/src/net/osmand/data/index/DataIndexWriter.java index 8bd4ca1c0f..5a38f4a39e 100644 --- a/DataExtractionOSM/src/net/osmand/data/index/DataIndexWriter.java +++ b/DataExtractionOSM/src/net/osmand/data/index/DataIndexWriter.java @@ -134,7 +134,7 @@ public class DataIndexWriter { } - private static void writeRouteStops(PreparedStatement prepRouteStops, PreparedStatement prepStops, Map count, + private static void writeRouteStops(RTree transportStopsTree, PreparedStatement prepRouteStops, PreparedStatement prepStops, Map count, Set writtenStops, TransportRoute r, List stops, boolean direction) throws SQLException { int i = 0; for(TransportStop s : stops){ @@ -145,7 +145,16 @@ public class DataIndexWriter { prepStops.setDouble(IndexTransportStop.LONGITUDE.ordinal() + 1, s.getLocation().getLongitude()); prepStops.setString(IndexTransportStop.NAME.ordinal() + 1, s.getName()); prepStops.setString(IndexTransportStop.NAME_EN.ordinal() + 1, s.getEnName()); + int x = (int) MapUtils.getTileNumberX(24, s.getLocation().getLongitude()); + int y = (int) MapUtils.getTileNumberX(24, s.getLocation().getLatitude()); addBatch(count, prepStops); + try { + transportStopsTree.insert(new LeafElement(new Rect(x, y, x, y), s.getId())); + } catch (RTreeInsertException e) { + throw new IllegalArgumentException(e); + } catch (IllegalValueException e) { + throw new IllegalArgumentException(e); + } writtenStops.add(s.getId()); } assert IndexTransportRouteStop.values().length == 4; @@ -159,7 +168,8 @@ public class DataIndexWriter { public static void insertTransportIntoIndex(PreparedStatement prepRoute, PreparedStatement prepRouteStops, - PreparedStatement prepStops, Set writtenStops, TransportRoute route, Map statements, + PreparedStatement prepStops, RTree transportStopsTree, + Set writtenStops, TransportRoute route, Map statements, int batchSize) throws SQLException { assert IndexTransportRoute.values().length == 7; prepRoute.setLong(IndexTransportRoute.ID.ordinal() + 1, route.getId()); @@ -171,8 +181,8 @@ public class DataIndexWriter { prepRoute.setInt(IndexTransportRoute.DIST.ordinal() + 1, route.getAvgBothDistance()); addBatch(statements, prepRoute); - writeRouteStops(prepRouteStops, prepStops, statements, writtenStops, route, route.getForwardStops(), true); - writeRouteStops(prepRouteStops, prepStops, statements, writtenStops, route, route.getBackwardStops(), false); + writeRouteStops(transportStopsTree, prepRouteStops, prepStops, statements, writtenStops, route, route.getForwardStops(), true); + writeRouteStops(transportStopsTree, prepRouteStops, prepStops, statements, writtenStops, route, route.getBackwardStops(), false); } @@ -268,8 +278,6 @@ public class DataIndexWriter { mapBinaryStat.setInt(IndexBinaryMapRenderObject.HIGHWAY.ordinal() + 1, highwayAttributes); mapBinaryStat.setString(IndexBinaryMapRenderObject.NAME.ordinal() + 1, name); addBatch(statements, mapBinaryStat); - - try { mapTree.insert(new LeafElement(new Rect(minX, minY, maxX, maxY), id)); } catch (RTreeInsertException e1) { diff --git a/DataExtractionOSM/src/net/osmand/data/index/IndexBatchCreator.java b/DataExtractionOSM/src/net/osmand/data/index/IndexBatchCreator.java index 3f2dbe436a..43ab6d1b4c 100644 --- a/DataExtractionOSM/src/net/osmand/data/index/IndexBatchCreator.java +++ b/DataExtractionOSM/src/net/osmand/data/index/IndexBatchCreator.java @@ -282,8 +282,6 @@ public class IndexBatchCreator { indexCreator.setNormalizeStreets(true); indexCreator.setSaveAddressWays(writeWayNodes); - String transportFileName = regionName + "_" + IndexConstants.TRANSPORT_TABLE_VERSION + IndexConstants.TRANSPORT_INDEX_EXT; - indexCreator.setTransportFileName(transportFileName); String poiFileName = regionName + "_" + IndexConstants.POI_TABLE_VERSION + IndexConstants.POI_INDEX_EXT; indexCreator.setPoiFileName(poiFileName); String mapFileName = regionName + "_" + IndexConstants.BINARY_MAP_VERSION + IndexConstants.BINARY_MAP_INDEX_EXT; @@ -294,10 +292,7 @@ public class IndexBatchCreator { if (indexPOI) { uploadIndex(new File(indexDirFiles, poiFileName), alreadyUploadedFiles); } - if (indexTransport) { - uploadIndex(new File(indexDirFiles, transportFileName), alreadyUploadedFiles); - } - if (indexMap || indexAddress) { + if (indexMap || indexAddress || indexTransport) { uploadIndex(new File(indexDirFiles, mapFileName), alreadyUploadedFiles); } } catch (Exception e) { @@ -355,10 +350,21 @@ public class IndexBatchCreator { summary = "Transport index for "; } else if(f.getName().endsWith(IndexConstants.BINARY_MAP_INDEX_EXT) || f.getName().endsWith(IndexConstants.BINARY_MAP_INDEX_EXT_ZIP)){ regionName = f.getName().substring(0, f.getName().length() - IndexConstants.BINARY_MAP_INDEX_EXT.length() - 2); - summary = "Map index for "; - if(indexAddress){ - summary = "Address, " + summary; + summary = " index for "; + boolean fir = true; + if (indexAddress) { + summary = "Address" + (fir ? "" : ", ") + summary; + fir = false; } + if (indexTransport) { + summary = "Transport" + (fir ? "" : ", ") + summary; + fir = false; + } + if (indexMap) { + summary = "Map" + (fir ? "" : ", ") + summary; + fir = false; + } + } else { return; } diff --git a/DataExtractionOSM/src/net/osmand/data/index/IndexConstants.java b/DataExtractionOSM/src/net/osmand/data/index/IndexConstants.java index c5c3c9d8e7..f5092dac58 100644 --- a/DataExtractionOSM/src/net/osmand/data/index/IndexConstants.java +++ b/DataExtractionOSM/src/net/osmand/data/index/IndexConstants.java @@ -411,46 +411,6 @@ public class IndexConstants { } - public static String indexMapLocationsTable = "map_locations"; //$NON-NLS-1$ - public static String indexMapLocationsTable2 = "map_locations_2"; //$NON-NLS-1$ - public static String indexMapLocationsTable3 = "map_locations_3"; //$NON-NLS-1$ - - public enum IndexMapRenderObject implements IndexColumn { - ID("long", true), TYPE("integer"), NAME, NODES("BLOB"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - boolean index = false; - String type = null; - - private IndexMapRenderObject() { - } - - private IndexMapRenderObject(String type) { - this.type = type; - } - - private IndexMapRenderObject(String type, boolean index) { - this(type); - this.index = index; - } - - public static String getTable() { - return "map_objects"; //$NON-NLS-1$ - } - - public String getTableName() { - return getTable(); - } - - @Override - public String getType() { - return type; - } - - @Override - public boolean isIndex() { - return index; - } - } - public enum IndexBinaryMapRenderObject implements IndexColumn { ID("long", true), NAME, TYPES("BLOB"), RESTRICTIONS("BLOB"), NODES("BLOB"), HIGHWAY("INT"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ boolean index = false; diff --git a/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java b/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java index 5e9633a46c..e1244ca2e1 100644 --- a/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java +++ b/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java @@ -112,10 +112,9 @@ public class IndexCreator { private boolean normalizeStreets = true; // true by default private boolean saveAddressWays = true; // true by default + private boolean recreateOnlyBinaryFile = false; //false; private String regionName; - - private String transportFileName = null; private String poiFileName = null; private String mapFileName = null; private Long lastModifiedDate = null; @@ -136,23 +135,23 @@ public class IndexCreator { private PreparedStatement poiPreparedStatement; - Set visitedStops = new HashSet(); - private File transportIndexFile; - private Connection transportConnection; - private PreparedStatement transRouteStat; - private PreparedStatement transRouteStopsStat; - private PreparedStatement transStopsStat; - private File mapFile; private RandomAccessFile mapRAFile; private Connection mapConnection; + private PreparedStatement mapBinaryStat; + private PreparedStatement addressCityStat; private PreparedStatement addressStreetStat; private PreparedStatement addressBuildingStat; private PreparedStatement addressStreetNodeStat; - private PreparedStatement mapBinaryStat; + + private Set visitedStops = new HashSet(); + private PreparedStatement transRouteStat; + private PreparedStatement transRouteStopsStat; + private PreparedStatement transStopsStat; + private RTree transportStopsTree; private RTree[] mapTree = null; @@ -473,10 +472,6 @@ public class IndexCreator { this.poiFileName = poiFileName; } - public void setTransportFileName(String transportFileName) { - this.transportFileName = transportFileName; - } - public void setNodesDBFile(File file){ dbFile = file; } @@ -495,13 +490,6 @@ public class IndexCreator { return getMapFileName() + ".tmp"; } - public String getTransportFileName() { - if(transportFileName == null){ - return IndexConstants.TRANSPORT_INDEX_DIR + getRegionName() + IndexConstants.TRANSPORT_INDEX_EXT; - } - return transportFileName; - } - public Long getLastModifiedDate() { return lastModifiedDate; } @@ -967,7 +955,7 @@ public class IndexCreator { loadEntityData(e, true); TransportRoute route = indexTransportRoute((Relation) e); if (route != null) { - DataIndexWriter.insertTransportIntoIndex(transRouteStat, transRouteStopsStat, transStopsStat, visitedStops, route, + DataIndexWriter.insertTransportIntoIndex(transStopsStat, transRouteStat, transRouteStopsStat, transportStopsTree, visitedStops, route, pStatements, BATCH_SIZE); } } @@ -1493,7 +1481,7 @@ public class IndexCreator { waynodesStat = reader.getStreetsWayNodesPreparedStatement(mapConnection); } - int j=0; + int j = 0; for (; j < cities.size(); j++) { City c = cities.get(j); if (c.getType() != CityType.CITY && c.getType() != CityType.TOWN) { @@ -1621,6 +1609,141 @@ public class IndexCreator { } } + private int registerString(Map stringTable, String s) { + if (stringTable.containsKey(s)) { + return stringTable.get(s); + } + int size = stringTable.size(); + stringTable.put(s, size); + return size; + } + + private Map createStringTableForTransport(){ + Map stringTable = new LinkedHashMap(); + registerString(stringTable, "bus"); + registerString(stringTable, "trolleybus"); + registerString(stringTable, "subway"); + registerString(stringTable, "tram"); + registerString(stringTable, "share_taxi"); + registerString(stringTable, "taxi"); + registerString(stringTable, "train"); + registerString(stringTable, "ferry"); + return stringTable; + } + + public void writeBinaryTransportIndex(BinaryMapIndexWriter writer) throws IOException, SQLException { + try { + visitedStops = null; // allow gc to collect it + PreparedStatement selectTransportRouteData = mapConnection.prepareStatement("SELECT * FROM " + IndexTransportRoute.getTable()); + PreparedStatement selectTransportData = mapConnection.prepareStatement("SELECT S.stop, S.direction," + + " A.latitude, A.longitude, A.name, A.name_en " + + "FROM transport_route_stop S INNER JOIN transport_stop A ON A.id = S.stop ORDER BY S.ord ASC WHERE S.route = ?"); + + writer.startWriteTransportIndex(); + + // expect that memory would be enough + Map stringTable = createStringTableForTransport(); + + + ResultSet rs = selectTransportRouteData.executeQuery(); + List directStops = new ArrayList(); + List reverseStops = new ArrayList(); + while(rs.next()){ + long idRoute = rs.getLong(IndexTransportRoute.ID.ordinal() + 1); + int dist = rs.getInt(IndexTransportRoute.DIST.ordinal() + 1); + String routeName = rs.getString(IndexTransportRoute.NAME.ordinal() + 1); + String routeEnName = rs.getString(IndexTransportRoute.NAME_EN.ordinal() + 1); + if(routeEnName != null && routeEnName.equals(Junidecode.unidecode(routeName))){ + routeEnName = null; + } + String ref = rs.getString(IndexTransportRoute.REF.ordinal() + 1); + String operator = rs.getString(IndexTransportRoute.OPERATOR.ordinal() + 1); + String type = rs.getString(IndexTransportRoute.TYPE.ordinal() + 1); + + selectTransportData.setLong(1, idRoute); + ResultSet rset = selectTransportData.executeQuery(); + while (rset.next()) { + boolean dir = rset.getInt(2) != 0; + long idStop = rset.getInt(1); + String stopName = rset.getString(5); + String stopEnName = rset.getString(6); + if (stopEnName != null && stopEnName.equals(Junidecode.unidecode(stopName))) { + stopEnName = null; + } + TransportStop st = new TransportStop(); + st.setId(idStop); + st.setName(stopName); + st.setLocation(rset.getDouble(3), rset.getDouble(4)); + if (stopEnName != null) { + st.setEnName(stopEnName); + } + if(dir){ + directStops.add(st); + } else { + reverseStops.add(st); + } + } + writer.writeTransportRoute(idRoute, routeName, routeEnName, ref, operator, type, dist, directStops, reverseStops, stringTable); + } + rs.close(); + selectTransportRouteData.close(); + + + // TODO prepare transportStopsTree!!! + + PreparedStatement selectTransportStop = mapConnection.prepareStatement( + "SELECT A.id, A.latitude, A.longitude, A.name, A.name_en FROM transport_stop A where A.id = ?"); + PreparedStatement selectTransportRouteStop = mapConnection.prepareStatement( + "SELECT S.route FROM transport_route_stop S WHERE S.stop = ? "); + long rootIndex = transportStopsTree.getFileHdr().getRootIndex(); + rtree.Node root = transportStopsTree.getReadNode(rootIndex); + Rect rootBounds = calcBounds(root); + if (rootBounds != null) { + writer.startTransportTreeElement(rootBounds.getMinX(), rootBounds.getMaxX(), rootBounds.getMinY(), rootBounds.getMaxY()); + writeBinaryTransportTree(root, transportStopsTree, writer, selectTransportStop, selectTransportRouteStop); + writer.endWriteTransportTreeElement(); + } + + writer.writeTransportStringTable(stringTable); + + writer.endWriteTransportIndex(); + } catch (RTreeException e) { + throw new IllegalStateException(e); + } + } + + public void writeBinaryTransportTree(rtree.Node parent, RTree r, BinaryMapIndexWriter writer, + PreparedStatement selectTransportStop, PreparedStatement selectTransportRouteStop) throws IOException, RTreeException, SQLException { + Element[] e = parent.getAllElements(); + for (int i = 0; i < parent.getTotalElements(); i++) { + Rect re = e[i].getRect(); + if (e[i].getElementType() == rtree.Node.LEAF_NODE) { + long id = ((LeafElement) e[i]).getPtr(); + selectTransportStop.setLong(1, id); + selectTransportRouteStop.setLong(1, id); + ResultSet rs = selectTransportStop.executeQuery(); + if (rs.next()) { + + ResultSet rset = selectTransportRouteStop.executeQuery(); + while(rset.next()){ + + } + rset.close(); + } else { + log.error("Something goes wrong with id = " + id); + } + } else { + long ptr = ((NonLeafElement) e[i]).getPtr(); + rtree.Node ns = r.getReadNode(ptr); + + writer.startTransportTreeElement(re.getMinX(), re.getMaxX(), re.getMinY(), re.getMaxY()); + writeBinaryTransportTree(ns, r, writer, selectTransportStop, selectTransportRouteStop); + writer.endWriteTransportTreeElement(); + } + } + } + + public Rect calcBounds(rtree.Node n) { Rect r = null; @@ -1651,6 +1774,9 @@ public class IndexCreator { public String getRTreeMapIndexNonPackFileName(){ return mapFile.getAbsolutePath()+".rtree"; } + public String getRTreeTransportStopsFileName(){ + return mapFile.getAbsolutePath()+".trans"; + } public String getRTreeMapIndexPackFileName(){ return mapFile.getAbsolutePath()+".prtree"; @@ -1683,6 +1809,7 @@ public class IndexCreator { normalizeSuffixes = DataExtractionSettings.getSettings().getSuffixesToNormalizeStreets(); } + boolean success = false; // Main generation method try { ////////////////////////////////////////////////////////////////////////// @@ -1716,84 +1843,102 @@ public class IndexCreator { pselectRelation = dbConn.prepareStatement("select * from relations where id = ? order by ord"); pselectTags = dbConn.prepareStatement("select key, value from tags where id = ? and type = ?"); - // 2. Create index connections and index structure - createDatabaseIndexesStructure(); - - // 3. Processing all entries - // 3.1 write all cities - - if (indexAddress) { - progress.setGeneralProgress("[40 of 100]"); - progress.startTask("Indexing cities...", allNodes); - if (!loadFromPath) { - allNodes = iterateOverEntities(progress, EntityType.NODE, allNodes, STEP_CITY_NODES); + // do not create temp map file and rtree files + if (recreateOnlyBinaryFile) { + mapFile = new File(workingDir, getMapFileName()); + File tempDBMapFile = new File(workingDir, getTempMapDBFileName()); + mapConnection = DriverManager.getConnection("jdbc:sqlite:" + tempDBMapFile.getAbsolutePath()); + mapConnection.setAutoCommit(false); + mapTree = new RTree[MAP_ZOOMS.length - 1]; + try { + for (int i = 0; i < MAP_ZOOMS.length - 1; i++) { + mapTree[i] = new RTree(getRTreeMapIndexPackFileName() + i); + } + } catch (RTreeException e) { + log.error("Error flushing", e); + throw new IOException(e); } + } else { - for (City c : cities.values()) { - DataIndexWriter.writeCity(addressCityStat, pStatements, c, BATCH_SIZE); - } - // commit to put all cities - if (pStatements.get(addressCityStat) > 0) { - addressCityStat.executeBatch(); - pStatements.put(addressCityStat, 0); - mapConnection.commit(); - } + // 2. Create index connections and index structure + createDatabaseIndexesStructure(); - } + // 3. Processing all entries + // 3.1 write all cities - // 3.2 index address relations - if (indexAddress || indexMap) { - progress.setGeneralProgress("[40 of 100]"); - progress.startTask("Preindexing address and map ways...", allRelations); - allRelations = iterateOverEntities(progress, EntityType.RELATION, allRelations, STEP_ADDRESS_RELATIONS_AND_MULTYPOLYGONS); - // commit to put all cities if (indexAddress) { + progress.setGeneralProgress("[40 of 100]"); + progress.startTask("Indexing cities...", allNodes); + if (!loadFromPath) { + allNodes = iterateOverEntities(progress, EntityType.NODE, allNodes, STEP_CITY_NODES); + } + + for (City c : cities.values()) { + DataIndexWriter.writeCity(addressCityStat, pStatements, c, BATCH_SIZE); + } + // commit to put all cities + if (pStatements.get(addressCityStat) > 0) { + addressCityStat.executeBatch(); + pStatements.put(addressCityStat, 0); + mapConnection.commit(); + } + + } + + // 3.2 index address relations + if (indexAddress || indexMap) { + progress.setGeneralProgress("[40 of 100]"); + progress.startTask("Preindexing address and map ways...", allRelations); + allRelations = iterateOverEntities(progress, EntityType.RELATION, allRelations, + STEP_ADDRESS_RELATIONS_AND_MULTYPOLYGONS); + // commit to put all cities + if (indexAddress) { + if (pStatements.get(addressBuildingStat) > 0) { + addressBuildingStat.executeBatch(); + pStatements.put(addressBuildingStat, 0); + } + if (pStatements.get(addressStreetNodeStat) > 0) { + addressStreetNodeStat.executeBatch(); + pStatements.put(addressStreetNodeStat, 0); + } + mapConnection.commit(); + } + } + + // 3.3 MAIN iterate over all entities + progress.setGeneralProgress("[50 of 100]"); + progress.startTask("Processing osm nodes...", allNodes); + iterateOverEntities(progress, EntityType.NODE, allNodes, STEP_MAIN); + progress.setGeneralProgress("[70 of 100]"); + progress.startTask("Processing osm ways...", allWays); + iterateOverEntities(progress, EntityType.WAY, allWays, STEP_MAIN); + progress.setGeneralProgress("[85 of 100]"); + progress.startTask("Processing osm relations...", allRelations); + iterateOverEntities(progress, EntityType.RELATION, allRelations, STEP_MAIN); + + // 3.4 update all postal codes from relations + if (indexAddress && !postalCodeRelations.isEmpty()) { + progress.setGeneralProgress("[90 of 100]"); + progress.startTask("Registering postcodes...", -1); if (pStatements.get(addressBuildingStat) > 0) { addressBuildingStat.executeBatch(); pStatements.put(addressBuildingStat, 0); + mapConnection.commit(); } - if (pStatements.get(addressStreetNodeStat) > 0) { - addressStreetNodeStat.executeBatch(); - pStatements.put(addressStreetNodeStat, 0); - } - mapConnection.commit(); + processingPostcodes(); } - } - // 3.3 MAIN iterate over all entities - progress.setGeneralProgress("[50 of 100]"); - progress.startTask("Processing osm nodes...", allNodes); - iterateOverEntities(progress, EntityType.NODE, allNodes, STEP_MAIN); - progress.setGeneralProgress("[70 of 100]"); - progress.startTask("Processing osm nodes...", allWays); - iterateOverEntities(progress, EntityType.WAY, allWays, STEP_MAIN); - progress.setGeneralProgress("[85 of 100]"); - progress.startTask("Processing osm nodes...", allRelations); - iterateOverEntities(progress, EntityType.RELATION, allRelations, STEP_MAIN); - - - // 3.4 update all postal codes from relations - if (indexAddress && !postalCodeRelations.isEmpty()) { - progress.setGeneralProgress("[90 of 100]"); - progress.startTask("Registering postcodes...", -1); - if (pStatements.get(addressBuildingStat) > 0) { - addressBuildingStat.executeBatch(); - pStatements.put(addressBuildingStat, 0); - mapConnection.commit(); + // 4. packing map rtree indexes + if (indexMap) { + progress.setGeneralProgress("[90 of 100]"); + progress.startTask("Serializing map data...", -1); + packingRtreeMapIndexes(); + log.info("Finish packing RTree files"); } - processingPostcodes(); - } - - // 4. packing map rtree indexes - if (indexMap) { - progress.setGeneralProgress("[90 of 100]"); - progress.startTask("Serializing map data...", -1); - packingRtreeMapIndexes(); - log.info("Finish packing RTree files"); } // 5. Writing binary file - if(indexMap || indexAddress){ + if(indexMap || indexAddress || indexTransport){ if(mapFile.exists()){ mapFile.delete(); } @@ -1814,10 +1959,17 @@ public class IndexCreator { mapConnection.commit(); writeBinaryAddressIndex(writer, progress); } + if(indexTransport){ + progress.setGeneralProgress("[95 of 100]"); + progress.startTask("Writing transport index to binary file...", -1); + closePreparedStatements(transRouteStat, transRouteStopsStat, transStopsStat); + mapConnection.commit(); + } progress.finishTask(); writer.close(); log.info("Finish writing binary file"); } + success = true; } finally { try { if (pselectNode != null) { @@ -1847,21 +1999,6 @@ public class IndexCreator { poiIndexFile.setLastModified(lastModifiedDate); } } - if (transportConnection != null) { - transportConnection.commit(); - transportConnection.close(); - transportConnection = null; - if (lastModifiedDate != null) { - transportIndexFile.setLastModified(lastModifiedDate); - } - } - if (mapRAFile != null) { - mapRAFile.close(); - if (lastModifiedDate != null && mapFile.exists()) { - mapFile.setLastModified(lastModifiedDate); - } - } - if (mapConnection != null) { mapConnection.commit(); mapConnection.close(); @@ -1882,12 +2019,12 @@ public class IndexCreator { } for (int i = 0; i < mapTree.length; i++) { File f = new File(getRTreeMapIndexNonPackFileName() + i); - if (f.exists()) { - f.delete(); + if (f.exists() && success) { +// f.delete(); } f = new File(getRTreeMapIndexPackFileName() + i); - if (f.exists()) { - f.delete(); + if (f.exists() && success) { +// f.delete(); } } @@ -1997,7 +2134,7 @@ public class IndexCreator { private void createDatabaseIndexesStructure() throws SQLException, IOException { // 2.1 create temporary sqlite database to put temporary results to it - if (indexMap || indexTransport) { + if (indexMap || indexAddress || indexTransport) { mapFile = new File(workingDir, getMapFileName()); // to save space mapFile.getParentFile().mkdirs(); @@ -2075,35 +2212,37 @@ public class IndexCreator { } if (indexTransport) { - transportIndexFile = new File(workingDir, getTransportFileName()); - // to save space - if (transportIndexFile.exists()) { - transportIndexFile.delete(); + DataIndexWriter.createTransportIndexStructure(mapConnection); + try { + File file = new File(getRTreeTransportStopsFileName()); + if (file.exists()) { + file.delete(); + } + transportStopsTree = new RTree(file.getAbsolutePath()); + } catch (RTreeException e) { + throw new IOException(e); } - transportIndexFile.getParentFile().mkdirs(); - // creating nodes db to fast access for all nodes - transportConnection = DriverManager.getConnection("jdbc:sqlite:" + transportIndexFile.getAbsolutePath()); - - DataIndexWriter.createTransportIndexStructure(transportConnection); - transRouteStat = transportConnection.prepareStatement(IndexConstants.generatePrepareStatementToInsert(IndexTransportRoute + transRouteStat = mapConnection.prepareStatement(IndexConstants.generatePrepareStatementToInsert(IndexTransportRoute .getTable(), IndexTransportRoute.values().length)); - transRouteStopsStat = transportConnection.prepareStatement(IndexConstants.generatePrepareStatementToInsert( + transRouteStopsStat = mapConnection.prepareStatement(IndexConstants.generatePrepareStatementToInsert( IndexTransportRouteStop.getTable(), IndexTransportRouteStop.values().length)); - transStopsStat = transportConnection.prepareStatement(IndexConstants.generatePrepareStatementToInsert(IndexTransportStop + transStopsStat = mapConnection.prepareStatement(IndexConstants.generatePrepareStatementToInsert(IndexTransportStop .getTable(), IndexTransportStop.values().length)); pStatements.put(transRouteStat, 0); pStatements.put(transRouteStopsStat, 0); pStatements.put(transStopsStat, 0); - transportConnection.setAutoCommit(false); + mapConnection.setAutoCommit(false); } } protected void closePreparedStatements(PreparedStatement... preparedStatements) throws SQLException{ for(PreparedStatement p : preparedStatements){ - p.executeBatch(); - p.close(); - pStatements.remove(p); + if (p != null) { + p.executeBatch(); + p.close(); + pStatements.remove(p); + } } } @@ -2127,7 +2266,7 @@ public class IndexCreator { IndexCreator creator = new IndexCreator(new File("e:/Information/OSM maps/osmand/")); creator.setIndexMap(true); creator.setIndexAddress(true); - creator.setSaveAddressWays(true); + creator.setSaveAddressWays(false); creator.setNormalizeStreets(true); // creator.setIndexPOI(true); // creator.setIndexTransport(true); diff --git a/DataExtractionOSM/src/osmand_odb.proto b/DataExtractionOSM/src/osmand_odb.proto index a3e23979f4..0678468719 100644 --- a/DataExtractionOSM/src/osmand_odb.proto +++ b/DataExtractionOSM/src/osmand_odb.proto @@ -14,9 +14,18 @@ message OsmAndStructure { repeated OsmAndMapIndex mapIndex = 2; // encoded as fixed32 length delimited repeated OsmAndAddressIndex addressIndex = 3; + // encoded as fixed32 length delimited + repeated OsmAndTransportIndex transportIndex = 4; // last field should version again (to check consistency) required uint32 versionConfirm = 32; +} + +/** + String table, contains the common strings in each block. + */ +message StringTable { + repeated string s = 1; } @@ -51,16 +60,9 @@ message MapTree { repeated MapTree subtrees = 7; repeated MapData leafs = 8; - } -// These messages could be read directly -/** - String table, contains the common strings in each block. - */ -message StringTable { - repeated string s = 1; -} + /// Simple messages @@ -76,7 +78,7 @@ message MapData { optional int32 highwayMeta = 6; } - +/// Address messages message OsmAndAddressIndex { @@ -120,7 +122,6 @@ message CityIndex { } message InteresectedStreets { - repeated StreetIntersection intersections = 5; } @@ -162,4 +163,68 @@ message BuildingIndex { required sint32 x = 3; // delta encoded to street 24 zoom required sint32 y = 4; // delta encoded to street 24 zoom +} + +// transport messages + +message TransportRoute { + required uint64 id = 1; + + optional uint32 type = 3; // reference in string table + optional uint32 operator = 4; // reference in string table + optional string ref = 5; + optional uint32 name = 6; // reference in string table + optional uint32 name_en = 7; // reference in string table + optional uint32 distance = 8; // distance in meters + + repeated TransportRouteStop directStops = 15; + repeated TransportRouteStop reverseStops = 16; +} + +message TransportRouteStop { + required sint64 id = 1; // delta encoded to previous stop (first stop is delta to 0) + required sint32 dx = 2; // delta encoded to previous stop (24 zoom) + required sint32 dy = 3; // delta encoded to previous stop (24 zoom) + + required uint32 name = 6; // index in message table + optional uint32 name_en = 7; // index in message table +} + +message TransportStop { + required sint64 id = 1; // delta encoded to parent base id + required sint32 dx = 2; // delta encoded to parent (24 zoom) + required sint32 dy = 3; // delta encoded to parent (24 zoom) + + required uint32 name = 6; // index in message table + optional uint32 name_en = 7; // index in message table + + repeated uint32 routes = 16; // -shift to transport route containing that stop + // (TransportStop.Message.start - routes[i] = TransportRoute.Message.start) + +} + +message TransportStopsTree { + required sint32 left = 1; // delta encoded (24 zoom) + required sint32 right = 2; // delta encoded (24 zoom) + required sint32 top = 3; // delta encoded (24 zoom) + required sint32 bottom = 4; // delta encoded (24 zoom) + + // encoded as fixed32 length delimited + repeated TransportStopsTree subtrees = 7; + + repeated TransportStop leafs = 8; + + // written as last + optional uint64 baseId = 16; +} + +message OsmAndTransportIndex { + + repeated TransportRoute routes = 3; // routes + + // encoded as fixed32 length delimited + optional TransportStopsTree stops = 6; + + + required StringTable stringTable = 9; } \ No newline at end of file diff --git a/DataExtractionOSM/src/rtree/Pack.java b/DataExtractionOSM/src/rtree/Pack.java index cca3c92926..c51b1fa2d4 100644 --- a/DataExtractionOSM/src/rtree/Pack.java +++ b/DataExtractionOSM/src/rtree/Pack.java @@ -81,6 +81,8 @@ public class Pack return 2; } } + + public final int BUFFER_SIZE = 8192; private int packTree(Element[] elmts, RTree rtree, String newFile) { try{ @@ -112,10 +114,11 @@ public class Pack //overwrite the old rtree file with the temp file FileInputStream fis=new FileInputStream(tmpPckFile); FileOutputStream fos=new FileOutputStream(fo); - int i=fis.available(); - byte b[]=new byte[i]; - while((i=fis.read(b))!=-1) - fos.write(b); + byte b[]=new byte[BUFFER_SIZE]; + int i; + while((i=fis.read(b))!=-1){ + fos.write(b, 0, i); + } fos.close(); fis.close(); rFile.close();