| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
package uk.me.parabola.imgfmt.app.mdr; |
| 14 |
|
| 15 |
import java.util.ArrayList; |
| 16 |
import java.util.List; |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
public class Mdr21 extends Mdr2x { |
| 26 |
|
| 27 |
public Mdr21(MdrConfig config) { |
| 28 |
setConfig(config); |
| 29 |
} |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
public void buildFromStreets(List<Mdr7Record> inStreets) { |
| 38 |
ArrayList<Mdr7Record> sorted = new ArrayList<>(inStreets.size()); |
| 39 |
for (Mdr7Record street : inStreets) { |
| 40 |
if (street.getCity() != null && street.getCity().getMdrRegion() != null) |
| 41 |
sorted.add(street); |
| 42 |
} |
| 43 |
sorted.sort((o1, o2) -> { |
| 44 |
int d = Integer.compare(o1.getCity().getMdr21SortPos(), o2.getCity().getMdr21SortPos()); |
| 45 |
if (d != 0) |
| 46 |
return d; |
| 47 |
return Integer.compare(o1.getIndex(), o2.getIndex()); |
| 48 |
}); |
| 49 |
|
| 50 |
int lastIndex = -1; |
| 51 |
int record = 0; |
| 52 |
for (Mdr7Record street : sorted) { |
| 53 |
if (lastIndex != street.getIndex()) { |
| 54 |
record++; |
| 55 |
streets.add(street); |
| 56 |
|
| 57 |
Mdr13Record mdrRegion = street.getCity().getMdrRegion(); |
| 58 |
if (mdrRegion != null) { |
| 59 |
Mdr28Record mdr28 = mdrRegion.getMdr28(); |
| 60 |
mdr28.setMdr21(record); |
| 61 |
} |
| 62 |
|
| 63 |
lastIndex = street.getIndex(); |
| 64 |
} |
| 65 |
} |
| 66 |
} |
| 67 |
|
| 68 |
protected boolean sameGroup(Mdr7Record street1, Mdr7Record street2) { |
| 69 |
return true; |
| 70 |
} |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
public int getExtraValue() { |
| 76 |
return 0x11800; |
| 77 |
} |
| 78 |
} |