Hi Gerd
My idea was to optimize the cases where partial name and name are different.
If I got it right, we use this to handle the highway shields.
I wonder if it would be enough to move the byte(s) for the highway shield
to the end of the name that is used for sorting?
Yes, we can completely remove the MultiSortKey and treat all
cases the same. Just need to append any initial part of the name
at the end.
As in attached (untested) patch.
..Steve
Index: src/uk/me/parabola/imgfmt/app/mdr/Mdr7Record.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/uk/me/parabola/imgfmt/app/mdr/Mdr7Record.java (revision 3478)
+++ src/uk/me/parabola/imgfmt/app/mdr/Mdr7Record.java (revision )
@@ -109,4 +109,8 @@
public String toString() {
return name + " in " + city.getName();
}
+
+ public String getInitalPart() {
+ return name.substring(0, (nameOffset & 0xff));
+ }
}
Index: src/uk/me/parabola/imgfmt/app/mdr/Mdr7.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/uk/me/parabola/imgfmt/app/mdr/Mdr7.java (revision 3478)
+++ src/uk/me/parabola/imgfmt/app/mdr/Mdr7.java (revision )
@@ -167,12 +167,8 @@
Sort sort = getConfig().getSort();
List<SortKey<Mdr7Record>> sortedStreets = new ArrayList<>(allStreets.size());
for (Mdr7Record m : allStreets) {
- String partialName = m.getPartialName();
- String name = m.getName();
- SortKey<Mdr7Record> nameKey = sort.createSortKey(m, m.getName(), m.getMapIndex());
- SortKey<Mdr7Record> partialKey = name.equals(partialName) ? nameKey : sort.createSortKey(m, partialName);
- MultiSortKey<Mdr7Record> sortKey = new MultiSortKey<>(partialKey, nameKey, null);
- sortedStreets.add(sortKey);
+ String nameForKey = m.getPartialName() + m.getInitalPart();
+ sortedStreets.add(sort.createSortKey(m, nameForKey, m.getMapIndex()));
}
Collections.sort(sortedStreets);
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev