diff --git a/OsmAnd-java/src/net/osmand/map/OsmandRegionInfo.java b/OsmAnd-java/src/net/osmand/map/OsmandRegionInfo.java deleted file mode 100644 index 6d5011ae25..0000000000 --- a/OsmAnd-java/src/net/osmand/map/OsmandRegionInfo.java +++ /dev/null @@ -1,1214 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: DataExtractionOSM/src/osmand_region_info.proto - -package net.osmand.map; - -public final class OsmandRegionInfo { - private OsmandRegionInfo() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistryLite registry) { - } - public static final class OsmAndRegionInfo extends - com.google.protobuf.GeneratedMessageLite { - // Use OsmAndRegionInfo.newBuilder() to construct. - private OsmAndRegionInfo() { - initFields(); - } - private OsmAndRegionInfo(boolean noInit) {} - - private static final OsmAndRegionInfo defaultInstance; - public static OsmAndRegionInfo getDefaultInstance() { - return defaultInstance; - } - - @Override - public OsmAndRegionInfo getDefaultInstanceForType() { - return defaultInstance; - } - - // optional .OsmAndRegions regionInfo = 1; - public static final int REGIONINFO_FIELD_NUMBER = 1; - private boolean hasRegionInfo; - private net.osmand.map.OsmandRegionInfo.OsmAndRegions regionInfo_; - public boolean hasRegionInfo() { return hasRegionInfo; } - public net.osmand.map.OsmandRegionInfo.OsmAndRegions getRegionInfo() { return regionInfo_; } - - private void initFields() { - regionInfo_ = net.osmand.map.OsmandRegionInfo.OsmAndRegions.getDefaultInstance(); - } - @Override - public final boolean isInitialized() { - if (hasRegionInfo()) { - if (!getRegionInfo().isInitialized()) return false; - } - return true; - } - - @Override - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (hasRegionInfo()) { - output.writeMessage(1, getRegionInfo()); - } - } - - private int memoizedSerializedSize = -1; - @Override - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (hasRegionInfo()) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, getRegionInfo()); - } - memoizedSerializedSize = size; - return size; - } - - public static net.osmand.map.OsmandRegionInfo.OsmAndRegionInfo parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static net.osmand.map.OsmandRegionInfo.OsmAndRegionInfo 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.map.OsmandRegionInfo.OsmAndRegionInfo parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static net.osmand.map.OsmandRegionInfo.OsmAndRegionInfo parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static net.osmand.map.OsmandRegionInfo.OsmAndRegionInfo parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static net.osmand.map.OsmandRegionInfo.OsmAndRegionInfo parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static net.osmand.map.OsmandRegionInfo.OsmAndRegionInfo 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.map.OsmandRegionInfo.OsmAndRegionInfo 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.map.OsmandRegionInfo.OsmAndRegionInfo parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static net.osmand.map.OsmandRegionInfo.OsmAndRegionInfo 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(); } - @Override - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(net.osmand.map.OsmandRegionInfo.OsmAndRegionInfo prototype) { - return newBuilder().mergeFrom(prototype); - } - @Override - public Builder toBuilder() { return newBuilder(this); } - - public static final class Builder extends - com.google.protobuf.GeneratedMessageLite.Builder< - net.osmand.map.OsmandRegionInfo.OsmAndRegionInfo, Builder> { - private net.osmand.map.OsmandRegionInfo.OsmAndRegionInfo result; - - // Construct using net.osmand.map.OsmandRegionInfo.OsmAndRegionInfo.newBuilder() - private Builder() {} - - private static Builder create() { - Builder builder = new Builder(); - builder.result = new net.osmand.map.OsmandRegionInfo.OsmAndRegionInfo(); - return builder; - } - - @Override - protected net.osmand.map.OsmandRegionInfo.OsmAndRegionInfo internalGetResult() { - return result; - } - - @Override - public Builder clear() { - if (result == null) { - throw new IllegalStateException( - "Cannot call clear() after build()."); - } - result = new net.osmand.map.OsmandRegionInfo.OsmAndRegionInfo(); - return this; - } - - @Override - public Builder clone() { - return create().mergeFrom(result); - } - - @Override - public net.osmand.map.OsmandRegionInfo.OsmAndRegionInfo getDefaultInstanceForType() { - return net.osmand.map.OsmandRegionInfo.OsmAndRegionInfo.getDefaultInstance(); - } - - @Override - public boolean isInitialized() { - return result.isInitialized(); - } - @Override - public net.osmand.map.OsmandRegionInfo.OsmAndRegionInfo build() { - if (result != null && !isInitialized()) { - throw newUninitializedMessageException(result); - } - return buildPartial(); - } - - private net.osmand.map.OsmandRegionInfo.OsmAndRegionInfo buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return buildPartial(); - } - - @Override - public net.osmand.map.OsmandRegionInfo.OsmAndRegionInfo buildPartial() { - if (result == null) { - throw new IllegalStateException( - "build() has already been called on this Builder."); - } - net.osmand.map.OsmandRegionInfo.OsmAndRegionInfo returnMe = result; - result = null; - return returnMe; - } - - @Override - public Builder mergeFrom(net.osmand.map.OsmandRegionInfo.OsmAndRegionInfo other) { - if (other == net.osmand.map.OsmandRegionInfo.OsmAndRegionInfo.getDefaultInstance()) return this; - if (other.hasRegionInfo()) { - mergeRegionInfo(other.getRegionInfo()); - } - return this; - } - - @Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - return this; - default: { - if (!parseUnknownField(input, extensionRegistry, tag)) { - return this; - } - break; - } - case 10: { - net.osmand.map.OsmandRegionInfo.OsmAndRegions.Builder subBuilder = net.osmand.map.OsmandRegionInfo.OsmAndRegions.newBuilder(); - if (hasRegionInfo()) { - subBuilder.mergeFrom(getRegionInfo()); - } - input.readMessage(subBuilder, extensionRegistry); - setRegionInfo(subBuilder.buildPartial()); - break; - } - } - } - } - - - // optional .OsmAndRegions regionInfo = 1; - public boolean hasRegionInfo() { - return result.hasRegionInfo(); - } - public net.osmand.map.OsmandRegionInfo.OsmAndRegions getRegionInfo() { - return result.getRegionInfo(); - } - public Builder setRegionInfo(net.osmand.map.OsmandRegionInfo.OsmAndRegions value) { - if (value == null) { - throw new NullPointerException(); - } - result.hasRegionInfo = true; - result.regionInfo_ = value; - return this; - } - public Builder setRegionInfo(net.osmand.map.OsmandRegionInfo.OsmAndRegions.Builder builderForValue) { - result.hasRegionInfo = true; - result.regionInfo_ = builderForValue.build(); - return this; - } - public Builder mergeRegionInfo(net.osmand.map.OsmandRegionInfo.OsmAndRegions value) { - if (result.hasRegionInfo() && - result.regionInfo_ != net.osmand.map.OsmandRegionInfo.OsmAndRegions.getDefaultInstance()) { - result.regionInfo_ = - net.osmand.map.OsmandRegionInfo.OsmAndRegions.newBuilder(result.regionInfo_).mergeFrom(value).buildPartial(); - } else { - result.regionInfo_ = value; - } - result.hasRegionInfo = true; - return this; - } - public Builder clearRegionInfo() { - result.hasRegionInfo = false; - result.regionInfo_ = net.osmand.map.OsmandRegionInfo.OsmAndRegions.getDefaultInstance(); - return this; - } - - // @@protoc_insertion_point(builder_scope:OsmAndRegionInfo) - } - - static { - defaultInstance = new OsmAndRegionInfo(true); - net.osmand.map.OsmandRegionInfo.internalForceInit(); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:OsmAndRegionInfo) - } - - public static final class OsmAndRegions extends - com.google.protobuf.GeneratedMessageLite { - // Use OsmAndRegions.newBuilder() to construct. - private OsmAndRegions() { - initFields(); - } - private OsmAndRegions(boolean noInit) {} - - private static final OsmAndRegions defaultInstance; - public static OsmAndRegions getDefaultInstance() { - return defaultInstance; - } - - @Override - public OsmAndRegions getDefaultInstanceForType() { - return defaultInstance; - } - - // repeated .OsmAndRegion regions = 3; - public static final int REGIONS_FIELD_NUMBER = 3; - private java.util.List regions_ = - java.util.Collections.emptyList(); - public java.util.List getRegionsList() { - return regions_; - } - public int getRegionsCount() { return regions_.size(); } - public net.osmand.map.OsmandRegionInfo.OsmAndRegion getRegions(int index) { - return regions_.get(index); - } - - private void initFields() { - } - @Override - public final boolean isInitialized() { - for (net.osmand.map.OsmandRegionInfo.OsmAndRegion element : getRegionsList()) { - if (!element.isInitialized()) return false; - } - return true; - } - - @Override - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - for (net.osmand.map.OsmandRegionInfo.OsmAndRegion element : getRegionsList()) { - output.writeMessage(3, element); - } - } - - private int memoizedSerializedSize = -1; - @Override - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - for (net.osmand.map.OsmandRegionInfo.OsmAndRegion element : getRegionsList()) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, element); - } - memoizedSerializedSize = size; - return size; - } - - public static net.osmand.map.OsmandRegionInfo.OsmAndRegions parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static net.osmand.map.OsmandRegionInfo.OsmAndRegions 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.map.OsmandRegionInfo.OsmAndRegions parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static net.osmand.map.OsmandRegionInfo.OsmAndRegions parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static net.osmand.map.OsmandRegionInfo.OsmAndRegions parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static net.osmand.map.OsmandRegionInfo.OsmAndRegions parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static net.osmand.map.OsmandRegionInfo.OsmAndRegions 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.map.OsmandRegionInfo.OsmAndRegions 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.map.OsmandRegionInfo.OsmAndRegions parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static net.osmand.map.OsmandRegionInfo.OsmAndRegions 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(); } - @Override - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(net.osmand.map.OsmandRegionInfo.OsmAndRegions prototype) { - return newBuilder().mergeFrom(prototype); - } - @Override - public Builder toBuilder() { return newBuilder(this); } - - public static final class Builder extends - com.google.protobuf.GeneratedMessageLite.Builder< - net.osmand.map.OsmandRegionInfo.OsmAndRegions, Builder> { - private net.osmand.map.OsmandRegionInfo.OsmAndRegions result; - - // Construct using net.osmand.map.OsmandRegionInfo.OsmAndRegions.newBuilder() - private Builder() {} - - private static Builder create() { - Builder builder = new Builder(); - builder.result = new net.osmand.map.OsmandRegionInfo.OsmAndRegions(); - return builder; - } - - @Override - protected net.osmand.map.OsmandRegionInfo.OsmAndRegions internalGetResult() { - return result; - } - - @Override - public Builder clear() { - if (result == null) { - throw new IllegalStateException( - "Cannot call clear() after build()."); - } - result = new net.osmand.map.OsmandRegionInfo.OsmAndRegions(); - return this; - } - - @Override - public Builder clone() { - return create().mergeFrom(result); - } - - @Override - public net.osmand.map.OsmandRegionInfo.OsmAndRegions getDefaultInstanceForType() { - return net.osmand.map.OsmandRegionInfo.OsmAndRegions.getDefaultInstance(); - } - - @Override - public boolean isInitialized() { - return result.isInitialized(); - } - @Override - public net.osmand.map.OsmandRegionInfo.OsmAndRegions build() { - if (result != null && !isInitialized()) { - throw newUninitializedMessageException(result); - } - return buildPartial(); - } - - private net.osmand.map.OsmandRegionInfo.OsmAndRegions buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return buildPartial(); - } - - @Override - public net.osmand.map.OsmandRegionInfo.OsmAndRegions buildPartial() { - if (result == null) { - throw new IllegalStateException( - "build() has already been called on this Builder."); - } - if (result.regions_ != java.util.Collections.EMPTY_LIST) { - result.regions_ = - java.util.Collections.unmodifiableList(result.regions_); - } - net.osmand.map.OsmandRegionInfo.OsmAndRegions returnMe = result; - result = null; - return returnMe; - } - - @Override - public Builder mergeFrom(net.osmand.map.OsmandRegionInfo.OsmAndRegions other) { - if (other == net.osmand.map.OsmandRegionInfo.OsmAndRegions.getDefaultInstance()) return this; - if (!other.regions_.isEmpty()) { - if (result.regions_.isEmpty()) { - result.regions_ = new java.util.ArrayList(); - } - result.regions_.addAll(other.regions_); - } - return this; - } - - @Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - return this; - default: { - if (!parseUnknownField(input, extensionRegistry, tag)) { - return this; - } - break; - } - case 26: { - net.osmand.map.OsmandRegionInfo.OsmAndRegion.Builder subBuilder = net.osmand.map.OsmandRegionInfo.OsmAndRegion.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addRegions(subBuilder.buildPartial()); - break; - } - } - } - } - - - // repeated .OsmAndRegion regions = 3; - public java.util.List getRegionsList() { - return java.util.Collections.unmodifiableList(result.regions_); - } - public int getRegionsCount() { - return result.getRegionsCount(); - } - public net.osmand.map.OsmandRegionInfo.OsmAndRegion getRegions(int index) { - return result.getRegions(index); - } - public Builder setRegions(int index, net.osmand.map.OsmandRegionInfo.OsmAndRegion value) { - if (value == null) { - throw new NullPointerException(); - } - result.regions_.set(index, value); - return this; - } - public Builder setRegions(int index, net.osmand.map.OsmandRegionInfo.OsmAndRegion.Builder builderForValue) { - result.regions_.set(index, builderForValue.build()); - return this; - } - public Builder addRegions(net.osmand.map.OsmandRegionInfo.OsmAndRegion value) { - if (value == null) { - throw new NullPointerException(); - } - if (result.regions_.isEmpty()) { - result.regions_ = new java.util.ArrayList(); - } - result.regions_.add(value); - return this; - } - public Builder addRegions(net.osmand.map.OsmandRegionInfo.OsmAndRegion.Builder builderForValue) { - if (result.regions_.isEmpty()) { - result.regions_ = new java.util.ArrayList(); - } - result.regions_.add(builderForValue.build()); - return this; - } - public Builder addAllRegions( - java.lang.Iterable values) { - if (result.regions_.isEmpty()) { - result.regions_ = new java.util.ArrayList(); - } - super.addAll(values, result.regions_); - return this; - } - public Builder clearRegions() { - result.regions_ = java.util.Collections.emptyList(); - return this; - } - - // @@protoc_insertion_point(builder_scope:OsmAndRegions) - } - - static { - defaultInstance = new OsmAndRegions(true); - net.osmand.map.OsmandRegionInfo.internalForceInit(); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:OsmAndRegions) - } - - public static final class OsmAndRegion extends - com.google.protobuf.GeneratedMessageLite { - // Use OsmAndRegion.newBuilder() to construct. - private OsmAndRegion() { - initFields(); - } - private OsmAndRegion(boolean noInit) {} - - private static final OsmAndRegion defaultInstance; - public static OsmAndRegion getDefaultInstance() { - return defaultInstance; - } - - @Override - public OsmAndRegion getDefaultInstanceForType() { - return defaultInstance; - } - - // optional string continentName = 1; - public static final int CONTINENTNAME_FIELD_NUMBER = 1; - private boolean hasContinentName; - private java.lang.String continentName_ = ""; - public boolean hasContinentName() { return hasContinentName; } - public java.lang.String getContinentName() { return continentName_; } - - // required string name = 2; - public static final int NAME_FIELD_NUMBER = 2; - private boolean hasName; - private java.lang.String name_ = ""; - public boolean hasName() { return hasName; } - public java.lang.String getName() { return name_; } - - // repeated int32 degX = 4 [packed = true]; - public static final int DEGX_FIELD_NUMBER = 4; - private java.util.List degX_ = - java.util.Collections.emptyList(); - public java.util.List getDegXList() { - return degX_; - } - public int getDegXCount() { return degX_.size(); } - public int getDegX(int index) { - return degX_.get(index); - } - private int degXMemoizedSerializedSize = -1; - - // repeated int32 degY = 5 [packed = true]; - public static final int DEGY_FIELD_NUMBER = 5; - private java.util.List degY_ = - java.util.Collections.emptyList(); - public java.util.List getDegYList() { - return degY_; - } - public int getDegYCount() { return degY_.size(); } - public int getDegY(int index) { - return degY_.get(index); - } - private int degYMemoizedSerializedSize = -1; - - // repeated .OsmAndRegion subregions = 8; - public static final int SUBREGIONS_FIELD_NUMBER = 8; - private java.util.List subregions_ = - java.util.Collections.emptyList(); - public java.util.List getSubregionsList() { - return subregions_; - } - public int getSubregionsCount() { return subregions_.size(); } - public net.osmand.map.OsmandRegionInfo.OsmAndRegion getSubregions(int index) { - return subregions_.get(index); - } - - private void initFields() { - } - @Override - public final boolean isInitialized() { - if (!hasName) return false; - for (net.osmand.map.OsmandRegionInfo.OsmAndRegion element : getSubregionsList()) { - if (!element.isInitialized()) return false; - } - return true; - } - - @Override - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (hasContinentName()) { - output.writeString(1, getContinentName()); - } - if (hasName()) { - output.writeString(2, getName()); - } - if (getDegXList().size() > 0) { - output.writeRawVarint32(34); - output.writeRawVarint32(degXMemoizedSerializedSize); - } - for (int element : getDegXList()) { - output.writeInt32NoTag(element); - } - if (getDegYList().size() > 0) { - output.writeRawVarint32(42); - output.writeRawVarint32(degYMemoizedSerializedSize); - } - for (int element : getDegYList()) { - output.writeInt32NoTag(element); - } - for (net.osmand.map.OsmandRegionInfo.OsmAndRegion element : getSubregionsList()) { - output.writeMessage(8, element); - } - } - - private int memoizedSerializedSize = -1; - @Override - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (hasContinentName()) { - size += com.google.protobuf.CodedOutputStream - .computeStringSize(1, getContinentName()); - } - if (hasName()) { - size += com.google.protobuf.CodedOutputStream - .computeStringSize(2, getName()); - } - { - int dataSize = 0; - for (int element : getDegXList()) { - dataSize += com.google.protobuf.CodedOutputStream - .computeInt32SizeNoTag(element); - } - size += dataSize; - if (!getDegXList().isEmpty()) { - size += 1; - size += com.google.protobuf.CodedOutputStream - .computeInt32SizeNoTag(dataSize); - } - degXMemoizedSerializedSize = dataSize; - } - { - int dataSize = 0; - for (int element : getDegYList()) { - dataSize += com.google.protobuf.CodedOutputStream - .computeInt32SizeNoTag(element); - } - size += dataSize; - if (!getDegYList().isEmpty()) { - size += 1; - size += com.google.protobuf.CodedOutputStream - .computeInt32SizeNoTag(dataSize); - } - degYMemoizedSerializedSize = dataSize; - } - for (net.osmand.map.OsmandRegionInfo.OsmAndRegion element : getSubregionsList()) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(8, element); - } - memoizedSerializedSize = size; - return size; - } - - public static net.osmand.map.OsmandRegionInfo.OsmAndRegion parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static net.osmand.map.OsmandRegionInfo.OsmAndRegion 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.map.OsmandRegionInfo.OsmAndRegion parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static net.osmand.map.OsmandRegionInfo.OsmAndRegion parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static net.osmand.map.OsmandRegionInfo.OsmAndRegion parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static net.osmand.map.OsmandRegionInfo.OsmAndRegion parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static net.osmand.map.OsmandRegionInfo.OsmAndRegion 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.map.OsmandRegionInfo.OsmAndRegion 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.map.OsmandRegionInfo.OsmAndRegion parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static net.osmand.map.OsmandRegionInfo.OsmAndRegion 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(); } - @Override - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(net.osmand.map.OsmandRegionInfo.OsmAndRegion prototype) { - return newBuilder().mergeFrom(prototype); - } - @Override - public Builder toBuilder() { return newBuilder(this); } - - public static final class Builder extends - com.google.protobuf.GeneratedMessageLite.Builder< - net.osmand.map.OsmandRegionInfo.OsmAndRegion, Builder> { - private net.osmand.map.OsmandRegionInfo.OsmAndRegion result; - - // Construct using net.osmand.map.OsmandRegionInfo.OsmAndRegion.newBuilder() - private Builder() {} - - private static Builder create() { - Builder builder = new Builder(); - builder.result = new net.osmand.map.OsmandRegionInfo.OsmAndRegion(); - return builder; - } - - @Override - protected net.osmand.map.OsmandRegionInfo.OsmAndRegion internalGetResult() { - return result; - } - - @Override - public Builder clear() { - if (result == null) { - throw new IllegalStateException( - "Cannot call clear() after build()."); - } - result = new net.osmand.map.OsmandRegionInfo.OsmAndRegion(); - return this; - } - - @Override - public Builder clone() { - return create().mergeFrom(result); - } - - @Override - public net.osmand.map.OsmandRegionInfo.OsmAndRegion getDefaultInstanceForType() { - return net.osmand.map.OsmandRegionInfo.OsmAndRegion.getDefaultInstance(); - } - - @Override - public boolean isInitialized() { - return result.isInitialized(); - } - @Override - public net.osmand.map.OsmandRegionInfo.OsmAndRegion build() { - if (result != null && !isInitialized()) { - throw newUninitializedMessageException(result); - } - return buildPartial(); - } - - private net.osmand.map.OsmandRegionInfo.OsmAndRegion buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return buildPartial(); - } - - @Override - public net.osmand.map.OsmandRegionInfo.OsmAndRegion buildPartial() { - if (result == null) { - throw new IllegalStateException( - "build() has already been called on this Builder."); - } - if (result.degX_ != java.util.Collections.EMPTY_LIST) { - result.degX_ = - java.util.Collections.unmodifiableList(result.degX_); - } - if (result.degY_ != java.util.Collections.EMPTY_LIST) { - result.degY_ = - java.util.Collections.unmodifiableList(result.degY_); - } - if (result.subregions_ != java.util.Collections.EMPTY_LIST) { - result.subregions_ = - java.util.Collections.unmodifiableList(result.subregions_); - } - net.osmand.map.OsmandRegionInfo.OsmAndRegion returnMe = result; - result = null; - return returnMe; - } - - @Override - public Builder mergeFrom(net.osmand.map.OsmandRegionInfo.OsmAndRegion other) { - if (other == net.osmand.map.OsmandRegionInfo.OsmAndRegion.getDefaultInstance()) return this; - if (other.hasContinentName()) { - setContinentName(other.getContinentName()); - } - if (other.hasName()) { - setName(other.getName()); - } - if (!other.degX_.isEmpty()) { - if (result.degX_.isEmpty()) { - result.degX_ = new java.util.ArrayList(); - } - result.degX_.addAll(other.degX_); - } - if (!other.degY_.isEmpty()) { - if (result.degY_.isEmpty()) { - result.degY_ = new java.util.ArrayList(); - } - result.degY_.addAll(other.degY_); - } - if (!other.subregions_.isEmpty()) { - if (result.subregions_.isEmpty()) { - result.subregions_ = new java.util.ArrayList(); - } - result.subregions_.addAll(other.subregions_); - } - return this; - } - - @Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - return this; - default: { - if (!parseUnknownField(input, extensionRegistry, tag)) { - return this; - } - break; - } - case 10: { - setContinentName(input.readString()); - break; - } - case 18: { - setName(input.readString()); - break; - } - case 32: { - addDegX(input.readInt32()); - break; - } - case 34: { - int length = input.readRawVarint32(); - int limit = input.pushLimit(length); - while (input.getBytesUntilLimit() > 0) { - addDegX(input.readInt32()); - } - input.popLimit(limit); - break; - } - case 40: { - addDegY(input.readInt32()); - break; - } - case 42: { - int length = input.readRawVarint32(); - int limit = input.pushLimit(length); - while (input.getBytesUntilLimit() > 0) { - addDegY(input.readInt32()); - } - input.popLimit(limit); - break; - } - case 66: { - net.osmand.map.OsmandRegionInfo.OsmAndRegion.Builder subBuilder = net.osmand.map.OsmandRegionInfo.OsmAndRegion.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addSubregions(subBuilder.buildPartial()); - break; - } - } - } - } - - - // optional string continentName = 1; - public boolean hasContinentName() { - return result.hasContinentName(); - } - public java.lang.String getContinentName() { - return result.getContinentName(); - } - public Builder setContinentName(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - result.hasContinentName = true; - result.continentName_ = value; - return this; - } - public Builder clearContinentName() { - result.hasContinentName = false; - result.continentName_ = getDefaultInstance().getContinentName(); - return this; - } - - // required string name = 2; - public boolean hasName() { - return result.hasName(); - } - public java.lang.String getName() { - return result.getName(); - } - public Builder setName(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - result.hasName = true; - result.name_ = value; - return this; - } - public Builder clearName() { - result.hasName = false; - result.name_ = getDefaultInstance().getName(); - return this; - } - - // repeated int32 degX = 4 [packed = true]; - public java.util.List getDegXList() { - return java.util.Collections.unmodifiableList(result.degX_); - } - public int getDegXCount() { - return result.getDegXCount(); - } - public int getDegX(int index) { - return result.getDegX(index); - } - public Builder setDegX(int index, int value) { - result.degX_.set(index, value); - return this; - } - public Builder addDegX(int value) { - if (result.degX_.isEmpty()) { - result.degX_ = new java.util.ArrayList(); - } - result.degX_.add(value); - return this; - } - public Builder addAllDegX( - java.lang.Iterable values) { - if (result.degX_.isEmpty()) { - result.degX_ = new java.util.ArrayList(); - } - super.addAll(values, result.degX_); - return this; - } - public Builder clearDegX() { - result.degX_ = java.util.Collections.emptyList(); - return this; - } - - // repeated int32 degY = 5 [packed = true]; - public java.util.List getDegYList() { - return java.util.Collections.unmodifiableList(result.degY_); - } - public int getDegYCount() { - return result.getDegYCount(); - } - public int getDegY(int index) { - return result.getDegY(index); - } - public Builder setDegY(int index, int value) { - result.degY_.set(index, value); - return this; - } - public Builder addDegY(int value) { - if (result.degY_.isEmpty()) { - result.degY_ = new java.util.ArrayList(); - } - result.degY_.add(value); - return this; - } - public Builder addAllDegY( - java.lang.Iterable values) { - if (result.degY_.isEmpty()) { - result.degY_ = new java.util.ArrayList(); - } - super.addAll(values, result.degY_); - return this; - } - public Builder clearDegY() { - result.degY_ = java.util.Collections.emptyList(); - return this; - } - - // repeated .OsmAndRegion subregions = 8; - public java.util.List getSubregionsList() { - return java.util.Collections.unmodifiableList(result.subregions_); - } - public int getSubregionsCount() { - return result.getSubregionsCount(); - } - public net.osmand.map.OsmandRegionInfo.OsmAndRegion getSubregions(int index) { - return result.getSubregions(index); - } - public Builder setSubregions(int index, net.osmand.map.OsmandRegionInfo.OsmAndRegion value) { - if (value == null) { - throw new NullPointerException(); - } - result.subregions_.set(index, value); - return this; - } - public Builder setSubregions(int index, net.osmand.map.OsmandRegionInfo.OsmAndRegion.Builder builderForValue) { - result.subregions_.set(index, builderForValue.build()); - return this; - } - public Builder addSubregions(net.osmand.map.OsmandRegionInfo.OsmAndRegion value) { - if (value == null) { - throw new NullPointerException(); - } - if (result.subregions_.isEmpty()) { - result.subregions_ = new java.util.ArrayList(); - } - result.subregions_.add(value); - return this; - } - public Builder addSubregions(net.osmand.map.OsmandRegionInfo.OsmAndRegion.Builder builderForValue) { - if (result.subregions_.isEmpty()) { - result.subregions_ = new java.util.ArrayList(); - } - result.subregions_.add(builderForValue.build()); - return this; - } - public Builder addAllSubregions( - java.lang.Iterable values) { - if (result.subregions_.isEmpty()) { - result.subregions_ = new java.util.ArrayList(); - } - super.addAll(values, result.subregions_); - return this; - } - public Builder clearSubregions() { - result.subregions_ = java.util.Collections.emptyList(); - return this; - } - - // @@protoc_insertion_point(builder_scope:OsmAndRegion) - } - - static { - defaultInstance = new OsmAndRegion(true); - net.osmand.map.OsmandRegionInfo.internalForceInit(); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:OsmAndRegion) - } - - - static { - } - - public static void internalForceInit() {} - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/OsmAnd-java/src/net/osmand/map/RegionCountry.java b/OsmAnd-java/src/net/osmand/map/RegionCountry.java index 2e4f773048..29cc7e8d26 100644 --- a/OsmAnd-java/src/net/osmand/map/RegionCountry.java +++ b/OsmAnd-java/src/net/osmand/map/RegionCountry.java @@ -5,9 +5,6 @@ import gnu.trove.list.array.TIntArrayList; import java.util.ArrayList; import java.util.List; -import net.osmand.map.OsmandRegionInfo.OsmAndRegion; -import net.osmand.util.Algorithms; - public class RegionCountry { public String continentName; public int left, right, top, bottom; @@ -146,45 +143,7 @@ public class RegionCountry { return regions; } - public static RegionCountry construct(OsmAndRegion reg) { - RegionCountry rc = new RegionCountry(); - if (reg.hasContinentName()) { - rc.continentName = reg.getContinentName(); - } - rc.name = reg.getName(); - int px = 0; - int py = 0; - for (int i = 0; i < reg.getDegXCount(); i++) { - px = reg.getDegX(i) + px; - py = reg.getDegY(i) + py; - rc.add(px, py); - } - for (int i = 0; i < reg.getSubregionsCount(); i++) { - rc.addSubregion(construct(reg.getSubregions(i))); - } - return rc; - } - public OsmAndRegion convert() { - OsmAndRegion.Builder reg = OsmAndRegion.newBuilder(); - // System.out.println(r.name + " " + r.tiles.size() + " ?= " + r.calculateTileSet(new TLongHashSet(), 8).size()); - int px = 0; - int py = 0; - for (int i = 0; i < this.getTileSize(); i++) { - reg.addDegX(this.getLon(i) - px); - reg.addDegY(this.getLat(i) - py); - px = this.getLon(i); - py = this.getLat(i); - } - String n = Algorithms.capitalizeFirstLetterAndLowercase(this.name.replace('_', ' ')); - reg.setName(n); - if(this.continentName != null) { - reg.setContinentName(Algorithms.capitalizeFirstLetterAndLowercase(this.continentName)); - } - for (RegionCountry c : this.regions) { - reg.addSubregions(c.convert()); - } - return reg.build(); - } + } \ No newline at end of file diff --git a/OsmAnd-java/src/net/osmand/map/RegionRegistry.java b/OsmAnd-java/src/net/osmand/map/RegionRegistry.java deleted file mode 100644 index b13be09cb4..0000000000 --- a/OsmAnd-java/src/net/osmand/map/RegionRegistry.java +++ /dev/null @@ -1,44 +0,0 @@ -package net.osmand.map; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; - -import net.osmand.PlatformUtil; -import net.osmand.map.OsmandRegionInfo.OsmAndRegionInfo; - -import org.apache.commons.logging.Log; - -public class RegionRegistry { - public static final String fileName = "countries.reginfo"; - private static final Log log = PlatformUtil.getLog(RegionRegistry.class); - private static RegionRegistry r = null; - - private List countries = new ArrayList(); - - public static RegionRegistry getRegionRegistry(){ - if(r == null) { - try { - long t = -System.currentTimeMillis(); - r = new RegionRegistry(); - InputStream in = RegionRegistry.class.getResourceAsStream(RegionRegistry.fileName); - OsmAndRegionInfo regInfo = OsmAndRegionInfo.newBuilder().mergeFrom(in).build(); - for(int j = 0; j < regInfo.getRegionInfo().getRegionsCount(); j++) { - r.countries.add(RegionCountry.construct(regInfo.getRegionInfo().getRegions(j))); - } - t += System.currentTimeMillis(); - log.info("Initialize regions from file" + t + " ms"); - } catch (IOException e) { - log.error("IO exception reading regions", e); - } - } - return r; - } - - - public List getCountries() { - return countries; - } - -} diff --git a/OsmAnd/src/net/osmand/plus/download/SrtmIndexItem.java b/OsmAnd/src/net/osmand/plus/download/SrtmIndexItem.java deleted file mode 100644 index 134b5e36b0..0000000000 --- a/OsmAnd/src/net/osmand/plus/download/SrtmIndexItem.java +++ /dev/null @@ -1,140 +0,0 @@ -package net.osmand.plus.download; - - -import java.io.File; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import net.osmand.IndexConstants; -import net.osmand.map.RegionCountry; -import net.osmand.plus.ClientContext; -import net.osmand.plus.R; -import net.osmand.plus.Version; - -public class SrtmIndexItem extends IndexItem { - - private RegionCountry item; - private List tilesToDownload = new ArrayList(); - public SrtmIndexItem(RegionCountry item, Map existingFileNames) { - super(fileName(item), "Elevation lines", "", item.getTileSize()+"", null); - this.item = item; - type = DownloadActivityType.SRTM_FILE; - updateExistingTiles(existingFileNames); - } - - public void updateExistingTiles(Map existingFileNames) { - tilesToDownload.clear(); - for (int i = 0; i < item.getTileSize(); i++) { - int lat = item.getLat(i); - int lon = item.getLon(i); - String fname = getFileName(lat, lon); - if (!existingFileNames.containsKey(fname + IndexConstants.BINARY_MAP_INDEX_EXT)) { - tilesToDownload.add(fname); - } - } - } - - private String getFileName(int lat, int lon) { - String fn = lat >= 0 ? "N" : "S"; - if(Math.abs(lat) < 10) { - fn += "0"; - } - fn += Math.abs(lat); - fn += lon >= 0 ? "e" : "w"; - if(Math.abs(lon) < 10) { - fn += "00"; - } else if(Math.abs(lon) < 100) { - fn += "0"; - } - fn += Math.abs(lon); - return fn; - } - - private static String fileName(RegionCountry r) { - if(r.parent == null) { - return (r.continentName + " " + r.name).trim(); - } else { - return (r.parent.continentName + " " + r.parent.name + " " + r.name).trim(); - } - } - - @Override - public boolean isAccepted() { - return true; - } - - @Override - public List createDownloadEntry(ClientContext ctx, DownloadActivityType type, - List downloadEntries) { - File parent = ctx.getAppPath(IndexConstants.SRTM_INDEX_DIR); - parent.mkdirs(); - List toDownload = new ArrayList(); - if (parent == null || !parent.exists()) { - ctx.showToastMessage(R.string.sd_dir_not_accessible); - } else { - for (String fileToDownload : tilesToDownload) { - DownloadEntry entry = new DownloadEntry(); - entry.type = type; - entry.baseName = fileToDownload; - String url = "http://" + IndexConstants.INDEX_DOWNLOAD_DOMAIN; - url += "/download?event=2&srtm=yes&"; - url += Version.getVersionAsURLParam(ctx) + "&"; - String fullName = fileToDownload + "_" + IndexConstants.BINARY_MAP_VERSION + IndexConstants.BINARY_MAP_INDEX_EXT_ZIP; - entry.urlToDownload = url +"file=" + fullName; - // url + "file=" + fileName; - entry.unzipFolder = false; - entry.zipStream = true; - entry.dateModified = System.currentTimeMillis(); - entry.sizeMB = 10; - entry.parts = 1; - entry.targetFile = new File(parent, entry.baseName + IndexConstants.BINARY_MAP_INDEX_EXT); - downloadEntries.add(entry); - toDownload.size(); - } - } - return downloadEntries; - } - - @Override - public String getTargetFileName() { - return fileName+".nonexistent"; - } - - @Override - public String getBasename() { - return fileName; - } - - @Override - public String getSizeDescription(ClientContext ctx) { - return (item.getTileSize() - tilesToDownload.size()) + "/" + item.getTileSize() + " " + ctx.getString(R.string.index_srtm_parts); - } - - @Override - public String getVisibleDescription(ClientContext ctx) { - return ctx.getString(R.string.index_srtm_ele); - } - - @Override - public boolean isAlreadyDownloaded(Map listAlreadyDownloaded) { - for (int i = 0; i < item.getTileSize(); i++) { - int lat = item.getLat(i); - int lon = item.getLon(i); - String fname = getFileName(lat, lon); - if (listAlreadyDownloaded.containsKey(fname + IndexConstants.BINARY_MAP_INDEX_EXT)) { - return true; - } - } - return false; - } - - @Override - public String getVisibleName(ClientContext ctx) { - if(item.parent == null) { - return item.name; - } else { - return item.parent.name +" "+item.name; - } - } -}