use of uk.me.parabola.imgfmt.app.Label in project mkgmap by openstreetmap.
the class POIRecord method write.
void write(ImgFileWriter writer, byte POIGlobalFlags, int realofs, long numCities, long numZips, long numHighways, long numExitFacilities) {
assert offset == realofs : "offset = " + offset + " realofs = " + realofs;
int ptr = poiName.getOffset();
if (POIGlobalFlags != getPOIFlags())
ptr |= 0x800000;
writer.put3(ptr);
if (POIGlobalFlags != getPOIFlags())
writer.put(getWrittenPOIFlags(POIGlobalFlags));
if (streetNumberName != null) {
int labOff = streetNumberName.getOffset();
writer.put((byte) ((labOff & 0x7F0000) >> 16));
writer.putChar((char) (labOff & 0xFFFF));
} else if (simpleStreetNumber.isUsed())
simpleStreetNumber.write(writer);
if (streetName != null)
writer.put3(streetName.getOffset());
if (city != null) {
char cityIndex = (char) city.getIndex();
writer.putN(Utils.numberToPointerSize((int) numCities), cityIndex);
}
if (zip != null) {
char zipIndex = (char) zip.getIndex();
writer.putN(Utils.numberToPointerSize((int) numZips), zipIndex);
}
if (complexPhoneNumber != null) {
int labOff = complexPhoneNumber.getOffset();
writer.put((byte) ((labOff & 0x7F0000) >> 16));
writer.putChar((char) (labOff & 0xFFFF));
} else if (simplePhoneNumber.isUsed())
simplePhoneNumber.write(writer);
if (exit != null) {
Label description = exit.getDescription();
int val = 0;
if (description != null) {
val = description.getOffset();
assert val < 0x400000 : "Exit description label offset too large";
}
if (exit.getOvernightParking())
val |= 0x400000;
List<ExitFacility> facilites = exit.getFacilities();
ExitFacility ef = null;
if (!facilites.isEmpty())
ef = facilites.get(0);
if (ef != null)
// exit facilities defined
val |= 0x800000;
writer.put3(val);
char highwayIndex = (char) exit.getHighway().getIndex();
writer.putN(Utils.numberToPointerSize((int) numHighways), highwayIndex);
if (ef != null) {
char exitFacilityIndex = (char) ef.getIndex();
writer.putN(Utils.numberToPointerSize((int) numExitFacilities), exitFacilityIndex);
}
}
}
use of uk.me.parabola.imgfmt.app.Label in project mkgmap by openstreetmap.
the class PlacesFile method createPOI.
POIRecord createPOI(String name) {
assert !poisClosed;
// TODO...
POIRecord p = new POIRecord();
Label l = lblFile.newLabel(name);
p.setLabel(l);
pois.add(p);
return p;
}
use of uk.me.parabola.imgfmt.app.Label in project mkgmap by openstreetmap.
the class PlacesFile method createCountry.
Country createCountry(String name, String abbr) {
String s = abbr != null ? name + (char) 0x1d + abbr : name;
Country c = countries.get(s);
if (c == null) {
c = new Country(countries.size() + 1);
Label l = lblFile.newLabel(s);
c.setLabel(l);
countries.put(s, c);
}
return c;
}
use of uk.me.parabola.imgfmt.app.Label in project mkgmap by openstreetmap.
the class PlacesFile method createCity.
City createCity(Country country, String name, boolean unique) {
String uniqueCityName = name.toUpperCase() + "_C" + country.getLabel().getOffset();
// if unique is true, make sure that the name really is unique
if (unique && cities.get(uniqueCityName) != null) {
do {
// add random suffix
uniqueCityName += "_" + new Random().nextInt(0x10000);
} while (cities.get(uniqueCityName) != null);
}
City c = null;
if (!unique)
c = cities.get(uniqueCityName);
if (c == null) {
c = new City(country);
Label l = lblFile.newLabel(name);
c.setLabel(l);
cityList.add(c);
cities.put(uniqueCityName, c);
assert cityList.size() == cities.size() : " cityList and cities are different lengths after inserting " + name + " and " + uniqueCityName;
}
return c;
}
use of uk.me.parabola.imgfmt.app.Label in project mkgmap by openstreetmap.
the class PlacesFile method createHighway.
Highway createHighway(Region region, String name) {
Highway h = new Highway(region, highways.size() + 1);
Label l = lblFile.newLabel(name);
h.setLabel(l);
highways.add(h);
return h;
}
Aggregations