use of uk.me.parabola.imgfmt.app.lbl.Region in project mkgmap by openstreetmap.
the class MapBuilder method processCities.
/**
* Processing of Cities
*
* Fills the city list in lbl block that is required for find by name
* It also builds up information that is required to get address info
* for the POIs
*
* @param map The map.
* @param src The map data.
*/
private void processCities(Map map, MapDataSource src) {
LBLFile lbl = map.getLblFile();
if (locationAutofill.isEmpty() == false) {
// collect the names of the cities
for (MapPoint p : src.getPoints()) {
if (p.isCity() && p.getName() != null)
// Put the city info the map for missing info
locator.addCityOrPlace(p);
}
// Try to fill missing information that include search of next city
locator.autofillCities();
}
for (MapPoint p : src.getPoints()) {
if (p.isCity() && p.getName() != null) {
String countryStr = p.getCountry();
Country thisCountry;
if (countryStr != null) {
thisCountry = lbl.createCountry(countryStr, locator.getCountryISOCode(countryStr));
} else
thisCountry = getDefaultCountry();
String regionStr = p.getRegion();
Region thisRegion;
if (regionStr != null) {
thisRegion = lbl.createRegion(thisCountry, regionStr, null);
} else
thisRegion = getDefaultRegion(thisCountry);
City thisCity;
if (thisRegion != null)
thisCity = lbl.createCity(thisRegion, p.getName(), true);
else
thisCity = lbl.createCity(thisCountry, p.getName(), true);
cityMap.put(p, thisCity);
}
}
}
use of uk.me.parabola.imgfmt.app.lbl.Region 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.lbl.Region in project mkgmap by openstreetmap.
the class MapBuilder method calcCity.
private City calcCity(LBLFile lbl, String city, String region, String country) {
if (city == null && region == null && country == null)
return null;
Country cc = (country == null) ? getDefaultCountry() : lbl.createCountry(locator.normalizeCountry(country), locator.getCountryISOCode(country));
Region cr = (region == null) ? getDefaultRegion(cc) : lbl.createRegion(cc, region, null);
if (city == null && (country != null || region != null)) {
// if city name is unknown and region and/or country is known
// use empty name for the city
city = UNKNOWN_CITY_NAME;
}
if (city == null)
return null;
if (cr != null) {
return lbl.createCity(cr, city, false);
} else {
return lbl.createCity(cc, city, false);
}
}
Aggregations