use of uk.me.parabola.imgfmt.app.mdr.Mdr13Record in project mkgmap by openstreetmap.
the class MdrBuilder method addRegions.
private Map<Integer, Mdr13Record> addRegions(MapReader mr, AreaMaps maps) {
Map<Integer, Mdr13Record> regionMap = new HashMap<>();
List<Region> regions = mr.getRegions();
for (Region region : regions) {
if (region != null) {
Mdr14Record mdr14 = maps.countries.get((int) region.getCountry().getIndex());
Mdr13Record record = mdrFile.addRegion(region, mdr14);
regionMap.put((int) region.getIndex(), record);
}
}
return regionMap;
}
use of uk.me.parabola.imgfmt.app.mdr.Mdr13Record in project mkgmap by openstreetmap.
the class MdrBuilder method fetchCities.
/**
* There is not complete information that we need about a city in the city
* section, it has to be completed from the points section. So we fetch
* and create the mdr5s first before points.
*/
private List<Mdr5Record> fetchCities(MapReader mr, AreaMaps maps) {
Map<Integer, Mdr5Record> cityMap = maps.cities;
List<Mdr5Record> cityList = new ArrayList<>();
List<City> cities = mr.getCities();
for (City c : cities) {
int regionCountryNumber = c.getRegionCountryNumber();
Mdr13Record mdrRegion = null;
Mdr14Record mdrCountry;
if ((regionCountryNumber & 0x4000) == 0) {
mdrRegion = maps.regions.get(regionCountryNumber);
mdrCountry = mdrRegion.getMdr14();
} else {
mdrCountry = maps.countries.get(regionCountryNumber & 0x3fff);
}
Mdr5Record mdrCity = new Mdr5Record();
mdrCity.setCityIndex(c.getIndex());
mdrCity.setRegionIndex(c.getRegionCountryNumber());
mdrCity.setMdrRegion(mdrRegion);
mdrCity.setMdrCountry(mdrCountry);
mdrCity.setLblOffset(c.getLblOffset());
mdrCity.setName(c.getName());
int key = (c.getSubdivNumber() << 8) + (c.getPointIndex() & 0xff);
assert key < 0xffffff;
cityMap.put(key, mdrCity);
cityList.add(mdrCity);
}
return cityList;
}
Aggregations