From 43e79232893dbbf36b0f4135413f4efc0f1dbb69 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 7 May 2016 17:56:08 +0200 Subject: [PATCH 1/2] Prepare to accept merge for mapcreator --- .../net/osmand/binary/BinaryIndexPart.java | 6 +++++- .../binary/BinaryMapAddressReaderAdapter.java | 19 +++++++++++++++++++ .../osmand/binary/BinaryMapIndexReader.java | 4 ++++ .../binary/BinaryMapPoiReaderAdapter.java | 8 ++++++++ .../binary/BinaryMapRouteReaderAdapter.java | 7 +++++++ .../BinaryMapTransportReaderAdapter.java | 8 ++++++++ 6 files changed, 51 insertions(+), 1 deletion(-) diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryIndexPart.java b/OsmAnd-java/src/net/osmand/binary/BinaryIndexPart.java index 361a8fb92d..36cd398d7a 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryIndexPart.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryIndexPart.java @@ -1,11 +1,15 @@ package net.osmand.binary; -public class BinaryIndexPart { +public abstract class BinaryIndexPart { String name; int length; int filePointer; + abstract public String getPartName(); + + abstract public int getFieldNumber(); + public int getLength() { return length; } diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapAddressReaderAdapter.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapAddressReaderAdapter.java index 2805f8d5d0..231b2d50fc 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapAddressReaderAdapter.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapAddressReaderAdapter.java @@ -39,6 +39,8 @@ public class BinaryMapAddressReaderAdapter { public final static int STREET_TYPE = 4; private static final Log LOG = PlatformUtil.getLog(BinaryMapAddressReaderAdapter.class); + public final static int[] TYPES = { CITY_TOWN_TYPE, POSTCODES_TYPE, VILLAGES_TYPE, STREET_TYPE }; + public final static int[] CITY_TYPES = { CITY_TOWN_TYPE, POSTCODES_TYPE, VILLAGES_TYPE }; public static class AddressRegion extends BinaryIndexPart { String enName; @@ -63,10 +65,27 @@ public class BinaryMapAddressReaderAdapter { public int getIndexNameOffset() { return indexNameOffset; } + + + public String getPartName() { + return "Address"; + } + + public int getFieldNumber() { + return OsmandOdb.OsmAndStructure.ADDRESSINDEX_FIELD_NUMBER; + } } public static class CitiesBlock extends BinaryIndexPart { int type; + + public String getPartName() { + return "City"; + } + + public int getFieldNumber() { + return OsmandOdb.OsmAndAddressIndex.CITIES_FIELD_NUMBER; + } } private CodedInputStream codedIS; diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java index 32e50fff77..feea3b9059 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java @@ -82,6 +82,10 @@ public class BinaryMapIndexReader { private final static Log log = PlatformUtil.getLog(BinaryMapIndexReader.class); public static boolean READ_STATS = false; + public final static int[] TYPES = { CITY_TOWN_TYPE, POSTCODES_TYPE, VILLAGES_TYPE, STREET_TYPE }; + public final static int[] CITY_TYPES = { CITY_TOWN_TYPE, POSTCODES_TYPE, VILLAGES_TYPE }; + + private final RandomAccessFile raf; protected final File file; /*private*/ int version; diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapPoiReaderAdapter.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapPoiReaderAdapter.java index afdc1c697e..baeb1bd937 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapPoiReaderAdapter.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapPoiReaderAdapter.java @@ -65,6 +65,14 @@ public class BinaryMapPoiReaderAdapter { return leftLongitude; } + public String getPartName() { + return "POI"; + } + + public int getFieldNumber() { + return OsmandOdb.OsmAndStructure.POIINDEX_FIELD_NUMBER; + } + public PoiSubType getSubtypeFromId(int id, StringBuilder returnValue) { int tl; int sl; diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java index 902dd7e7d9..031407e088 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java @@ -215,6 +215,13 @@ public class BinaryMapRouteReaderAdapter { int destinationTypeRule = -1; int destinationRefTypeRule = -1; + public String getPartName() { + return "Routing"; + } + + public int getFieldNumber() { + return OsmandOdb.OsmAndStructure.ROUTINGINDEX_FIELD_NUMBER; + } public RouteTypeRule quickGetEncodingRule(int id) { return routeEncodingRules.get(id); diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapTransportReaderAdapter.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapTransportReaderAdapter.java index 38a447ce59..63751e04f3 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapTransportReaderAdapter.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapTransportReaderAdapter.java @@ -41,6 +41,14 @@ public class BinaryMapTransportReaderAdapter { int stopsFileOffset = 0; int stopsFileLength = 0; + + public String getPartName() { + return "Transport"; + } + + public int getFieldNumber() { + return OsmandOdb.OsmAndStructure.TRANSPORTINDEX_FIELD_NUMBER; + } public int getLeft() { return left; From 83f9b03dde87e82a91d4dbc95c8f7889dd88fadc Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 7 May 2016 17:58:28 +0200 Subject: [PATCH 2/2] Prepare to accept merge for mapcreator --- .../src/net/osmand/binary/BinaryMapIndexReader.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java index feea3b9059..ae83cf3ba9 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java @@ -82,9 +82,6 @@ public class BinaryMapIndexReader { private final static Log log = PlatformUtil.getLog(BinaryMapIndexReader.class); public static boolean READ_STATS = false; - public final static int[] TYPES = { CITY_TOWN_TYPE, POSTCODES_TYPE, VILLAGES_TYPE, STREET_TYPE }; - public final static int[] CITY_TYPES = { CITY_TOWN_TYPE, POSTCODES_TYPE, VILLAGES_TYPE }; - private final RandomAccessFile raf; protected final File file; @@ -1831,6 +1828,14 @@ public class BinaryMapIndexReader { public boolean isBaseMap(){ return name != null && name.toLowerCase().contains(BASEMAP_NAME); } + + public String getPartName() { + return "Map"; + } + + public int getFieldNumber() { + return OsmandOdb.OsmAndStructure.MAPINDEX_FIELD_NUMBER; + } } public static class TagValuePair {