From 282101588b5ba62b3f2352e5ee3d02ad974a7388 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Mon, 19 Mar 2012 00:39:04 +0100 Subject: [PATCH] Test version --- .../src/net/osmand/binary/BinaryInspector.java | 12 ++++++++---- .../src/net/osmand/binary/BinaryMapIndexReader.java | 8 ++++---- .../net/osmand/data/preparation/IndexCreator.java | 6 +++--- .../data/preparation/IndexVectorMapCreator.java | 8 +++++--- .../src/net/osmand/osm/MapRenderingTypes.java | 3 +++ 5 files changed, 23 insertions(+), 14 deletions(-) diff --git a/DataExtractionOSM/src/net/osmand/binary/BinaryInspector.java b/DataExtractionOSM/src/net/osmand/binary/BinaryInspector.java index 09f984ce13..fc3182d7d1 100644 --- a/DataExtractionOSM/src/net/osmand/binary/BinaryInspector.java +++ b/DataExtractionOSM/src/net/osmand/binary/BinaryInspector.java @@ -50,7 +50,7 @@ public class BinaryInspector { // inspector(new String[]{"-v","C:\\Users\\tpd\\osmand\\Housenumbers.obf"}); //inspector(new String[]{"/home/victor/projects/OsmAnd/data/osm-gen/saved/Belarus-newzooms-new-rt.obf"}); // inspector(new String[]{"/home/victor/projects/OsmAnd/download/spain/Spain_europe_1_small.obf"}); - inspector(new String[]{/*"-vmap", */"/home/victor/projects/OsmAnd/data/osm-gen/Luxembourg.obf"}); + inspector(new String[]{"-vmap","/home/victor/projects/OsmAnd/data/osm-gen/Luxembourg.obf"}); // test case extract parts @@ -513,12 +513,14 @@ public class BinaryInspector { } TagValuePair pair = obj.getMapIndex().decodeType(types[j]); if(pair == null) { - throw new NullPointerException("Type " + types[j] + "was not found"); + System.err.println("Type " + types[j] + "was not found"); + continue; +// throw new NullPointerException("Type " + obj.getAdditionalTypes()[j] + "was not found"); } b.append(pair.toSimpleString()+"("+types[j]+")"); } b.append("]"); - if(obj.getAdditionalTypes() != null){ + if(obj.getAdditionalTypes() != null && obj.getAdditionalTypes().length > 0){ b.append(" add_types ["); for(int j = 0; j 0) { @@ -526,7 +528,9 @@ public class BinaryInspector { } TagValuePair pair = obj.getMapIndex().decodeType(obj.getAdditionalTypes()[j]); if(pair == null) { - throw new NullPointerException("Type " + obj.getAdditionalTypes()[j] + "was not found"); + System.err.println("Type " + obj.getAdditionalTypes()[j] + "was not found"); + continue; +// throw new NullPointerException("Type " + obj.getAdditionalTypes()[j] + "was not found"); } b.append(pair.toSimpleString()+"("+obj.getAdditionalTypes()[j]+")"); diff --git a/DataExtractionOSM/src/net/osmand/binary/BinaryMapIndexReader.java b/DataExtractionOSM/src/net/osmand/binary/BinaryMapIndexReader.java index d03a8b6be6..7856b001b4 100644 --- a/DataExtractionOSM/src/net/osmand/binary/BinaryMapIndexReader.java +++ b/DataExtractionOSM/src/net/osmand/binary/BinaryMapIndexReader.java @@ -1448,9 +1448,9 @@ public class BinaryMapIndexReader { private static boolean testPoiSearch = false; private static boolean testTransportSearch = false; private static int sleft = MapUtils.get31TileNumberX(6.3); - private static int sright = MapUtils.get31TileNumberX(6.4); - private static int stop = MapUtils.get31TileNumberY(49.5); - private static int sbottom = MapUtils.get31TileNumberY(49.4); + private static int sright = MapUtils.get31TileNumberX(6.5); + private static int stop = MapUtils.get31TileNumberY(49.9); + private static int sbottom = MapUtils.get31TileNumberY(49.7); private static int szoom = 15; private static void println(String s){ @@ -1696,7 +1696,7 @@ public class BinaryMapIndexReader { b.append(pair.toSimpleString()+"("+types[j]+")"); } b.append("]"); - if(obj.getAdditionalTypes() != null){ + if(obj.getAdditionalTypes() != null && obj.getAdditionalTypes().length > 0){ b.append(" add_types ["); for(int j = 0; j 0) { diff --git a/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java b/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java index 16b03b74cc..a605714221 100644 --- a/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java +++ b/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java @@ -626,9 +626,9 @@ public class IndexCreator { long time = System.currentTimeMillis(); IndexCreator creator = new IndexCreator(new File("/home/victor/projects/OsmAnd/data/osm-gen/")); //$NON-NLS-1$ creator.setIndexMap(true); - creator.setIndexAddress(true); - creator.setIndexPOI(true); - creator.setIndexTransport(true); + creator.setIndexAddress(false); + creator.setIndexPOI(false); + creator.setIndexTransport(false); creator.recreateOnlyBinaryFile = false; creator.deleteDatabaseIndexes = false; diff --git a/DataExtractionOSM/src/net/osmand/data/preparation/IndexVectorMapCreator.java b/DataExtractionOSM/src/net/osmand/data/preparation/IndexVectorMapCreator.java index 81ae1bb8d9..d588680dd2 100644 --- a/DataExtractionOSM/src/net/osmand/data/preparation/IndexVectorMapCreator.java +++ b/DataExtractionOSM/src/net/osmand/data/preparation/IndexVectorMapCreator.java @@ -356,8 +356,8 @@ public class IndexVectorMapCreator extends AbstractIndexPartCreator { if (visitedWays.contains(id)) { continue; } - visitedWays.add(id); + int level = rs.getInt(8); int zoom = mapZooms.getLevel(level).getMaxZoom(); @@ -458,6 +458,8 @@ public class IndexVectorMapCreator extends AbstractIndexPartCreator { insertBinaryMapRenderObjectIndex(mapTree[level], res, null, namesUse, id, false, typeUse, addtypeUse, false); } } + + // end cycle } @@ -795,13 +797,13 @@ public class IndexVectorMapCreator extends AbstractIndexPartCreator { } for (int j = 0; j < types.size(); j++) { try { - Algoritms.writeInt(bTypes, types.get(j)); + Algoritms.writeSmallInt(bTypes, types.get(j)); } catch (IOException e) { } } for (int j = 0; j < addTypes.size(); j++) { try { - Algoritms.writeInt(bAddtTypes, addTypes.get(j)); + Algoritms.writeSmallInt(bAddtTypes, addTypes.get(j)); } catch (IOException e) { } } diff --git a/DataExtractionOSM/src/net/osmand/osm/MapRenderingTypes.java b/DataExtractionOSM/src/net/osmand/osm/MapRenderingTypes.java index 47f115a999..2a6609adeb 100644 --- a/DataExtractionOSM/src/net/osmand/osm/MapRenderingTypes.java +++ b/DataExtractionOSM/src/net/osmand/osm/MapRenderingTypes.java @@ -153,6 +153,9 @@ public class MapRenderingTypes { if (rType.minzoom > zoom) { continue; } + if(rType.targetTagValue != null) { + rType = rType.targetTagValue; + } rType.freq++; if (rType.names != null) { for (int i = 0; i < rType.names.length; i++) {