use of uk.me.parabola.imgfmt.app.lbl.Country 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.Country in project mkgmap by openstreetmap.
the class MdrBuilder method addCountries.
private Map<Integer, Mdr14Record> addCountries(MapReader mr) {
Map<Integer, Mdr14Record> countryMap = new HashMap<>();
List<Country> countries = mr.getCountries();
for (Country c : countries) {
if (c != null) {
Mdr14Record record = mdrFile.addCountry(c);
countryMap.put((int) c.getIndex(), record);
}
}
return countryMap;
}
use of uk.me.parabola.imgfmt.app.lbl.Country 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