Hi Michał
I suppose problem may be in content of an index - your map of Poland works well on my device but any map compiled by me (using latest mkgmap release) using data I sent you (bigger Europe slice than boundary of Poland) has broken index. Yesterday I made some tests and neither compilation with latin1 not 1252 nor 1250 works. Index in MapSource works well, maps uploaded using MapSource also work well.
I've found a few differences with the gmapsupp that we produce and the attached patch fixes most of them. I would appreciate if you could test the current patch. Trouble is, that nothing that I've changed really appears to be specific to that part of the world and so I don't why it does not affect everyone. There are a few names that begin with spaces, which are possibly a problem. I would like to get rid of all initial spaces from names and I will attempt that in the next patch. Best wishes ..Steve
Index: src/uk/me/parabola/imgfmt/app/mdr/Mdr2x.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- src/uk/me/parabola/imgfmt/app/mdr/Mdr2x.java (revision 3122) +++ src/uk/me/parabola/imgfmt/app/mdr/Mdr2x.java (revision ) @@ -34,6 +34,7 @@ */ public void writeSectData(ImgFileWriter writer) { String lastName = null; + Mdr7Record prev = null; int size = getSizes().getStreetSizeFlagged(); @@ -47,11 +48,10 @@ String name = Label.stripGarminCodes(street.getName()); int flag = 1; - if (name.equals(lastName)) { + if (name.equals(lastName) && sameGroup(street, prev)) flag = 0; - } else { - lastName = name; + lastName = name; - } + prev = street; if (hasLabel) { putMapIndex(writer, street.getMapIndex()); @@ -98,4 +98,15 @@ protected void releaseMemory() { streets = null; } + + /** + * These sections are divided into groups based on city, region or country. This routine is + * implemented to return true if the two streets are in the same group. + * + * It is not clear if this is needed for region or country. + * @param street1 The first street. + * @param street2 The street to compare against. + * @return True if the streets are in the same group (city, region etc). + */ + protected abstract boolean sameGroup(Mdr7Record street1, Mdr7Record street2); } Index: src/uk/me/parabola/imgfmt/app/mdr/Mdr22.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- src/uk/me/parabola/imgfmt/app/mdr/Mdr22.java (revision 3122) +++ src/uk/me/parabola/imgfmt/app/mdr/Mdr22.java (revision ) @@ -48,8 +48,8 @@ public void buildFromStreets(List<Mdr7Record> inStreets) { Sort sort = getConfig().getSort(); - List<SortKey<Mdr7Record>> keys = new ArrayList<SortKey<Mdr7Record>>(); - Map<String, byte[]> cache = new HashMap<String, byte[]>(); + List<SortKey<Mdr7Record>> keys = new ArrayList<>(); + Map<String, byte[]> cache = new HashMap<>(); for (Mdr7Record s : inStreets) { Mdr5Record city = s.getCity(); if (city == null) continue; @@ -91,6 +91,10 @@ } } + protected boolean sameGroup(Mdr7Record street1, Mdr7Record street2) { + return true; + } + public List<Mdr7Record> getStreets() { return Collections.unmodifiableList(streets); } @@ -100,7 +104,7 @@ */ public int getExtraValue() { if (isForDevice()) - return 0xc000a; + return 0x600a; else return 0x11000; } Index: src/uk/me/parabola/imgfmt/app/mdr/Mdr21.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- src/uk/me/parabola/imgfmt/app/mdr/Mdr21.java (revision 3122) +++ src/uk/me/parabola/imgfmt/app/mdr/Mdr21.java (revision ) @@ -42,8 +42,8 @@ public void buildFromStreets(List<Mdr7Record> inStreets) { Sort sort = getConfig().getSort(); - List<SortKey<Mdr7Record>> keys = new ArrayList<SortKey<Mdr7Record>>(); - Map<String, byte[]> cache = new HashMap<String, byte[]>(); + List<SortKey<Mdr7Record>> keys = new ArrayList<>(); + Map<String, byte[]> cache = new HashMap<>(); for (Mdr7Record s : inStreets) { Mdr5Record city = s.getCity(); @@ -83,6 +83,10 @@ lastName = name; } } + } + + protected boolean sameGroup(Mdr7Record street1, Mdr7Record street2) { + return true; } /** Index: .idea/inspectionProfiles/Mapping.xml IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- .idea/inspectionProfiles/Mapping.xml (revision 3122) +++ .idea/inspectionProfiles/Mapping.xml (revision ) @@ -640,7 +640,7 @@ <inspection_tool class="DuplicateThrows" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="DuplicatedBeanNamesInspection" enabled="true" level="ERROR" enabled_by_default="true" /> <inspection_tool class="DuplicatedBlockNamesInspection" enabled="true" level="WARNING" enabled_by_default="true" /> - <inspection_tool class="Duplicates" enabled="false" level="WARNING" enabled_by_default="true" /> + <inspection_tool class="Duplicates" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="DynamicRegexReplaceableByCompiledPattern" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="DynamicallyGeneratedCodeJS" enabled="false" level="WARNING" enabled_by_default="false" /> <inspection_tool class="ELDeferredExpressionsInspection" enabled="false" level="WARNING" enabled_by_default="false" /> \ No newline at end of file Index: src/uk/me/parabola/imgfmt/app/mdr/PrefixIndex.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- src/uk/me/parabola/imgfmt/app/mdr/PrefixIndex.java (revision 3122) +++ src/uk/me/parabola/imgfmt/app/mdr/PrefixIndex.java (revision ) @@ -18,7 +18,6 @@ import java.util.List; import uk.me.parabola.imgfmt.app.ImgFileWriter; -import uk.me.parabola.imgfmt.app.Label; import uk.me.parabola.imgfmt.app.srt.Sort; /** @@ -33,7 +32,7 @@ private int maxIndex; // We use mdr8record for all similar indexes. - private final List<Mdr8Record> index = new ArrayList<Mdr8Record>(); + private final List<Mdr8Record> index = new ArrayList<>(); /** * Sets the config and the prefix length for this index. @@ -129,14 +128,23 @@ * prefix of name and padded with nulls if necessary to make up the length. */ private String getPrefix(String in) { - String name = Label.stripGarminCodes(in); - if (prefixLength > name.length()) { - StringBuilder sb = new StringBuilder(name); - while (sb.length() < prefixLength) - sb.append('\0'); - return sb.toString(); + StringBuilder sb = new StringBuilder(); + char[] chars = in.toCharArray(); + int ci = 0; + for (int i = 0; i < prefixLength; i++) { + char c = 0; + while (ci < chars.length) { + // TODO: simplify when initial spaces are removed + c = chars[ci++]; + if (ci == 1 && c== 0x20) + continue; + if (c >= 0x20) + break; - } + } - return name.substring(0, prefixLength); + sb.append(c); + } + + return sb.toString(); } public int getPrefixLength() { Index: src/uk/me/parabola/imgfmt/app/mdr/Mdr20.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- src/uk/me/parabola/imgfmt/app/mdr/Mdr20.java (revision 3122) +++ src/uk/me/parabola/imgfmt/app/mdr/Mdr20.java (revision ) @@ -125,6 +125,15 @@ } /** + * Two streets are in the same group if they have the same mdr20 id. + */ + protected boolean sameGroup(Mdr7Record street1, Mdr7Record street2) { + if (street2 != null && street1.getCity().getMdr20() == street2.getCity().getMdr20()) + return true; + return false; + } + + /** * Unknown. */ public int getExtraValue() { Index: src/uk/me/parabola/imgfmt/app/mdr/MDRFile.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- src/uk/me/parabola/imgfmt/app/mdr/MDRFile.java (revision 3122) +++ src/uk/me/parabola/imgfmt/app/mdr/MDRFile.java (revision ) @@ -373,7 +373,7 @@ private void writeSection(ImgFileWriter writer, int sectionNumber, MdrSection section) { // Some sections are just not written in the device config - if (forDevice && Arrays.asList(12, 13, 14, 15, 21, 23, 26, 27, 28).contains(sectionNumber)) + if (forDevice && Arrays.asList(13, 14, 15, 21, 23, 26, 27, 28).contains(sectionNumber)) return; section.setSizes(sizes);
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev