On 02/06/11 15:13, WanMil wrote:
Steve,
no matter if there are some minor issues left your patch is a big
improvement and is worth being committed.
OK thanks, but I now have a patch that works with your new example.
Attached.
..Steve
Index: src/uk/me/parabola/imgfmt/app/mdr/Mdr5.java
===================================================================
--- src/uk/me/parabola/imgfmt/app/mdr/Mdr5.java (revision 1870)
+++ src/uk/me/parabola/imgfmt/app/mdr/Mdr5.java (revision )
@@ -64,16 +64,18 @@
cities.clear();
int count = 0;
int lastMapId = 0;
+ int lastRegion = 0;
String lastName = null;
for (SortKey<Mdr5Record> key : sortKeys) {
Mdr5Record c = key.getObject();
- if (c.getMapIndex() != lastMapId || !c.getName().equals(lastName)) {
+ if (c.getMapIndex() != lastMapId || !c.getName().equals(lastName) || c.getRegionIndex() != lastRegion) {
count++;
c.setGlobalCityIndex(count);
cities.add(c);
lastName = c.getName();
lastMapId = c.getMapIndex();
+ lastRegion = c.getRegionIndex();
} else {
c.setGlobalCityIndex(count);
}
@@ -116,12 +118,14 @@
*/
private void fix20() {
String lastName = null;
+ int lastRegion = 0;
for (int index = 1; index < cities.size(); index++) {
Mdr5Record city = cities.get(index-1);
+ int region = city.getRegionIndex();
assert city.getGlobalCityIndex() == index : index + "/" + city.getGlobalCityIndex();
String name = city.getName();
- if (name.equals(lastName)) {
+ if (name.equals(lastName) && region == lastRegion) {
int last = findLastRepeat(index, name);
int mdr20val = findMin20(index - 1, last);
for (int j = index-1; j < last; j++) {
@@ -133,6 +137,7 @@
}
lastName = name;
+ lastRegion = region;
}
}
Index: src/uk/me/parabola/imgfmt/app/mdr/Mdr20.java
===================================================================
--- src/uk/me/parabola/imgfmt/app/mdr/Mdr20.java (revision 1870)
+++ src/uk/me/parabola/imgfmt/app/mdr/Mdr20.java (revision )
@@ -73,19 +73,23 @@
String lastCityName = null;
int lastMapid = 0;
int record = 0;
+ int lastRegion = 0;
for (SortKey<Mdr7Record> key : keys) {
Mdr7Record street = key.getObject();
int mapid = street.getMapIndex();
String name = street.getName();
String cityName = street.getCity().getName();
- if (mapid != lastMapid || !name.equals(lastName) || !cityName.equals(lastCityName)) {
+ int region = street.getCity().getRegionIndex();
+
+ if (mapid != lastMapid || !name.equals(lastName) || !cityName.equals(lastCityName) || region != lastRegion) {
record++;
streets.add(street);
lastMapid = mapid;
lastName = name;
lastCityName = cityName;
+ lastRegion = region;
}
int gci = street.getCity().getGlobalCityIndex();
_______________________________________________
mkgmap-dev mailing list
mkgmap-dev@lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev