fix issue 178 and add rendering_types to binary format
git-svn-id: https://osmand.googlecode.com/svn/trunk@673 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
parent
3adc33fd6c
commit
242dd2fb1a
8 changed files with 838 additions and 144 deletions
|
@ -14,6 +14,8 @@ public class ToDoConstants {
|
|||
|
||||
// For 0.5 release
|
||||
// 102. Refactoring rendering schema serializing to xml and prepare script to create fast java builder (support pure xml)
|
||||
// Refactoring MapRenderingTypes to xml either
|
||||
// Input MAP_ZOOMS as parameter
|
||||
|
||||
// 86. Allow to add/edit custom tags to POI objects (Issue)
|
||||
// 92. Support poi index with standard map index and unify POI categories (unify done +)
|
||||
|
|
|
@ -17,7 +17,6 @@ import net.osmand.data.Building;
|
|||
import net.osmand.data.City;
|
||||
import net.osmand.data.PostCode;
|
||||
import net.osmand.data.Street;
|
||||
import net.osmand.data.TransportRoute;
|
||||
import net.osmand.data.TransportStop;
|
||||
import net.osmand.data.City.CityType;
|
||||
import net.osmand.osm.LatLon;
|
||||
|
@ -673,10 +672,16 @@ public class BinaryMapIndexReader {
|
|||
case OsmandOdb.OsmAndMapIndex.NAME_FIELD_NUMBER :
|
||||
index.setName(codedIS.readString());
|
||||
break;
|
||||
case OsmandOdb.OsmAndMapIndex.RULES_FIELD_NUMBER :
|
||||
int len = codedIS.readInt32();
|
||||
int oldLimit = codedIS.pushLimit(len);
|
||||
readMapEncodingRule(index);
|
||||
codedIS.popLimit(oldLimit);
|
||||
break;
|
||||
case OsmandOdb.OsmAndMapIndex.LEVELS_FIELD_NUMBER :
|
||||
int length = readInt();
|
||||
int filePointer = codedIS.getTotalBytesRead();
|
||||
int oldLimit = codedIS.pushLimit(length);
|
||||
oldLimit = codedIS.pushLimit(length);
|
||||
MapRoot mapRoot = readMapLevel();
|
||||
mapRoot.length = length;
|
||||
mapRoot.filePointer = filePointer;
|
||||
|
@ -691,6 +696,40 @@ public class BinaryMapIndexReader {
|
|||
}
|
||||
}
|
||||
|
||||
private void readMapEncodingRule(MapIndex index) throws IOException {
|
||||
int subtype = 0;
|
||||
int type = 0;
|
||||
String tags = null;
|
||||
String val = null;
|
||||
while(true){
|
||||
int t = codedIS.readTag();
|
||||
int tag = WireFormat.getTagFieldNumber(t);
|
||||
switch (tag) {
|
||||
case 0:
|
||||
if(!index.encodingRules.containsKey(tags)){
|
||||
index.encodingRules.put(tags, new LinkedHashMap<String, Integer>());
|
||||
}
|
||||
index.encodingRules.get(tags).put(val, ((subtype << 5) | type));
|
||||
return;
|
||||
case OsmandOdb.MapEncodingRule.VALUE_FIELD_NUMBER :
|
||||
val = codedIS.readString();
|
||||
break;
|
||||
case OsmandOdb.MapEncodingRule.TAG_FIELD_NUMBER :
|
||||
tags = codedIS.readString();
|
||||
break;
|
||||
case OsmandOdb.MapEncodingRule.SUBTYPE_FIELD_NUMBER :
|
||||
subtype = codedIS.readUInt32();
|
||||
break;
|
||||
case OsmandOdb.MapEncodingRule.TYPE_FIELD_NUMBER :
|
||||
type = codedIS.readUInt32();
|
||||
break;
|
||||
default:
|
||||
skipUnknownField(t);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private MapRoot readMapLevel() throws IOException {
|
||||
MapRoot root = new MapRoot();
|
||||
while(true){
|
||||
|
@ -1726,6 +1765,7 @@ public class BinaryMapIndexReader {
|
|||
|
||||
public static class MapIndex extends BinaryIndexPart {
|
||||
List<MapRoot> roots = new ArrayList<MapRoot>();
|
||||
Map<String, Map<String, Integer>> encodingRules = new LinkedHashMap<String, Map<String,Integer>>();
|
||||
|
||||
public List<MapRoot> getRoots() {
|
||||
return roots;
|
||||
|
@ -1834,13 +1874,13 @@ public class BinaryMapIndexReader {
|
|||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
RandomAccessFile raf = new RandomAccessFile(new File("e:\\Information\\OSM maps\\osmand\\Minsk.map.pbf"), "r");
|
||||
// RandomAccessFile raf = new RandomAccessFile(new File("e:\\Information\\OSM maps\\osmand\\Belarus_4.map.pbf"), "r");
|
||||
RandomAccessFile raf = new RandomAccessFile(new File("e:\\Information\\OSM maps\\osmand\\Minsk.obf"), "r");
|
||||
// RandomAccessFile raf = new RandomAccessFile(new File("e:\\Information\\OSM maps\\osmand\\Belarus_4.obf"), "r");
|
||||
BinaryMapIndexReader reader = new BinaryMapIndexReader(raf);
|
||||
System.out.println("VERSION " + reader.getVersion());
|
||||
long time = System.currentTimeMillis();
|
||||
|
||||
|
||||
System.out.println(reader.mapIndexes.get(0).encodingRules);
|
||||
|
||||
// test search
|
||||
// int sleft = MapUtils.get31TileNumberX(27.596);
|
||||
|
@ -1876,41 +1916,41 @@ public class BinaryMapIndexReader {
|
|||
// System.out.println("Villages " + villages.size());
|
||||
|
||||
// test transport
|
||||
for(TransportIndex i : reader.transportIndexes){
|
||||
System.out.println(i.left + " " + i.right + " " + i.top + " " + i.bottom);
|
||||
System.out.println(i.stringTable.cacheOfStrings);
|
||||
System.out.println(i.stringTable.offsets);
|
||||
System.out.println(i.stringTable.window);
|
||||
}
|
||||
{
|
||||
int sleft = MapUtils.get31TileNumberX(27.573);
|
||||
int sright = MapUtils.get31TileNumberX(27.581);
|
||||
int stop = MapUtils.get31TileNumberY(53.912);
|
||||
int sbottom = MapUtils.get31TileNumberY(53.908);
|
||||
for (TransportStop s : reader.searchTransportIndex(buildSearchTransportRequest(sleft, sright, stop, sbottom, 15, null))) {
|
||||
System.out.println(s.getName());
|
||||
for (int i : s.getReferencesToRoutes()) {
|
||||
TransportRoute route = reader.getTransportRoute(i);
|
||||
System.out.println(" " + route.getRef() + " " + route.getName() + " " + route.getDistance() + " "
|
||||
+ route.getAvgBothDistance());
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
int sleft = MapUtils.get31TileNumberX(27.473);
|
||||
int sright = MapUtils.get31TileNumberX(27.681);
|
||||
int stop = MapUtils.get31TileNumberY(53.912);
|
||||
int sbottom = MapUtils.get31TileNumberY(53.708);
|
||||
for (TransportStop s : reader.searchTransportIndex(buildSearchTransportRequest(sleft, sright, stop, sbottom, 16, null))) {
|
||||
System.out.println(s.getName());
|
||||
for (int i : s.getReferencesToRoutes()) {
|
||||
TransportRoute route = reader.getTransportRoute(i);
|
||||
System.out.println(" " + route.getRef() + " " + route.getName() + " " + route.getDistance() + " "
|
||||
+ route.getAvgBothDistance());
|
||||
}
|
||||
}
|
||||
// for(TransportIndex i : reader.transportIndexes){
|
||||
// System.out.println(i.left + " " + i.right + " " + i.top + " " + i.bottom);
|
||||
// System.out.println(i.stringTable.cacheOfStrings);
|
||||
// System.out.println(i.stringTable.offsets);
|
||||
// System.out.println(i.stringTable.window);
|
||||
// }
|
||||
// {
|
||||
// int sleft = MapUtils.get31TileNumberX(27.573);
|
||||
// int sright = MapUtils.get31TileNumberX(27.581);
|
||||
// int stop = MapUtils.get31TileNumberY(53.912);
|
||||
// int sbottom = MapUtils.get31TileNumberY(53.908);
|
||||
// for (TransportStop s : reader.searchTransportIndex(buildSearchTransportRequest(sleft, sright, stop, sbottom, 15, null))) {
|
||||
// System.out.println(s.getName());
|
||||
// for (int i : s.getReferencesToRoutes()) {
|
||||
// TransportRoute route = reader.getTransportRoute(i);
|
||||
// System.out.println(" " + route.getRef() + " " + route.getName() + " " + route.getDistance() + " "
|
||||
// + route.getAvgBothDistance());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// {
|
||||
// int sleft = MapUtils.get31TileNumberX(27.473);
|
||||
// int sright = MapUtils.get31TileNumberX(27.681);
|
||||
// int stop = MapUtils.get31TileNumberY(53.912);
|
||||
// int sbottom = MapUtils.get31TileNumberY(53.708);
|
||||
// for (TransportStop s : reader.searchTransportIndex(buildSearchTransportRequest(sleft, sright, stop, sbottom, 16, null))) {
|
||||
// System.out.println(s.getName());
|
||||
// for (int i : s.getReferencesToRoutes()) {
|
||||
// TransportRoute route = reader.getTransportRoute(i);
|
||||
// System.out.println(" " + route.getRef() + " " + route.getName() + " " + route.getDistance() + " "
|
||||
// + route.getAvgBothDistance());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
System.out.println("MEMORY " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));
|
||||
System.out.println("Time " + (System.currentTimeMillis() - time));
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ 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.MapEncodingRule;
|
||||
import net.osmand.binary.OsmandOdb.OsmAndTransportIndex;
|
||||
import net.osmand.binary.OsmandOdb.PostcodeIndex;
|
||||
import net.osmand.binary.OsmandOdb.StreetIndex;
|
||||
|
@ -29,6 +30,7 @@ import net.osmand.data.index.IndexConstants;
|
|||
import net.osmand.osm.LatLon;
|
||||
import net.osmand.osm.MapUtils;
|
||||
import net.osmand.osm.Node;
|
||||
import net.osmand.osm.MapRenderingTypes.MapRulType;
|
||||
import net.sf.junidecode.Junidecode;
|
||||
|
||||
import com.google.protobuf.CodedOutputStream;
|
||||
|
@ -163,6 +165,35 @@ public class BinaryMapIndexWriter {
|
|||
writeInt32Size();
|
||||
}
|
||||
|
||||
public void writeMapEncodingRules(Map<String, MapRulType> types) throws IOException{
|
||||
checkPeekState(MAP_INDEX_INIT);
|
||||
codedOutStream.flush();
|
||||
long fp = raf.getFilePointer();
|
||||
MapEncodingRule.Builder builder = OsmandOdb.MapEncodingRule.newBuilder();
|
||||
for(String tag : types.keySet()){
|
||||
MapRulType rule = types.get(tag);
|
||||
int type = rule.getType(null);
|
||||
int subType = rule.getSubType(null);
|
||||
if(type != 0 && subType != 0){
|
||||
builder.setTag(tag).setType(type).setSubtype(subType).setMinZoom(rule.getMinZoom(null));
|
||||
builder = OsmandOdb.MapEncodingRule.newBuilder();
|
||||
}
|
||||
|
||||
for(String val : types.get(tag).getValuesSet()){
|
||||
type = rule.getType(val);
|
||||
subType = rule.getSubType(val);
|
||||
builder.setTag(tag).setValue(val).setType(type).setSubtype(subType).setMinZoom(rule.getMinZoom(null));
|
||||
codedOutStream.writeMessage(OsmandOdb.OsmAndMapIndex.RULES_FIELD_NUMBER, builder.build());
|
||||
builder = OsmandOdb.MapEncodingRule.newBuilder();
|
||||
}
|
||||
|
||||
}
|
||||
codedOutStream.flush();
|
||||
long newfp = raf.getFilePointer();
|
||||
System.out.println("RENDERING SCHEMA takes " + (newfp - fp));
|
||||
}
|
||||
|
||||
|
||||
public void startMapTreeElement(int leftX, int rightX, int topY, int bottomY) throws IOException{
|
||||
startMapTreeElement(-1L, leftX, rightX, topY, bottomY);
|
||||
}
|
||||
|
@ -726,6 +757,10 @@ public class BinaryMapIndexWriter {
|
|||
}
|
||||
}
|
||||
|
||||
public void flush() throws IOException {
|
||||
codedOutStream.flush();
|
||||
}
|
||||
|
||||
public void close() throws IOException{
|
||||
checkPeekState(OSMAND_STRUCTURE_INIT);
|
||||
codedOutStream.writeInt32(OsmandOdb.OsmAndStructure.VERSIONCONFIRM_FIELD_NUMBER, IndexConstants.BINARY_MAP_VERSION);
|
||||
|
|
|
@ -969,12 +969,27 @@ public final class OsmandOdb {
|
|||
public boolean hasName() { return hasName; }
|
||||
public java.lang.String getName() { return name_; }
|
||||
|
||||
// repeated .MapEncodingRule rules = 8;
|
||||
public static final int RULES_FIELD_NUMBER = 8;
|
||||
private java.util.List<net.osmand.binary.OsmandOdb.MapEncodingRule> rules_ =
|
||||
java.util.Collections.emptyList();
|
||||
public java.util.List<net.osmand.binary.OsmandOdb.MapEncodingRule> getRulesList() {
|
||||
return rules_;
|
||||
}
|
||||
public int getRulesCount() { return rules_.size(); }
|
||||
public net.osmand.binary.OsmandOdb.MapEncodingRule getRules(int index) {
|
||||
return rules_.get(index);
|
||||
}
|
||||
|
||||
private void initFields() {
|
||||
}
|
||||
public final boolean isInitialized() {
|
||||
for (net.osmand.binary.OsmandOdb.MapRootLevel element : getLevelsList()) {
|
||||
if (!element.isInitialized()) return false;
|
||||
}
|
||||
for (net.osmand.binary.OsmandOdb.MapEncodingRule element : getRulesList()) {
|
||||
if (!element.isInitialized()) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -987,6 +1002,9 @@ public final class OsmandOdb {
|
|||
if (hasName()) {
|
||||
output.writeString(3, getName());
|
||||
}
|
||||
for (net.osmand.binary.OsmandOdb.MapEncodingRule element : getRulesList()) {
|
||||
output.writeMessage(8, element);
|
||||
}
|
||||
getUnknownFields().writeTo(output);
|
||||
}
|
||||
|
||||
|
@ -1004,6 +1022,10 @@ public final class OsmandOdb {
|
|||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeStringSize(3, getName());
|
||||
}
|
||||
for (net.osmand.binary.OsmandOdb.MapEncodingRule element : getRulesList()) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeMessageSize(8, element);
|
||||
}
|
||||
size += getUnknownFields().getSerializedSize();
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
|
@ -1150,6 +1172,10 @@ public final class OsmandOdb {
|
|||
result.levels_ =
|
||||
java.util.Collections.unmodifiableList(result.levels_);
|
||||
}
|
||||
if (result.rules_ != java.util.Collections.EMPTY_LIST) {
|
||||
result.rules_ =
|
||||
java.util.Collections.unmodifiableList(result.rules_);
|
||||
}
|
||||
net.osmand.binary.OsmandOdb.OsmAndMapIndex returnMe = result;
|
||||
result = null;
|
||||
return returnMe;
|
||||
|
@ -1175,6 +1201,12 @@ public final class OsmandOdb {
|
|||
if (other.hasName()) {
|
||||
setName(other.getName());
|
||||
}
|
||||
if (!other.rules_.isEmpty()) {
|
||||
if (result.rules_.isEmpty()) {
|
||||
result.rules_ = new java.util.ArrayList<net.osmand.binary.OsmandOdb.MapEncodingRule>();
|
||||
}
|
||||
result.rules_.addAll(other.rules_);
|
||||
}
|
||||
this.mergeUnknownFields(other.getUnknownFields());
|
||||
return this;
|
||||
}
|
||||
|
@ -1210,6 +1242,12 @@ public final class OsmandOdb {
|
|||
setName(input.readString());
|
||||
break;
|
||||
}
|
||||
case 66: {
|
||||
net.osmand.binary.OsmandOdb.MapEncodingRule.Builder subBuilder = net.osmand.binary.OsmandOdb.MapEncodingRule.newBuilder();
|
||||
input.readMessage(subBuilder, extensionRegistry);
|
||||
addRules(subBuilder.buildPartial());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1287,6 +1325,57 @@ public final class OsmandOdb {
|
|||
return this;
|
||||
}
|
||||
|
||||
// repeated .MapEncodingRule rules = 8;
|
||||
public java.util.List<net.osmand.binary.OsmandOdb.MapEncodingRule> getRulesList() {
|
||||
return java.util.Collections.unmodifiableList(result.rules_);
|
||||
}
|
||||
public int getRulesCount() {
|
||||
return result.getRulesCount();
|
||||
}
|
||||
public net.osmand.binary.OsmandOdb.MapEncodingRule getRules(int index) {
|
||||
return result.getRules(index);
|
||||
}
|
||||
public Builder setRules(int index, net.osmand.binary.OsmandOdb.MapEncodingRule value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
result.rules_.set(index, value);
|
||||
return this;
|
||||
}
|
||||
public Builder setRules(int index, net.osmand.binary.OsmandOdb.MapEncodingRule.Builder builderForValue) {
|
||||
result.rules_.set(index, builderForValue.build());
|
||||
return this;
|
||||
}
|
||||
public Builder addRules(net.osmand.binary.OsmandOdb.MapEncodingRule value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (result.rules_.isEmpty()) {
|
||||
result.rules_ = new java.util.ArrayList<net.osmand.binary.OsmandOdb.MapEncodingRule>();
|
||||
}
|
||||
result.rules_.add(value);
|
||||
return this;
|
||||
}
|
||||
public Builder addRules(net.osmand.binary.OsmandOdb.MapEncodingRule.Builder builderForValue) {
|
||||
if (result.rules_.isEmpty()) {
|
||||
result.rules_ = new java.util.ArrayList<net.osmand.binary.OsmandOdb.MapEncodingRule>();
|
||||
}
|
||||
result.rules_.add(builderForValue.build());
|
||||
return this;
|
||||
}
|
||||
public Builder addAllRules(
|
||||
java.lang.Iterable<? extends net.osmand.binary.OsmandOdb.MapEncodingRule> values) {
|
||||
if (result.rules_.isEmpty()) {
|
||||
result.rules_ = new java.util.ArrayList<net.osmand.binary.OsmandOdb.MapEncodingRule>();
|
||||
}
|
||||
super.addAll(values, result.rules_);
|
||||
return this;
|
||||
}
|
||||
public Builder clearRules() {
|
||||
result.rules_ = java.util.Collections.emptyList();
|
||||
return this;
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:OsmAndMapIndex)
|
||||
}
|
||||
|
||||
|
@ -1299,6 +1388,455 @@ public final class OsmandOdb {
|
|||
// @@protoc_insertion_point(class_scope:OsmAndMapIndex)
|
||||
}
|
||||
|
||||
public static final class MapEncodingRule extends
|
||||
com.google.protobuf.GeneratedMessage {
|
||||
// Use MapEncodingRule.newBuilder() to construct.
|
||||
private MapEncodingRule() {
|
||||
initFields();
|
||||
}
|
||||
private MapEncodingRule(boolean noInit) {}
|
||||
|
||||
private static final MapEncodingRule defaultInstance;
|
||||
public static MapEncodingRule getDefaultInstance() {
|
||||
return defaultInstance;
|
||||
}
|
||||
|
||||
public MapEncodingRule getDefaultInstanceForType() {
|
||||
return defaultInstance;
|
||||
}
|
||||
|
||||
public static final com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptor() {
|
||||
return net.osmand.binary.OsmandOdb.internal_static_MapEncodingRule_descriptor;
|
||||
}
|
||||
|
||||
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
|
||||
internalGetFieldAccessorTable() {
|
||||
return net.osmand.binary.OsmandOdb.internal_static_MapEncodingRule_fieldAccessorTable;
|
||||
}
|
||||
|
||||
// required string tag = 3;
|
||||
public static final int TAG_FIELD_NUMBER = 3;
|
||||
private boolean hasTag;
|
||||
private java.lang.String tag_ = "";
|
||||
public boolean hasTag() { return hasTag; }
|
||||
public java.lang.String getTag() { return tag_; }
|
||||
|
||||
// optional string value = 5;
|
||||
public static final int VALUE_FIELD_NUMBER = 5;
|
||||
private boolean hasValue;
|
||||
private java.lang.String value_ = "";
|
||||
public boolean hasValue() { return hasValue; }
|
||||
public java.lang.String getValue() { return value_; }
|
||||
|
||||
// required uint32 type = 6;
|
||||
public static final int TYPE_FIELD_NUMBER = 6;
|
||||
private boolean hasType;
|
||||
private int type_ = 0;
|
||||
public boolean hasType() { return hasType; }
|
||||
public int getType() { return type_; }
|
||||
|
||||
// required uint32 subtype = 7;
|
||||
public static final int SUBTYPE_FIELD_NUMBER = 7;
|
||||
private boolean hasSubtype;
|
||||
private int subtype_ = 0;
|
||||
public boolean hasSubtype() { return hasSubtype; }
|
||||
public int getSubtype() { return subtype_; }
|
||||
|
||||
// optional uint32 minZoom = 9;
|
||||
public static final int MINZOOM_FIELD_NUMBER = 9;
|
||||
private boolean hasMinZoom;
|
||||
private int minZoom_ = 0;
|
||||
public boolean hasMinZoom() { return hasMinZoom; }
|
||||
public int getMinZoom() { return minZoom_; }
|
||||
|
||||
private void initFields() {
|
||||
}
|
||||
public final boolean isInitialized() {
|
||||
if (!hasTag) return false;
|
||||
if (!hasType) return false;
|
||||
if (!hasSubtype) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void writeTo(com.google.protobuf.CodedOutputStream output)
|
||||
throws java.io.IOException {
|
||||
getSerializedSize();
|
||||
if (hasTag()) {
|
||||
output.writeString(3, getTag());
|
||||
}
|
||||
if (hasValue()) {
|
||||
output.writeString(5, getValue());
|
||||
}
|
||||
if (hasType()) {
|
||||
output.writeUInt32(6, getType());
|
||||
}
|
||||
if (hasSubtype()) {
|
||||
output.writeUInt32(7, getSubtype());
|
||||
}
|
||||
if (hasMinZoom()) {
|
||||
output.writeUInt32(9, getMinZoom());
|
||||
}
|
||||
getUnknownFields().writeTo(output);
|
||||
}
|
||||
|
||||
private int memoizedSerializedSize = -1;
|
||||
public int getSerializedSize() {
|
||||
int size = memoizedSerializedSize;
|
||||
if (size != -1) return size;
|
||||
|
||||
size = 0;
|
||||
if (hasTag()) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeStringSize(3, getTag());
|
||||
}
|
||||
if (hasValue()) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeStringSize(5, getValue());
|
||||
}
|
||||
if (hasType()) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeUInt32Size(6, getType());
|
||||
}
|
||||
if (hasSubtype()) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeUInt32Size(7, getSubtype());
|
||||
}
|
||||
if (hasMinZoom()) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeUInt32Size(9, getMinZoom());
|
||||
}
|
||||
size += getUnknownFields().getSerializedSize();
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
}
|
||||
|
||||
public static net.osmand.binary.OsmandOdb.MapEncodingRule parseFrom(
|
||||
com.google.protobuf.ByteString data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return newBuilder().mergeFrom(data).buildParsed();
|
||||
}
|
||||
public static net.osmand.binary.OsmandOdb.MapEncodingRule 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.MapEncodingRule parseFrom(byte[] data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return newBuilder().mergeFrom(data).buildParsed();
|
||||
}
|
||||
public static net.osmand.binary.OsmandOdb.MapEncodingRule 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.MapEncodingRule parseFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
return newBuilder().mergeFrom(input).buildParsed();
|
||||
}
|
||||
public static net.osmand.binary.OsmandOdb.MapEncodingRule 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.MapEncodingRule 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.MapEncodingRule 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.MapEncodingRule parseFrom(
|
||||
com.google.protobuf.CodedInputStream input)
|
||||
throws java.io.IOException {
|
||||
return newBuilder().mergeFrom(input).buildParsed();
|
||||
}
|
||||
public static net.osmand.binary.OsmandOdb.MapEncodingRule 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.MapEncodingRule prototype) {
|
||||
return newBuilder().mergeFrom(prototype);
|
||||
}
|
||||
public Builder toBuilder() { return newBuilder(this); }
|
||||
|
||||
public static final class Builder extends
|
||||
com.google.protobuf.GeneratedMessage.Builder<Builder> {
|
||||
private net.osmand.binary.OsmandOdb.MapEncodingRule result;
|
||||
|
||||
// Construct using net.osmand.binary.OsmandOdb.MapEncodingRule.newBuilder()
|
||||
private Builder() {}
|
||||
|
||||
private static Builder create() {
|
||||
Builder builder = new Builder();
|
||||
builder.result = new net.osmand.binary.OsmandOdb.MapEncodingRule();
|
||||
return builder;
|
||||
}
|
||||
|
||||
protected net.osmand.binary.OsmandOdb.MapEncodingRule internalGetResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public Builder clear() {
|
||||
if (result == null) {
|
||||
throw new IllegalStateException(
|
||||
"Cannot call clear() after build().");
|
||||
}
|
||||
result = new net.osmand.binary.OsmandOdb.MapEncodingRule();
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder clone() {
|
||||
return create().mergeFrom(result);
|
||||
}
|
||||
|
||||
public com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptorForType() {
|
||||
return net.osmand.binary.OsmandOdb.MapEncodingRule.getDescriptor();
|
||||
}
|
||||
|
||||
public net.osmand.binary.OsmandOdb.MapEncodingRule getDefaultInstanceForType() {
|
||||
return net.osmand.binary.OsmandOdb.MapEncodingRule.getDefaultInstance();
|
||||
}
|
||||
|
||||
public boolean isInitialized() {
|
||||
return result.isInitialized();
|
||||
}
|
||||
public net.osmand.binary.OsmandOdb.MapEncodingRule build() {
|
||||
if (result != null && !isInitialized()) {
|
||||
throw newUninitializedMessageException(result);
|
||||
}
|
||||
return buildPartial();
|
||||
}
|
||||
|
||||
private net.osmand.binary.OsmandOdb.MapEncodingRule buildParsed()
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
if (!isInitialized()) {
|
||||
throw newUninitializedMessageException(
|
||||
result).asInvalidProtocolBufferException();
|
||||
}
|
||||
return buildPartial();
|
||||
}
|
||||
|
||||
public net.osmand.binary.OsmandOdb.MapEncodingRule buildPartial() {
|
||||
if (result == null) {
|
||||
throw new IllegalStateException(
|
||||
"build() has already been called on this Builder.");
|
||||
}
|
||||
net.osmand.binary.OsmandOdb.MapEncodingRule returnMe = result;
|
||||
result = null;
|
||||
return returnMe;
|
||||
}
|
||||
|
||||
public Builder mergeFrom(com.google.protobuf.Message other) {
|
||||
if (other instanceof net.osmand.binary.OsmandOdb.MapEncodingRule) {
|
||||
return mergeFrom((net.osmand.binary.OsmandOdb.MapEncodingRule)other);
|
||||
} else {
|
||||
super.mergeFrom(other);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public Builder mergeFrom(net.osmand.binary.OsmandOdb.MapEncodingRule other) {
|
||||
if (other == net.osmand.binary.OsmandOdb.MapEncodingRule.getDefaultInstance()) return this;
|
||||
if (other.hasTag()) {
|
||||
setTag(other.getTag());
|
||||
}
|
||||
if (other.hasValue()) {
|
||||
setValue(other.getValue());
|
||||
}
|
||||
if (other.hasType()) {
|
||||
setType(other.getType());
|
||||
}
|
||||
if (other.hasSubtype()) {
|
||||
setSubtype(other.getSubtype());
|
||||
}
|
||||
if (other.hasMinZoom()) {
|
||||
setMinZoom(other.getMinZoom());
|
||||
}
|
||||
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: {
|
||||
setTag(input.readString());
|
||||
break;
|
||||
}
|
||||
case 42: {
|
||||
setValue(input.readString());
|
||||
break;
|
||||
}
|
||||
case 48: {
|
||||
setType(input.readUInt32());
|
||||
break;
|
||||
}
|
||||
case 56: {
|
||||
setSubtype(input.readUInt32());
|
||||
break;
|
||||
}
|
||||
case 72: {
|
||||
setMinZoom(input.readUInt32());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// required string tag = 3;
|
||||
public boolean hasTag() {
|
||||
return result.hasTag();
|
||||
}
|
||||
public java.lang.String getTag() {
|
||||
return result.getTag();
|
||||
}
|
||||
public Builder setTag(java.lang.String value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
result.hasTag = true;
|
||||
result.tag_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder clearTag() {
|
||||
result.hasTag = false;
|
||||
result.tag_ = getDefaultInstance().getTag();
|
||||
return this;
|
||||
}
|
||||
|
||||
// optional string value = 5;
|
||||
public boolean hasValue() {
|
||||
return result.hasValue();
|
||||
}
|
||||
public java.lang.String getValue() {
|
||||
return result.getValue();
|
||||
}
|
||||
public Builder setValue(java.lang.String value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
result.hasValue = true;
|
||||
result.value_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder clearValue() {
|
||||
result.hasValue = false;
|
||||
result.value_ = getDefaultInstance().getValue();
|
||||
return this;
|
||||
}
|
||||
|
||||
// required uint32 type = 6;
|
||||
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;
|
||||
}
|
||||
|
||||
// required uint32 subtype = 7;
|
||||
public boolean hasSubtype() {
|
||||
return result.hasSubtype();
|
||||
}
|
||||
public int getSubtype() {
|
||||
return result.getSubtype();
|
||||
}
|
||||
public Builder setSubtype(int value) {
|
||||
result.hasSubtype = true;
|
||||
result.subtype_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder clearSubtype() {
|
||||
result.hasSubtype = false;
|
||||
result.subtype_ = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
// optional uint32 minZoom = 9;
|
||||
public boolean hasMinZoom() {
|
||||
return result.hasMinZoom();
|
||||
}
|
||||
public int getMinZoom() {
|
||||
return result.getMinZoom();
|
||||
}
|
||||
public Builder setMinZoom(int value) {
|
||||
result.hasMinZoom = true;
|
||||
result.minZoom_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder clearMinZoom() {
|
||||
result.hasMinZoom = false;
|
||||
result.minZoom_ = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:MapEncodingRule)
|
||||
}
|
||||
|
||||
static {
|
||||
defaultInstance = new MapEncodingRule(true);
|
||||
net.osmand.binary.OsmandOdb.internalForceInit();
|
||||
defaultInstance.initFields();
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(class_scope:MapEncodingRule)
|
||||
}
|
||||
|
||||
public static final class MapRootLevel extends
|
||||
com.google.protobuf.GeneratedMessage {
|
||||
// Use MapRootLevel.newBuilder() to construct.
|
||||
|
@ -10348,6 +10886,11 @@ public final class OsmandOdb {
|
|||
private static
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable
|
||||
internal_static_OsmAndMapIndex_fieldAccessorTable;
|
||||
private static com.google.protobuf.Descriptors.Descriptor
|
||||
internal_static_MapEncodingRule_descriptor;
|
||||
private static
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable
|
||||
internal_static_MapEncodingRule_fieldAccessorTable;
|
||||
private static com.google.protobuf.Descriptors.Descriptor
|
||||
internal_static_MapRootLevel_descriptor;
|
||||
private static
|
||||
|
@ -10452,63 +10995,67 @@ public final class OsmandOdb {
|
|||
"OsmAndMapIndex\022)\n\014addressIndex\030\003 \003(\0132\023.O" +
|
||||
"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" +
|
||||
"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\022\014\n\004name\030\003 \001(\t\"\202\001\n\014MapRootLevel\022\017\n\007ma" +
|
||||
"xZoom\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\"\344\001\n\007MapTr" +
|
||||
"ee\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\016oldstringTable\030\005" +
|
||||
" \001(\0132\014.StringTable\022\021\n\toldbaseId\030\006 \001(\004\022\032\n" +
|
||||
"\010subtrees\030\007 \003(\0132\010.MapTree\022\027\n\005leafs\030\010 \003(\013" +
|
||||
"2\010.MapData\022\016\n\006baseId\030\n \001(\004\022!\n\013stringTabl" +
|
||||
"e\030\013 \001(\0132\014.StringTable\"v\n\007MapData\022\023\n\013coor" +
|
||||
"dinates\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\022OsmAndAddressI",
|
||||
"ndex\022\014\n\004name\030\001 \002(\t\022\017\n\007name_en\030\002 \001(\t\022\034\n\006c" +
|
||||
"ities\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\tpo" +
|
||||
"stcodes\030\001 \003(\0132\016.PostcodeIndex\"\253\001\n\tCityIn" +
|
||||
"dex\022\021\n\tcity_type\030\001 \002(\r\022\014\n\004name\030\002 \002(\t\022\017\n\007" +
|
||||
"name_en\030\003 \001(\t\022\n\n\002id\030\004 \001(\004\022\t\n\001x\030\005 \002(\007\022\t\n\001" +
|
||||
"y\030\006 \002(\007\022+\n\rintersections\030\016 \001(\0132\024.Interes" +
|
||||
"ectedStreets\022\035\n\007streets\030\022 \003(\0132\014.StreetIn",
|
||||
"dex\"A\n\023InteresectedStreets\022*\n\rintersecti" +
|
||||
"ons\030\005 \003(\0132\023.StreetIntersection\"x\n\022Street" +
|
||||
"Intersection\022\032\n\022intersectedStreet1\030\002 \002(\r" +
|
||||
"\022\032\n\022intersectedStreet2\030\003 \002(\r\022\024\n\014intersec" +
|
||||
"tedX\030\004 \002(\021\022\024\n\014intersectedY\030\005 \002(\021\"V\n\rPost" +
|
||||
"codeIndex\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.StreetIndex" +
|
||||
"\"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\rB",
|
||||
"uildingIndex\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(\021\"2\n\017TransportRoutes\022\037\n\006ro" +
|
||||
"utes\030\006 \003(\0132\017.TransportRoute\"\317\001\n\016Transpor" +
|
||||
"tRoute\022\n\n\002id\030\001 \002(\004\022\014\n\004type\030\003 \001(\r\022\020\n\010oper" +
|
||||
"ator\030\004 \001(\r\022\013\n\003ref\030\005 \001(\t\022\014\n\004name\030\006 \001(\r\022\017\n" +
|
||||
"\007name_en\030\007 \001(\r\022\020\n\010distance\030\010 \001(\r\022(\n\013dire" +
|
||||
"ctStops\030\017 \003(\0132\023.TransportRouteStop\022)\n\014re" +
|
||||
"verseStops\030\020 \003(\0132\023.TransportRouteStop\"W\n" +
|
||||
"\022TransportRouteStop\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\002dx\030\001 \002(\021\022\n\n\002d" +
|
||||
"y\030\002 \002(\021\022\n\n\002id\030\005 \002(\022\022\014\n\004name\030\006 \002(\r\022\017\n\007nam" +
|
||||
"e_en\030\007 \001(\r\022\016\n\006routes\030\020 \003(\r\"\244\001\n\022Transport" +
|
||||
"StopsTree\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\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\"\215\001\n\024Os" +
|
||||
"mAndTransportIndex\022\014\n\004name\030\001 \001(\t\022 \n\006rout" +
|
||||
"es\030\003 \001(\0132\020.TransportRoutes\022\"\n\005stops\030\006 \001(",
|
||||
"\0132\023.TransportStopsTree\022!\n\013stringTable\030\t " +
|
||||
"\002(\0132\014.StringTableB\023\n\021net.osmand.binary"
|
||||
"vel\022\014\n\004name\030\003 \001(\t\022\037\n\005rules\030\010 \003(\0132\020.MapEn" +
|
||||
"codingRule\"]\n\017MapEncodingRule\022\013\n\003tag\030\003 \002" +
|
||||
"(\t\022\r\n\005value\030\005 \001(\t\022\014\n\004type\030\006 \002(\r\022\017\n\007subty",
|
||||
"pe\030\007 \002(\r\022\017\n\007minZoom\030\t \001(\r\"\202\001\n\014MapRootLev" +
|
||||
"el\022\017\n\007maxZoom\030\001 \002(\005\022\017\n\007minZoom\030\002 \002(\005\022\014\n\004" +
|
||||
"left\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\"\344" +
|
||||
"\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\016oldstrin" +
|
||||
"gTable\030\005 \001(\0132\014.StringTable\022\021\n\toldbaseId\030" +
|
||||
"\006 \001(\004\022\032\n\010subtrees\030\007 \003(\0132\010.MapTree\022\027\n\005lea" +
|
||||
"fs\030\010 \003(\0132\010.MapData\022\016\n\006baseId\030\n \001(\004\022!\n\013st" +
|
||||
"ringTable\030\013 \001(\0132\014.StringTable\"v\n\007MapData",
|
||||
"\022\023\n\013coordinates\030\001 \002(\014\022\r\n\005types\030\002 \002(\014\022\n\n\002" +
|
||||
"id\030\003 \002(\022\022\020\n\010stringId\030\004 \001(\r\022\024\n\014restrictio" +
|
||||
"ns\030\005 \001(\014\022\023\n\013highwayMeta\030\006 \001(\005\"\225\001\n\022OsmAnd" +
|
||||
"AddressIndex\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\tpos" +
|
||||
"tcodes\030\006 \001(\0132\017.PostcodesIndex\022\036\n\010village" +
|
||||
"s\030\007 \001(\0132\014.CitiesIndex\")\n\013CitiesIndex\022\032\n\006" +
|
||||
"cities\030\001 \003(\0132\n.CityIndex\"3\n\016PostcodesInd" +
|
||||
"ex\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\rin" +
|
||||
"tersections\030\005 \003(\0132\023.StreetIntersection\"x" +
|
||||
"\n\022StreetIntersection\022\032\n\022intersectedStree" +
|
||||
"t1\030\002 \002(\r\022\032\n\022intersectedStreet2\030\003 \002(\r\022\024\n\014" +
|
||||
"intersectedX\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\001x" +
|
||||
"\030\002 \002(\007\022\t\n\001y\030\003 \002(\007\022\035\n\007streets\030\005 \003(\0132\014.Str",
|
||||
"eetIndex\"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\002" +
|
||||
"id\030\006 \001(\004\022!\n\tbuildings\030\022 \003(\0132\016.BuildingIn" +
|
||||
"dex\"b\n\rBuildingIndex\022\014\n\004name\030\001 \002(\t\022\017\n\007na" +
|
||||
"me_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\"2\n\017TransportRout" +
|
||||
"es\022\037\n\006routes\030\006 \003(\0132\017.TransportRoute\"\317\001\n\016" +
|
||||
"TransportRoute\022\n\n\002id\030\001 \002(\004\022\014\n\004type\030\003 \001(\r" +
|
||||
"\022\020\n\010operator\030\004 \001(\r\022\013\n\003ref\030\005 \001(\t\022\014\n\004name\030" +
|
||||
"\006 \001(\r\022\017\n\007name_en\030\007 \001(\r\022\020\n\010distance\030\010 \001(\r",
|
||||
"\022(\n\013directStops\030\017 \003(\0132\023.TransportRouteSt" +
|
||||
"op\022)\n\014reverseStops\030\020 \003(\0132\023.TransportRout" +
|
||||
"eStop\"W\n\022TransportRouteStop\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\002dx\030\001 " +
|
||||
"\002(\021\022\n\n\002dy\030\002 \002(\021\022\n\n\002id\030\005 \002(\022\022\014\n\004name\030\006 \002(" +
|
||||
"\r\022\017\n\007name_en\030\007 \001(\r\022\016\n\006routes\030\020 \003(\r\"\244\001\n\022T" +
|
||||
"ransportStopsTree\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\010s" +
|
||||
"ubtrees\030\007 \003(\0132\023.TransportStopsTree\022\035\n\005le",
|
||||
"afs\030\010 \003(\0132\016.TransportStop\022\016\n\006baseId\030\020 \001(" +
|
||||
"\004\"\215\001\n\024OsmAndTransportIndex\022\014\n\004name\030\001 \001(\t" +
|
||||
"\022 \n\006routes\030\003 \001(\0132\020.TransportRoutes\022\"\n\005st" +
|
||||
"ops\030\006 \001(\0132\023.TransportStopsTree\022!\n\013string" +
|
||||
"Table\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() {
|
||||
|
@ -10536,11 +11083,19 @@ public final class OsmandOdb {
|
|||
internal_static_OsmAndMapIndex_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_OsmAndMapIndex_descriptor,
|
||||
new java.lang.String[] { "Levels", "Name", },
|
||||
new java.lang.String[] { "Levels", "Name", "Rules", },
|
||||
net.osmand.binary.OsmandOdb.OsmAndMapIndex.class,
|
||||
net.osmand.binary.OsmandOdb.OsmAndMapIndex.Builder.class);
|
||||
internal_static_MapRootLevel_descriptor =
|
||||
internal_static_MapEncodingRule_descriptor =
|
||||
getDescriptor().getMessageTypes().get(3);
|
||||
internal_static_MapEncodingRule_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_MapEncodingRule_descriptor,
|
||||
new java.lang.String[] { "Tag", "Value", "Type", "Subtype", "MinZoom", },
|
||||
net.osmand.binary.OsmandOdb.MapEncodingRule.class,
|
||||
net.osmand.binary.OsmandOdb.MapEncodingRule.Builder.class);
|
||||
internal_static_MapRootLevel_descriptor =
|
||||
getDescriptor().getMessageTypes().get(4);
|
||||
internal_static_MapRootLevel_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_MapRootLevel_descriptor,
|
||||
|
@ -10548,7 +11103,7 @@ public final class OsmandOdb {
|
|||
net.osmand.binary.OsmandOdb.MapRootLevel.class,
|
||||
net.osmand.binary.OsmandOdb.MapRootLevel.Builder.class);
|
||||
internal_static_MapTree_descriptor =
|
||||
getDescriptor().getMessageTypes().get(4);
|
||||
getDescriptor().getMessageTypes().get(5);
|
||||
internal_static_MapTree_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_MapTree_descriptor,
|
||||
|
@ -10556,7 +11111,7 @@ public final class OsmandOdb {
|
|||
net.osmand.binary.OsmandOdb.MapTree.class,
|
||||
net.osmand.binary.OsmandOdb.MapTree.Builder.class);
|
||||
internal_static_MapData_descriptor =
|
||||
getDescriptor().getMessageTypes().get(5);
|
||||
getDescriptor().getMessageTypes().get(6);
|
||||
internal_static_MapData_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_MapData_descriptor,
|
||||
|
@ -10564,7 +11119,7 @@ public final class OsmandOdb {
|
|||
net.osmand.binary.OsmandOdb.MapData.class,
|
||||
net.osmand.binary.OsmandOdb.MapData.Builder.class);
|
||||
internal_static_OsmAndAddressIndex_descriptor =
|
||||
getDescriptor().getMessageTypes().get(6);
|
||||
getDescriptor().getMessageTypes().get(7);
|
||||
internal_static_OsmAndAddressIndex_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_OsmAndAddressIndex_descriptor,
|
||||
|
@ -10572,7 +11127,7 @@ public final class OsmandOdb {
|
|||
net.osmand.binary.OsmandOdb.OsmAndAddressIndex.class,
|
||||
net.osmand.binary.OsmandOdb.OsmAndAddressIndex.Builder.class);
|
||||
internal_static_CitiesIndex_descriptor =
|
||||
getDescriptor().getMessageTypes().get(7);
|
||||
getDescriptor().getMessageTypes().get(8);
|
||||
internal_static_CitiesIndex_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_CitiesIndex_descriptor,
|
||||
|
@ -10580,7 +11135,7 @@ public final class OsmandOdb {
|
|||
net.osmand.binary.OsmandOdb.CitiesIndex.class,
|
||||
net.osmand.binary.OsmandOdb.CitiesIndex.Builder.class);
|
||||
internal_static_PostcodesIndex_descriptor =
|
||||
getDescriptor().getMessageTypes().get(8);
|
||||
getDescriptor().getMessageTypes().get(9);
|
||||
internal_static_PostcodesIndex_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_PostcodesIndex_descriptor,
|
||||
|
@ -10588,7 +11143,7 @@ public final class OsmandOdb {
|
|||
net.osmand.binary.OsmandOdb.PostcodesIndex.class,
|
||||
net.osmand.binary.OsmandOdb.PostcodesIndex.Builder.class);
|
||||
internal_static_CityIndex_descriptor =
|
||||
getDescriptor().getMessageTypes().get(9);
|
||||
getDescriptor().getMessageTypes().get(10);
|
||||
internal_static_CityIndex_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_CityIndex_descriptor,
|
||||
|
@ -10596,7 +11151,7 @@ public final class OsmandOdb {
|
|||
net.osmand.binary.OsmandOdb.CityIndex.class,
|
||||
net.osmand.binary.OsmandOdb.CityIndex.Builder.class);
|
||||
internal_static_InteresectedStreets_descriptor =
|
||||
getDescriptor().getMessageTypes().get(10);
|
||||
getDescriptor().getMessageTypes().get(11);
|
||||
internal_static_InteresectedStreets_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_InteresectedStreets_descriptor,
|
||||
|
@ -10604,7 +11159,7 @@ public final class OsmandOdb {
|
|||
net.osmand.binary.OsmandOdb.InteresectedStreets.class,
|
||||
net.osmand.binary.OsmandOdb.InteresectedStreets.Builder.class);
|
||||
internal_static_StreetIntersection_descriptor =
|
||||
getDescriptor().getMessageTypes().get(11);
|
||||
getDescriptor().getMessageTypes().get(12);
|
||||
internal_static_StreetIntersection_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_StreetIntersection_descriptor,
|
||||
|
@ -10612,7 +11167,7 @@ public final class OsmandOdb {
|
|||
net.osmand.binary.OsmandOdb.StreetIntersection.class,
|
||||
net.osmand.binary.OsmandOdb.StreetIntersection.Builder.class);
|
||||
internal_static_PostcodeIndex_descriptor =
|
||||
getDescriptor().getMessageTypes().get(12);
|
||||
getDescriptor().getMessageTypes().get(13);
|
||||
internal_static_PostcodeIndex_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_PostcodeIndex_descriptor,
|
||||
|
@ -10620,7 +11175,7 @@ public final class OsmandOdb {
|
|||
net.osmand.binary.OsmandOdb.PostcodeIndex.class,
|
||||
net.osmand.binary.OsmandOdb.PostcodeIndex.Builder.class);
|
||||
internal_static_StreetIndex_descriptor =
|
||||
getDescriptor().getMessageTypes().get(13);
|
||||
getDescriptor().getMessageTypes().get(14);
|
||||
internal_static_StreetIndex_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_StreetIndex_descriptor,
|
||||
|
@ -10628,7 +11183,7 @@ public final class OsmandOdb {
|
|||
net.osmand.binary.OsmandOdb.StreetIndex.class,
|
||||
net.osmand.binary.OsmandOdb.StreetIndex.Builder.class);
|
||||
internal_static_BuildingIndex_descriptor =
|
||||
getDescriptor().getMessageTypes().get(14);
|
||||
getDescriptor().getMessageTypes().get(15);
|
||||
internal_static_BuildingIndex_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_BuildingIndex_descriptor,
|
||||
|
@ -10636,7 +11191,7 @@ public final class OsmandOdb {
|
|||
net.osmand.binary.OsmandOdb.BuildingIndex.class,
|
||||
net.osmand.binary.OsmandOdb.BuildingIndex.Builder.class);
|
||||
internal_static_TransportRoutes_descriptor =
|
||||
getDescriptor().getMessageTypes().get(15);
|
||||
getDescriptor().getMessageTypes().get(16);
|
||||
internal_static_TransportRoutes_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_TransportRoutes_descriptor,
|
||||
|
@ -10644,7 +11199,7 @@ public final class OsmandOdb {
|
|||
net.osmand.binary.OsmandOdb.TransportRoutes.class,
|
||||
net.osmand.binary.OsmandOdb.TransportRoutes.Builder.class);
|
||||
internal_static_TransportRoute_descriptor =
|
||||
getDescriptor().getMessageTypes().get(16);
|
||||
getDescriptor().getMessageTypes().get(17);
|
||||
internal_static_TransportRoute_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_TransportRoute_descriptor,
|
||||
|
@ -10652,7 +11207,7 @@ public final class OsmandOdb {
|
|||
net.osmand.binary.OsmandOdb.TransportRoute.class,
|
||||
net.osmand.binary.OsmandOdb.TransportRoute.Builder.class);
|
||||
internal_static_TransportRouteStop_descriptor =
|
||||
getDescriptor().getMessageTypes().get(17);
|
||||
getDescriptor().getMessageTypes().get(18);
|
||||
internal_static_TransportRouteStop_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_TransportRouteStop_descriptor,
|
||||
|
@ -10660,7 +11215,7 @@ public final class OsmandOdb {
|
|||
net.osmand.binary.OsmandOdb.TransportRouteStop.class,
|
||||
net.osmand.binary.OsmandOdb.TransportRouteStop.Builder.class);
|
||||
internal_static_TransportStop_descriptor =
|
||||
getDescriptor().getMessageTypes().get(18);
|
||||
getDescriptor().getMessageTypes().get(19);
|
||||
internal_static_TransportStop_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_TransportStop_descriptor,
|
||||
|
@ -10668,7 +11223,7 @@ public final class OsmandOdb {
|
|||
net.osmand.binary.OsmandOdb.TransportStop.class,
|
||||
net.osmand.binary.OsmandOdb.TransportStop.Builder.class);
|
||||
internal_static_TransportStopsTree_descriptor =
|
||||
getDescriptor().getMessageTypes().get(19);
|
||||
getDescriptor().getMessageTypes().get(20);
|
||||
internal_static_TransportStopsTree_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_TransportStopsTree_descriptor,
|
||||
|
@ -10676,7 +11231,7 @@ public final class OsmandOdb {
|
|||
net.osmand.binary.OsmandOdb.TransportStopsTree.class,
|
||||
net.osmand.binary.OsmandOdb.TransportStopsTree.Builder.class);
|
||||
internal_static_OsmAndTransportIndex_descriptor =
|
||||
getDescriptor().getMessageTypes().get(20);
|
||||
getDescriptor().getMessageTypes().get(21);
|
||||
internal_static_OsmAndTransportIndex_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_OsmAndTransportIndex_descriptor,
|
||||
|
|
|
@ -904,7 +904,7 @@ public class IndexCreator {
|
|||
}
|
||||
}
|
||||
|
||||
Long streetId = getStreetInCity(c, name, location, a6.getId());
|
||||
Long streetId = getStreetInCity(c, name, location, (a6.getId() << 1) | 1);
|
||||
if(streetId == null){
|
||||
return;
|
||||
}
|
||||
|
@ -1169,17 +1169,17 @@ public class IndexCreator {
|
|||
loadEntityData(e, false);
|
||||
LatLon l = e.getLatLon();
|
||||
City city = getClosestCity(l);
|
||||
Long idStreet = getStreetInCity(city, e.getTag(OSMTagKey.ADDR_STREET), l, e.getId());
|
||||
Long idStreet = getStreetInCity(city, e.getTag(OSMTagKey.ADDR_STREET), l, e.getId() << 1);
|
||||
if (idStreet != null) {
|
||||
Building building = new Building(e);
|
||||
building.setName(e.getTag(OSMTagKey.ADDR_HOUSE_NUMBER));
|
||||
DataIndexWriter.writeBuilding(addressBuildingStat, pStatements, idStreet, building, BATCH_SIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
// suppose that streets with names are ways for car
|
||||
if (e instanceof Way /* && OSMSettings.wayForCar(e.getTag(OSMTagKey.HIGHWAY)) */
|
||||
} else if (e instanceof Way /* && OSMSettings.wayForCar(e.getTag(OSMTagKey.HIGHWAY)) */
|
||||
&& e.getTag(OSMTagKey.HIGHWAY) != null && e.getTag(OSMTagKey.NAME) != null) {
|
||||
// suppose that streets with names are ways for car
|
||||
// Ignore all ways that have house numbers and highway type
|
||||
boolean exist = false;
|
||||
|
||||
// if we saved address ways we could checked that we registered before
|
||||
|
@ -1199,7 +1199,7 @@ public class IndexCreator {
|
|||
loadEntityData(e, false);
|
||||
LatLon l = e.getLatLon();
|
||||
City city = getClosestCity(l);
|
||||
Long idStreet = getStreetInCity(city, e.getTag(OSMTagKey.NAME), l, e.getId());
|
||||
Long idStreet = getStreetInCity(city, e.getTag(OSMTagKey.NAME), l, e.getId() << 1);
|
||||
if (idStreet != null && saveAddressWays) {
|
||||
DataIndexWriter.writeStreetWayNodes(addressStreetNodeStat, pStatements, idStreet, (Way) e, BATCH_SIZE);
|
||||
}
|
||||
|
@ -1543,14 +1543,11 @@ public class IndexCreator {
|
|||
}
|
||||
|
||||
restrictionsUse.clear();
|
||||
if (MapRenderingTypes.isHighwayType(type)) {
|
||||
// try to find restrictions only for max zoom level
|
||||
if (level == 0 && highwayRestrictions.containsKey(baseId)) {
|
||||
restrictionsUse.addAll(highwayRestrictions.get(baseId));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
boolean point = (type & 3) == MapRenderingTypes.POINT_TYPE;
|
||||
RTree rtree = null;
|
||||
int zoom;
|
||||
|
@ -1609,7 +1606,7 @@ public class IndexCreator {
|
|||
|
||||
if (!skip) {
|
||||
int highwayAttributes = 0;
|
||||
if(MapRenderingTypes.isHighwayType(type)){
|
||||
if (e.getTag(OSMTagKey.HIGHWAY) != null) {
|
||||
highwayAttributes = MapRenderingTypes.getHighwayAttributes(e);
|
||||
}
|
||||
String eName = MapRenderingTypes.getEntityName(e, type);
|
||||
|
@ -1725,6 +1722,7 @@ public class IndexCreator {
|
|||
progress.finishTask();
|
||||
|
||||
writer.endWriteAddressIndex();
|
||||
writer.flush();
|
||||
|
||||
}
|
||||
|
||||
|
@ -1756,9 +1754,9 @@ public class IndexCreator {
|
|||
writer.endWriteMapLevelIndex();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
writer.writeMapEncodingRules(MapRenderingTypes.getEncodingRuleTypes());
|
||||
writer.endWriteMapIndex();
|
||||
writer.flush();
|
||||
} catch (RTreeException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
|
@ -1898,6 +1896,7 @@ public class IndexCreator {
|
|||
writer.writeTransportStringTable(stringTable);
|
||||
|
||||
writer.endWriteTransportIndex();
|
||||
writer.flush();
|
||||
} catch (RTreeException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
|
@ -2186,8 +2185,21 @@ public class IndexCreator {
|
|||
}
|
||||
progress.finishTask();
|
||||
writer.close();
|
||||
mapRAFile.close();
|
||||
log.info("Finish writing binary file");
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
log.error("Log exception", e);
|
||||
throw e;
|
||||
} catch (SQLException e) {
|
||||
log.error("Log exception", e);
|
||||
throw e;
|
||||
} catch (IOException e) {
|
||||
log.error("Log exception", e);
|
||||
throw e;
|
||||
} catch (SAXException e) {
|
||||
log.error("Log exception", e);
|
||||
throw e;
|
||||
} finally {
|
||||
try {
|
||||
if (pselectNode != null) {
|
||||
|
@ -2501,12 +2513,12 @@ public class IndexCreator {
|
|||
public static void main(String[] args) throws IOException, SAXException, SQLException {
|
||||
long time = System.currentTimeMillis();
|
||||
IndexCreator creator = new IndexCreator(new File("e:/Information/OSM maps/osmand/"));
|
||||
// creator.setIndexMap(true);
|
||||
creator.setIndexMap(true);
|
||||
// creator.setIndexAddress(true);
|
||||
creator.setIndexPOI(true);
|
||||
// creator.setIndexTransport(true);
|
||||
|
||||
creator.recreateOnlyBinaryFile = false;
|
||||
creator.recreateOnlyBinaryFile = true;
|
||||
creator.deleteDatabaseIndexes = false;
|
||||
|
||||
creator.setNodesDBFile(new File("e:/Information/OSM maps/osmand/minsk.tmp.odb"));
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.osm;
|
|||
import gnu.trove.map.TIntByteMap;
|
||||
import gnu.trove.map.hash.TIntByteHashMap;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
|
@ -10,6 +11,7 @@ import java.util.LinkedHashSet;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.parsers.SAXParser;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
|
||||
|
@ -172,7 +174,7 @@ public class MapRenderingTypes {
|
|||
// special type means that ways will transform in area with the same point subtype = as area subtype
|
||||
// instead of zero point subtype (only for ways!)
|
||||
private final static int DEFAULT_POLYGON_BUILDING = 10;
|
||||
private static class MapRulType {
|
||||
public static class MapRulType {
|
||||
private String tag;
|
||||
// val could be null means others for that tag
|
||||
private Integer nullRule;
|
||||
|
@ -186,6 +188,10 @@ public class MapRenderingTypes {
|
|||
return tag;
|
||||
}
|
||||
|
||||
public Collection<String> getValuesSet(){
|
||||
return rules.keySet();
|
||||
}
|
||||
|
||||
public void registerType(int minZoom, String val, int pointRule, int polylineRule, int polygonRule, int type, int subtype){
|
||||
int r = encodeRule(minZoom, pointRule, polylineRule, polygonRule, type, subtype);
|
||||
if(val != null){
|
||||
|
@ -241,6 +247,21 @@ public class MapRenderingTypes {
|
|||
return (i >> 25);
|
||||
}
|
||||
|
||||
public int getType(String val) {
|
||||
Integer i = val == null ? nullRule : rules.get(val);
|
||||
if (i == null) {
|
||||
return 0;
|
||||
}
|
||||
return i & MASK_5;
|
||||
}
|
||||
|
||||
public int getSubType(String val) {
|
||||
Integer i = val == null ? nullRule : rules.get(val);
|
||||
if (i == null) {
|
||||
return 0;
|
||||
}
|
||||
return (i & MASK_13) >> 5;
|
||||
}
|
||||
|
||||
public int getType(String val, int mask){
|
||||
Integer i = val == null ? nullRule : rules.get(val);
|
||||
|
@ -251,6 +272,16 @@ public class MapRenderingTypes {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static Map<String, MapRulType> getEncodingRuleTypes(){
|
||||
if (types == null) {
|
||||
types = new LinkedHashMap<String, MapRulType>();
|
||||
init(INIT_RULE_TYPES);
|
||||
}
|
||||
return types;
|
||||
}
|
||||
|
||||
|
||||
// if type equals 0 no need to save that point
|
||||
public static int encodeEntityWithType(Entity e, int zoom, boolean multipolygon, List<Integer> additionalTypes) {
|
||||
if (types == null) {
|
||||
|
@ -314,7 +345,7 @@ public class MapRenderingTypes {
|
|||
int attr = getLayerAttributes(e) << 12;
|
||||
boolean prevPoint = (polylineType == 0 && polygonType == 0);
|
||||
polylineType = POLYLINE_TYPE | (typeVal & MASK_12) | attr;
|
||||
if (((polylineType >> 2) & MASK_4) == HIGHWAY || prevPoint){
|
||||
if (tag.equals("highway") || prevPoint){ //$NON-NLS-1$
|
||||
additionalTypes.add(0, polylineType);
|
||||
} else {
|
||||
additionalTypes.add(polylineType);
|
||||
|
@ -353,11 +384,6 @@ public class MapRenderingTypes {
|
|||
return type;
|
||||
}
|
||||
|
||||
//
|
||||
public static boolean isHighwayType(int t){
|
||||
return (t & 3) == POLYLINE_TYPE && ((t >> 2) & MASK_5) == HIGHWAY;
|
||||
}
|
||||
|
||||
public static boolean isOneWayWay(int highwayAttributes){
|
||||
return (highwayAttributes & 1) > 0;
|
||||
}
|
||||
|
@ -504,7 +530,7 @@ public class MapRenderingTypes {
|
|||
}
|
||||
|
||||
public static String getEntityName(Entity e, int mainType) {
|
||||
if (e.getTag(OSMTagKey.REF) != null && getMainObjectType(mainType) == HIGHWAY) {
|
||||
if (e.getTag(OSMTagKey.REF) != null && e.getTag(OSMTagKey.HIGHWAY) != null) {
|
||||
String ref = e.getTag(OSMTagKey.REF);
|
||||
if (ref.length() > 5 && ref.indexOf('_') != -1) {
|
||||
ref = ref.substring(0, ref.indexOf('_'));
|
||||
|
@ -520,10 +546,10 @@ public class MapRenderingTypes {
|
|||
if (name == null) {
|
||||
name = e.getTag(OSMTagKey.ADDR_HOUSE_NUMBER);
|
||||
}
|
||||
if(name == null && getMainObjectType(mainType) == NATURAL && getObjectSubType(mainType) == 13){
|
||||
if(name == null && "peak".equals(e.getTag(OSMTagKey.HIGHWAY))){ //$NON-NLS-1$
|
||||
name = e.getTag("ele"); //$NON-NLS-1$
|
||||
}
|
||||
if(name == null && getMainObjectType(mainType) == AEROWAY && getObjectSubType(mainType) == 17){
|
||||
if(name == null && "gete".equals(e.getTag("aeroway"))){ //$NON-NLS-1$ //$NON-NLS-2$
|
||||
name = e.getTag(OSMTagKey.REF);
|
||||
}
|
||||
return name;
|
||||
|
@ -687,9 +713,22 @@ public class MapRenderingTypes {
|
|||
}
|
||||
});
|
||||
log.info("Time to init " + (System.currentTimeMillis() - time)); //$NON-NLS-1$
|
||||
} catch (Exception e) {
|
||||
} catch (IOException e) {
|
||||
log.error("Unexpected error", e); //$NON-NLS-1$
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
} catch (RuntimeException e) {
|
||||
log.error("Unexpected error", e); //$NON-NLS-1$
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
} catch (ParserConfigurationException e) {
|
||||
log.error("Unexpected error", e); //$NON-NLS-1$
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
} catch (SAXException e) {
|
||||
log.error("Unexpected error", e); //$NON-NLS-1$
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<!-- 1) 31 (5 bytes) maximum number of different types -->
|
||||
<!-- 2) In each type only 31 (5 bytes) different polyline and polygon (in sum) subtypes available. -->
|
||||
<!-- 3) In each type only 127 (7 bytes) all different subtypes available -->
|
||||
<!-- Try to not change id of types and subtypes, some of the constants are hardcoded (for poi categorization and rendering order). -->
|
||||
<!-- TODO Try to not change id of types and subtypes, some of the constants are hardcoded (for rendering order, rendering). -->
|
||||
<type name="highway" id="1">
|
||||
<subtype id="2" polyline="true" tag="highway" value="motorway" maxzoom="6" />
|
||||
<subtype id="2" polyline="true" tag="highway" value="motorway_link" maxzoom="10" />
|
||||
|
|
|
@ -34,6 +34,17 @@ message OsmAndMapIndex {
|
|||
repeated MapRootLevel levels = 1;
|
||||
|
||||
optional string name = 3;
|
||||
|
||||
repeated MapEncodingRule rules = 8;
|
||||
}
|
||||
|
||||
message MapEncodingRule {
|
||||
required string tag = 3;
|
||||
optional string value = 5;
|
||||
required uint32 type = 6;
|
||||
required uint32 subtype = 7;
|
||||
|
||||
optional uint32 minZoom = 9;
|
||||
}
|
||||
|
||||
message MapRootLevel {
|
||||
|
|
Loading…
Reference in a new issue