Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
d51e2da9e6
8 changed files with 226 additions and 199 deletions
|
@ -1,11 +1,12 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
|
|
|
@ -45,7 +45,7 @@ public class BinaryMapAddressReaderAdapter {
|
|||
|
||||
private static final Log LOG = PlatformUtil.getLog(BinaryMapAddressReaderAdapter.class);
|
||||
public final static List<Integer> TYPES = Arrays.asList(CITY_TOWN_TYPE, POSTCODES_TYPE, VILLAGES_TYPE, STREET_TYPE);
|
||||
public final static int[] CITY_TYPES = { CITY_TOWN_TYPE, POSTCODES_TYPE, VILLAGES_TYPE };
|
||||
public final static int[] CITY_TYPES = {CITY_TOWN_TYPE, POSTCODES_TYPE, VILLAGES_TYPE};
|
||||
|
||||
public static class AddressRegion extends BinaryIndexPart {
|
||||
String enName;
|
||||
|
@ -95,7 +95,7 @@ public class BinaryMapAddressReaderAdapter {
|
|||
private CodedInputStream codedIS;
|
||||
private final BinaryMapIndexReader map;
|
||||
|
||||
protected BinaryMapAddressReaderAdapter(BinaryMapIndexReader map){
|
||||
protected BinaryMapAddressReaderAdapter(BinaryMapIndexReader map) {
|
||||
this.codedIS = map.codedIS;
|
||||
this.map = map;
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ public class BinaryMapAddressReaderAdapter {
|
|||
|
||||
|
||||
protected void readAddressIndex(AddressRegion region) throws IOException {
|
||||
while(true){
|
||||
while (true) {
|
||||
int t = codedIS.readTag();
|
||||
int tag = WireFormat.getTagFieldNumber(t);
|
||||
switch (tag) {
|
||||
|
@ -119,30 +119,30 @@ public class BinaryMapAddressReaderAdapter {
|
|||
region.enName = region.name == null ? "" : Junidecode.unidecode(region.name);
|
||||
}
|
||||
return;
|
||||
case OsmandOdb.OsmAndAddressIndex.NAME_FIELD_NUMBER :
|
||||
case OsmandOdb.OsmAndAddressIndex.NAME_FIELD_NUMBER:
|
||||
region.name = codedIS.readString();
|
||||
break;
|
||||
case OsmandOdb.OsmAndAddressIndex.NAME_EN_FIELD_NUMBER :
|
||||
case OsmandOdb.OsmAndAddressIndex.NAME_EN_FIELD_NUMBER:
|
||||
region.enName = codedIS.readString();
|
||||
break;
|
||||
case OsmandOdb.OsmAndAddressIndex.ATTRIBUTETAGSTABLE_FIELD_NUMBER :
|
||||
case OsmandOdb.OsmAndAddressIndex.ATTRIBUTETAGSTABLE_FIELD_NUMBER:
|
||||
int length2 = codedIS.readRawVarint32();
|
||||
int oldLimit = codedIS.pushLimit(length2);
|
||||
region.attributeTagsTable = map.readStringTable();
|
||||
codedIS.popLimit(oldLimit);
|
||||
break;
|
||||
case OsmandOdb.OsmAndAddressIndex.CITIES_FIELD_NUMBER :
|
||||
case OsmandOdb.OsmAndAddressIndex.CITIES_FIELD_NUMBER:
|
||||
CitiesBlock block = new CitiesBlock();
|
||||
region.cities.add(block);
|
||||
block.type = 1;
|
||||
block.length = readInt();
|
||||
block.length = readInt();
|
||||
block.filePointer = codedIS.getTotalBytesRead();
|
||||
while(true){
|
||||
while (true) {
|
||||
int tt = codedIS.readTag();
|
||||
int ttag = WireFormat.getTagFieldNumber(tt);
|
||||
if(ttag == 0) {
|
||||
if (ttag == 0) {
|
||||
break;
|
||||
} else if(ttag == CitiesIndex.TYPE_FIELD_NUMBER){
|
||||
} else if (ttag == CitiesIndex.TYPE_FIELD_NUMBER) {
|
||||
block.type = codedIS.readUInt32();
|
||||
break;
|
||||
} else {
|
||||
|
@ -150,11 +150,10 @@ public class BinaryMapAddressReaderAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
codedIS.seek(block.filePointer + block.length);
|
||||
|
||||
break;
|
||||
case OsmandOdb.OsmAndAddressIndex.NAMEINDEX_FIELD_NUMBER :
|
||||
case OsmandOdb.OsmAndAddressIndex.NAMEINDEX_FIELD_NUMBER:
|
||||
region.indexNameOffset = codedIS.getTotalBytesRead();
|
||||
int length = readInt();
|
||||
codedIS.seek(region.indexNameOffset + length + 4);
|
||||
|
@ -169,13 +168,13 @@ public class BinaryMapAddressReaderAdapter {
|
|||
|
||||
protected void readCities(List<City> cities, SearchRequest<City> resultMatcher, StringMatcher matcher,
|
||||
List<String> additionalTagsTable) throws IOException {
|
||||
while(true){
|
||||
while (true) {
|
||||
int t = codedIS.readTag();
|
||||
int tag = WireFormat.getTagFieldNumber(t);
|
||||
switch (tag) {
|
||||
case 0:
|
||||
return;
|
||||
case CitiesIndex.CITIES_FIELD_NUMBER :
|
||||
case CitiesIndex.CITIES_FIELD_NUMBER:
|
||||
int fp = codedIS.getTotalBytesRead();
|
||||
int length = codedIS.readRawVarint32();
|
||||
int oldLimit = codedIS.pushLimit(length);
|
||||
|
@ -198,31 +197,31 @@ public class BinaryMapAddressReaderAdapter {
|
|||
}
|
||||
|
||||
|
||||
protected void readCityStreets(SearchRequest<Street> resultMatcher, City city, List<String> attributeTagsTable) throws IOException{
|
||||
protected void readCityStreets(SearchRequest<Street> resultMatcher, City city, List<String> attributeTagsTable) throws IOException {
|
||||
int x = MapUtils.get31TileNumberX(city.getLocation().getLongitude());
|
||||
int y = MapUtils.get31TileNumberY(city.getLocation().getLatitude());
|
||||
while(true){
|
||||
while (true) {
|
||||
int t = codedIS.readTag();
|
||||
int tag = WireFormat.getTagFieldNumber(t);
|
||||
switch (tag) {
|
||||
case 0:
|
||||
return;
|
||||
case OsmandOdb.CityBlockIndex.STREETS_FIELD_NUMBER :
|
||||
case OsmandOdb.CityBlockIndex.STREETS_FIELD_NUMBER:
|
||||
Street s = new Street(city);
|
||||
s.setFileOffset(codedIS.getTotalBytesRead());
|
||||
int length = codedIS.readRawVarint32();
|
||||
int oldLimit = codedIS.pushLimit(length);
|
||||
readStreet(s, null, false, x >> 7, y >> 7, city.isPostcode() ? city.getName() : null,
|
||||
attributeTagsTable);
|
||||
if(resultMatcher == null || resultMatcher.publish(s)){
|
||||
if (resultMatcher == null || resultMatcher.publish(s)) {
|
||||
city.registerStreet(s);
|
||||
}
|
||||
if(resultMatcher != null && resultMatcher.isCancelled()) {
|
||||
if (resultMatcher != null && resultMatcher.isCancelled()) {
|
||||
codedIS.skipRawBytes(codedIS.getBytesUntilLimit());
|
||||
}
|
||||
codedIS.popLimit(oldLimit);
|
||||
break;
|
||||
case OsmandOdb.CityBlockIndex.BUILDINGS_FIELD_NUMBER :
|
||||
case OsmandOdb.CityBlockIndex.BUILDINGS_FIELD_NUMBER:
|
||||
// buildings for the town are not used now
|
||||
skipUnknownField(t);
|
||||
default:
|
||||
|
@ -261,7 +260,7 @@ public class BinaryMapAddressReaderAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
protected City readCityHeader(CityMatcher matcher, int filePointer, List<String> additionalTagsTable) throws IOException{
|
||||
protected City readCityHeader(CityMatcher matcher, int filePointer, List<String> additionalTagsTable) throws IOException {
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
City c = null;
|
||||
|
@ -272,19 +271,19 @@ public class BinaryMapAddressReaderAdapter {
|
|||
switch (tag) {
|
||||
case 0:
|
||||
return (matcher == null || matcher.matches(c)) ? c : null;
|
||||
case OsmandOdb.CityIndex.CITY_TYPE_FIELD_NUMBER :
|
||||
case OsmandOdb.CityIndex.CITY_TYPE_FIELD_NUMBER:
|
||||
int type = codedIS.readUInt32();
|
||||
c = new City(CityType.values()[type]);
|
||||
break;
|
||||
case OsmandOdb.CityIndex.ID_FIELD_NUMBER :
|
||||
case OsmandOdb.CityIndex.ID_FIELD_NUMBER:
|
||||
c.setId(codedIS.readUInt64());
|
||||
break;
|
||||
case OsmandOdb.CityIndex.ATTRIBUTETAGIDS_FIELD_NUMBER :
|
||||
case OsmandOdb.CityIndex.ATTRIBUTETAGIDS_FIELD_NUMBER:
|
||||
int tgid = codedIS.readUInt32();
|
||||
if(additionalTags == null) {
|
||||
if (additionalTags == null) {
|
||||
additionalTags = new LinkedList<String>();
|
||||
}
|
||||
if(additionalTagsTable != null && tgid < additionalTagsTable.size()) {
|
||||
if (additionalTagsTable != null && tgid < additionalTagsTable.size()) {
|
||||
additionalTags.add(additionalTagsTable.get(tgid));
|
||||
}
|
||||
break;
|
||||
|
@ -297,25 +296,25 @@ public class BinaryMapAddressReaderAdapter {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case OsmandOdb.CityIndex.NAME_EN_FIELD_NUMBER :
|
||||
case OsmandOdb.CityIndex.NAME_EN_FIELD_NUMBER:
|
||||
String enName = codedIS.readString();
|
||||
c.setEnName(enName);
|
||||
break;
|
||||
case OsmandOdb.CityIndex.NAME_FIELD_NUMBER :
|
||||
case OsmandOdb.CityIndex.NAME_FIELD_NUMBER:
|
||||
String name = codedIS.readString();
|
||||
if(c == null) {
|
||||
if (c == null) {
|
||||
c = City.createPostcode(name);
|
||||
}
|
||||
c.setName(name);
|
||||
break;
|
||||
case OsmandOdb.CityIndex.X_FIELD_NUMBER :
|
||||
case OsmandOdb.CityIndex.X_FIELD_NUMBER:
|
||||
x = codedIS.readUInt32();
|
||||
break;
|
||||
case OsmandOdb.CityIndex.Y_FIELD_NUMBER :
|
||||
case OsmandOdb.CityIndex.Y_FIELD_NUMBER:
|
||||
y = codedIS.readUInt32();
|
||||
c.setLocation(MapUtils.get31LatitudeY(y), MapUtils.get31LongitudeX(x));
|
||||
break;
|
||||
case OsmandOdb.CityIndex.SHIFTTOCITYBLOCKINDEX_FIELD_NUMBER :
|
||||
case OsmandOdb.CityIndex.SHIFTTOCITYBLOCKINDEX_FIELD_NUMBER:
|
||||
int offset = readInt();
|
||||
offset += filePointer;
|
||||
c.setFileOffset(offset);
|
||||
|
@ -329,66 +328,66 @@ public class BinaryMapAddressReaderAdapter {
|
|||
|
||||
protected Street readStreet(Street s, SearchRequest<Building> buildingsMatcher,
|
||||
boolean loadBuildingsAndIntersected, int city24X, int city24Y, String postcodeFilter,
|
||||
List<String> additionalTagsTable) throws IOException{
|
||||
List<String> additionalTagsTable) throws IOException {
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
LinkedList<String> additionalTags = null;
|
||||
boolean loadLocation = city24X != 0 || city24Y != 0;
|
||||
while(true){
|
||||
while (true) {
|
||||
int t = codedIS.readTag();
|
||||
int tag = WireFormat.getTagFieldNumber(t);
|
||||
switch (tag) {
|
||||
case 0:
|
||||
if(loadLocation){
|
||||
if (loadLocation) {
|
||||
s.setLocation(MapUtils.getLatitudeFromTile(24, y), MapUtils.getLongitudeFromTile(24, x));
|
||||
}
|
||||
return s;
|
||||
case OsmandOdb.StreetIndex.ID_FIELD_NUMBER :
|
||||
case OsmandOdb.StreetIndex.ID_FIELD_NUMBER:
|
||||
s.setId(codedIS.readUInt64());
|
||||
break;
|
||||
case OsmandOdb.StreetIndex.ATTRIBUTETAGIDS_FIELD_NUMBER :
|
||||
case OsmandOdb.StreetIndex.ATTRIBUTETAGIDS_FIELD_NUMBER:
|
||||
int tgid = codedIS.readUInt32();
|
||||
if(additionalTags == null) {
|
||||
if (additionalTags == null) {
|
||||
additionalTags = new LinkedList<String>();
|
||||
}
|
||||
if(additionalTagsTable != null && tgid < additionalTagsTable.size()) {
|
||||
if (additionalTagsTable != null && tgid < additionalTagsTable.size()) {
|
||||
additionalTags.add(additionalTagsTable.get(tgid));
|
||||
}
|
||||
break;
|
||||
case OsmandOdb.StreetIndex.ATTRIBUTEVALUES_FIELD_NUMBER :
|
||||
case OsmandOdb.StreetIndex.ATTRIBUTEVALUES_FIELD_NUMBER:
|
||||
String nm = codedIS.readString();
|
||||
if(additionalTags != null && additionalTags.size() > 0) {
|
||||
if (additionalTags != null && additionalTags.size() > 0) {
|
||||
String tg = additionalTags.pollFirst();
|
||||
if(tg.startsWith("name:")) {
|
||||
if (tg.startsWith("name:")) {
|
||||
s.setName(tg.substring("name:".length()), nm);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OsmandOdb.StreetIndex.NAME_EN_FIELD_NUMBER :
|
||||
case OsmandOdb.StreetIndex.NAME_EN_FIELD_NUMBER:
|
||||
s.setEnName(codedIS.readString());
|
||||
break;
|
||||
case OsmandOdb.StreetIndex.NAME_FIELD_NUMBER :
|
||||
case OsmandOdb.StreetIndex.NAME_FIELD_NUMBER:
|
||||
s.setName(codedIS.readString());
|
||||
break;
|
||||
case OsmandOdb.StreetIndex.X_FIELD_NUMBER :
|
||||
case OsmandOdb.StreetIndex.X_FIELD_NUMBER:
|
||||
int sx = codedIS.readSInt32();
|
||||
if(loadLocation){
|
||||
x = sx + city24X;
|
||||
if (loadLocation) {
|
||||
x = sx + city24X;
|
||||
} else {
|
||||
x = (int) MapUtils.getTileNumberX(24, s.getLocation().getLongitude());
|
||||
}
|
||||
break;
|
||||
case OsmandOdb.StreetIndex.Y_FIELD_NUMBER :
|
||||
case OsmandOdb.StreetIndex.Y_FIELD_NUMBER:
|
||||
int sy = codedIS.readSInt32();
|
||||
if(loadLocation){
|
||||
y = sy + city24Y;
|
||||
if (loadLocation) {
|
||||
y = sy + city24Y;
|
||||
} else {
|
||||
y = (int) MapUtils.getTileNumberY(24, s.getLocation().getLatitude());
|
||||
}
|
||||
break;
|
||||
case OsmandOdb.StreetIndex.INTERSECTIONS_FIELD_NUMBER :
|
||||
case OsmandOdb.StreetIndex.INTERSECTIONS_FIELD_NUMBER:
|
||||
int length = codedIS.readRawVarint32();
|
||||
if(loadBuildingsAndIntersected){
|
||||
if (loadBuildingsAndIntersected) {
|
||||
int oldLimit = codedIS.pushLimit(length);
|
||||
Street si = readIntersectedStreet(s.getCity(), x, y, additionalTagsTable);
|
||||
s.addIntersectedStreet(si);
|
||||
|
@ -397,10 +396,10 @@ public class BinaryMapAddressReaderAdapter {
|
|||
codedIS.skipRawBytes(length);
|
||||
}
|
||||
break;
|
||||
case OsmandOdb.StreetIndex.BUILDINGS_FIELD_NUMBER :
|
||||
case OsmandOdb.StreetIndex.BUILDINGS_FIELD_NUMBER:
|
||||
int offset = codedIS.getTotalBytesRead();
|
||||
length = codedIS.readRawVarint32();
|
||||
if(loadBuildingsAndIntersected){
|
||||
if (loadBuildingsAndIntersected) {
|
||||
int oldLimit = codedIS.pushLimit(length);
|
||||
Building b = readBuilding(offset, x, y, additionalTagsTable);
|
||||
if (postcodeFilter == null || postcodeFilter.equalsIgnoreCase(b.getPostcode())) {
|
||||
|
@ -420,19 +419,19 @@ public class BinaryMapAddressReaderAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
protected Street readIntersectedStreet(City c, int street24X, int street24Y, List<String> additionalTagsTable) throws IOException{
|
||||
protected Street readIntersectedStreet(City c, int street24X, int street24Y, List<String> additionalTagsTable) throws IOException {
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
Street s = new Street(c);
|
||||
LinkedList<String> additionalTags = null;
|
||||
while(true){
|
||||
while (true) {
|
||||
int t = codedIS.readTag();
|
||||
int tag = WireFormat.getTagFieldNumber(t);
|
||||
switch (tag) {
|
||||
case 0:
|
||||
s.setLocation(MapUtils.getLatitudeFromTile(24, y), MapUtils.getLongitudeFromTile(24, x));
|
||||
return s;
|
||||
case OsmandOdb.BuildingIndex.ID_FIELD_NUMBER :
|
||||
case OsmandOdb.BuildingIndex.ID_FIELD_NUMBER:
|
||||
s.setId(codedIS.readUInt64());
|
||||
break;
|
||||
case OsmandOdb.StreetIntersection.NAME_EN_FIELD_NUMBER:
|
||||
|
@ -441,29 +440,29 @@ public class BinaryMapAddressReaderAdapter {
|
|||
case OsmandOdb.StreetIntersection.NAME_FIELD_NUMBER:
|
||||
s.setName(codedIS.readString());
|
||||
break;
|
||||
case OsmandOdb.StreetIntersection.ATTRIBUTETAGIDS_FIELD_NUMBER :
|
||||
case OsmandOdb.StreetIntersection.ATTRIBUTETAGIDS_FIELD_NUMBER:
|
||||
int tgid = codedIS.readUInt32();
|
||||
if(additionalTags == null) {
|
||||
if (additionalTags == null) {
|
||||
additionalTags = new LinkedList<String>();
|
||||
}
|
||||
if(additionalTagsTable != null && tgid < additionalTagsTable.size()) {
|
||||
if (additionalTagsTable != null && tgid < additionalTagsTable.size()) {
|
||||
additionalTags.add(additionalTagsTable.get(tgid));
|
||||
}
|
||||
break;
|
||||
case OsmandOdb.StreetIntersection.ATTRIBUTEVALUES_FIELD_NUMBER :
|
||||
case OsmandOdb.StreetIntersection.ATTRIBUTEVALUES_FIELD_NUMBER:
|
||||
String nm = codedIS.readString();
|
||||
if(additionalTags != null && additionalTags.size() > 0) {
|
||||
if (additionalTags != null && additionalTags.size() > 0) {
|
||||
String tg = additionalTags.pollFirst();
|
||||
if(tg.startsWith("name:")) {
|
||||
if (tg.startsWith("name:")) {
|
||||
s.setName(tg.substring("name:".length()), nm);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OsmandOdb.StreetIntersection.INTERSECTEDX_FIELD_NUMBER :
|
||||
x = codedIS.readSInt32() + street24X;
|
||||
case OsmandOdb.StreetIntersection.INTERSECTEDX_FIELD_NUMBER:
|
||||
x = codedIS.readSInt32() + street24X;
|
||||
break;
|
||||
case OsmandOdb.StreetIntersection.INTERSECTEDY_FIELD_NUMBER :
|
||||
y = codedIS.readSInt32() + street24Y;
|
||||
case OsmandOdb.StreetIntersection.INTERSECTEDY_FIELD_NUMBER:
|
||||
y = codedIS.readSInt32() + street24Y;
|
||||
break;
|
||||
default:
|
||||
skipUnknownField(t);
|
||||
|
@ -472,7 +471,7 @@ public class BinaryMapAddressReaderAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
protected Building readBuilding(int fileOffset, int street24X, int street24Y, List<String> additionalTagsTable) throws IOException{
|
||||
protected Building readBuilding(int fileOffset, int street24X, int street24Y, List<String> additionalTagsTable) throws IOException {
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int x2 = 0;
|
||||
|
@ -480,72 +479,71 @@ public class BinaryMapAddressReaderAdapter {
|
|||
LinkedList<String> additionalTags = null;
|
||||
Building b = new Building();
|
||||
b.setFileOffset(fileOffset);
|
||||
while(true){
|
||||
while (true) {
|
||||
int t = codedIS.readTag();
|
||||
int tag = WireFormat.getTagFieldNumber(t);
|
||||
switch (tag) {
|
||||
case 0:
|
||||
b.setLocation(MapUtils.getLatitudeFromTile(24, y), MapUtils.getLongitudeFromTile(24, x));
|
||||
if(x2 != 0 && y2 != 0) {
|
||||
if (x2 != 0 && y2 != 0) {
|
||||
b.setLatLon2(new LatLon(MapUtils.getLatitudeFromTile(24, y2), MapUtils.getLongitudeFromTile(24, x2)));
|
||||
}
|
||||
return b;
|
||||
case OsmandOdb.BuildingIndex.ID_FIELD_NUMBER :
|
||||
case OsmandOdb.BuildingIndex.ID_FIELD_NUMBER:
|
||||
b.setId(codedIS.readUInt64());
|
||||
break;
|
||||
|
||||
case OsmandOdb.BuildingIndex.NAME_EN_FIELD_NUMBER :
|
||||
case OsmandOdb.BuildingIndex.NAME_EN_FIELD_NUMBER:
|
||||
b.setEnName(codedIS.readString());
|
||||
break;
|
||||
case OsmandOdb.BuildingIndex.NAME_FIELD_NUMBER :
|
||||
case OsmandOdb.BuildingIndex.NAME_FIELD_NUMBER:
|
||||
b.setName(codedIS.readString());
|
||||
break;
|
||||
case OsmandOdb.BuildingIndex.ATTRIBUTETAGIDS_FIELD_NUMBER :
|
||||
case OsmandOdb.BuildingIndex.ATTRIBUTETAGIDS_FIELD_NUMBER:
|
||||
int tgid = codedIS.readUInt32();
|
||||
if(additionalTags == null) {
|
||||
if (additionalTags == null) {
|
||||
additionalTags = new LinkedList<String>();
|
||||
}
|
||||
if(additionalTagsTable != null && tgid < additionalTagsTable.size()) {
|
||||
if (additionalTagsTable != null && tgid < additionalTagsTable.size()) {
|
||||
additionalTags.add(additionalTagsTable.get(tgid));
|
||||
}
|
||||
break;
|
||||
case OsmandOdb.BuildingIndex.ATTRIBUTEVALUES_FIELD_NUMBER :
|
||||
case OsmandOdb.BuildingIndex.ATTRIBUTEVALUES_FIELD_NUMBER:
|
||||
String nm = codedIS.readString();
|
||||
if(additionalTags != null && additionalTags.size() > 0) {
|
||||
if (additionalTags != null && additionalTags.size() > 0) {
|
||||
String tg = additionalTags.pollFirst();
|
||||
if(tg.startsWith("name:")) {
|
||||
if (tg.startsWith("name:")) {
|
||||
b.setName(tg.substring("name:".length()), nm);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OsmandOdb.BuildingIndex.NAME_EN2_FIELD_NUMBER :
|
||||
case OsmandOdb.BuildingIndex.NAME_EN2_FIELD_NUMBER:
|
||||
// no where to set now
|
||||
codedIS.readString();
|
||||
break;
|
||||
case OsmandOdb.BuildingIndex.NAME2_FIELD_NUMBER :
|
||||
case OsmandOdb.BuildingIndex.NAME2_FIELD_NUMBER:
|
||||
b.setName2(codedIS.readString());
|
||||
break;
|
||||
case OsmandOdb.BuildingIndex.INTERPOLATION_FIELD_NUMBER :
|
||||
case OsmandOdb.BuildingIndex.INTERPOLATION_FIELD_NUMBER:
|
||||
int sint = codedIS.readSInt32();
|
||||
if(sint > 0) {
|
||||
if (sint > 0) {
|
||||
b.setInterpolationInterval(sint);
|
||||
} else {
|
||||
b.setInterpolationType(BuildingInterpolation.fromValue(sint));
|
||||
}
|
||||
break;
|
||||
case OsmandOdb.BuildingIndex.X_FIELD_NUMBER :
|
||||
x = codedIS.readSInt32() + street24X;
|
||||
case OsmandOdb.BuildingIndex.X_FIELD_NUMBER:
|
||||
x = codedIS.readSInt32() + street24X;
|
||||
break;
|
||||
case OsmandOdb.BuildingIndex.X2_FIELD_NUMBER :
|
||||
x2 = codedIS.readSInt32() + street24X;
|
||||
case OsmandOdb.BuildingIndex.X2_FIELD_NUMBER:
|
||||
x2 = codedIS.readSInt32() + street24X;
|
||||
break;
|
||||
case OsmandOdb.BuildingIndex.Y_FIELD_NUMBER :
|
||||
y = codedIS.readSInt32() + street24Y;
|
||||
case OsmandOdb.BuildingIndex.Y_FIELD_NUMBER:
|
||||
y = codedIS.readSInt32() + street24Y;
|
||||
break;
|
||||
case OsmandOdb.BuildingIndex.Y2_FIELD_NUMBER :
|
||||
y2 = codedIS.readSInt32() + street24Y;
|
||||
case OsmandOdb.BuildingIndex.Y2_FIELD_NUMBER:
|
||||
y2 = codedIS.readSInt32() + street24Y;
|
||||
break;
|
||||
case OsmandOdb.BuildingIndex.POSTCODE_FIELD_NUMBER :
|
||||
case OsmandOdb.BuildingIndex.POSTCODE_FIELD_NUMBER:
|
||||
b.setPostcode(codedIS.readString());
|
||||
break;
|
||||
default:
|
||||
|
@ -610,7 +608,7 @@ public class BinaryMapAddressReaderAdapter {
|
|||
int soldLim = codedIS.pushLimit(slen);
|
||||
readAddressNameData(req, refs, fp);
|
||||
codedIS.popLimit(soldLim);
|
||||
} else if (stag != 0){
|
||||
} else if (stag != 0) {
|
||||
skipUnknownField(st);
|
||||
}
|
||||
} while (stag != 0);
|
||||
|
@ -644,7 +642,7 @@ public class BinaryMapAddressReaderAdapter {
|
|||
s.setFileOffset(list.get(j));
|
||||
readStreet(s, null, false, MapUtils.get31TileNumberX(l.getLongitude()) >> 7,
|
||||
MapUtils.get31TileNumberY(l.getLatitude()) >> 7, obj.isPostcode() ? obj.getName() : null,
|
||||
reg.attributeTagsTable);
|
||||
reg.attributeTagsTable);
|
||||
boolean matches = stringMatcher.matches(s.getName());
|
||||
if (!matches) {
|
||||
for (String n : s.getAllNames()) {
|
||||
|
@ -691,7 +689,7 @@ public class BinaryMapAddressReaderAdapter {
|
|||
private void readAddressNameData(SearchRequest<MapObject> req, TIntArrayList[] refs, int fp) throws IOException {
|
||||
TIntArrayList toAdd = null;
|
||||
while (true) {
|
||||
if (req.isCancelled()){
|
||||
if (req.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
int t = codedIS.readTag();
|
||||
|
@ -699,23 +697,23 @@ public class BinaryMapAddressReaderAdapter {
|
|||
switch (tag) {
|
||||
case 0:
|
||||
return;
|
||||
case AddressNameIndexDataAtom.NAMEEN_FIELD_NUMBER :
|
||||
case AddressNameIndexDataAtom.NAMEEN_FIELD_NUMBER:
|
||||
codedIS.readString();
|
||||
break;
|
||||
case AddressNameIndexDataAtom.NAME_FIELD_NUMBER :
|
||||
case AddressNameIndexDataAtom.NAME_FIELD_NUMBER:
|
||||
codedIS.readString();
|
||||
break;
|
||||
case AddressNameIndexDataAtom.SHIFTTOCITYINDEX_FIELD_NUMBER :
|
||||
case AddressNameIndexDataAtom.SHIFTTOCITYINDEX_FIELD_NUMBER:
|
||||
if (toAdd != null) {
|
||||
toAdd.add(fp - codedIS.readInt32());
|
||||
}
|
||||
break;
|
||||
case AddressNameIndexDataAtom.SHIFTTOINDEX_FIELD_NUMBER :
|
||||
case AddressNameIndexDataAtom.SHIFTTOINDEX_FIELD_NUMBER:
|
||||
if (toAdd != null) {
|
||||
toAdd.add(fp - codedIS.readInt32());
|
||||
}
|
||||
break;
|
||||
case AddressNameIndexDataAtom.TYPE_FIELD_NUMBER :
|
||||
case AddressNameIndexDataAtom.TYPE_FIELD_NUMBER:
|
||||
int type = codedIS.readInt32();
|
||||
toAdd = refs[type];
|
||||
break;
|
||||
|
@ -726,5 +724,4 @@ public class BinaryMapAddressReaderAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -39,83 +39,83 @@ public class Way extends Entity {
|
|||
}
|
||||
}
|
||||
|
||||
public void addNode(long id){
|
||||
if(nodeIds == null){
|
||||
public void addNode(long id) {
|
||||
if (nodeIds == null) {
|
||||
nodeIds = new TLongArrayList();
|
||||
}
|
||||
nodeIds.add(id);
|
||||
}
|
||||
|
||||
public long getFirstNodeId(){
|
||||
if(nodeIds == null){
|
||||
public long getFirstNodeId() {
|
||||
if (nodeIds == null) {
|
||||
return -1;
|
||||
}
|
||||
return nodeIds.get(0);
|
||||
}
|
||||
|
||||
public long getLastNodeId(){
|
||||
if(nodeIds == null){
|
||||
public long getLastNodeId() {
|
||||
if (nodeIds == null) {
|
||||
return -1;
|
||||
}
|
||||
return nodeIds.get(nodeIds.size() - 1);
|
||||
}
|
||||
|
||||
public Node getFirstNode(){
|
||||
if(nodes == null || nodes.size() == 0){
|
||||
public Node getFirstNode() {
|
||||
if (nodes == null || nodes.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
return nodes.get(0);
|
||||
}
|
||||
|
||||
public Node getLastNode(){
|
||||
if(nodes == null || nodes.size() == 0){
|
||||
public Node getLastNode() {
|
||||
if (nodes == null || nodes.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
return nodes.get(nodes.size() - 1);
|
||||
}
|
||||
|
||||
public void addNode(Node n){
|
||||
if(nodeIds == null){
|
||||
public void addNode(Node n) {
|
||||
if (nodeIds == null) {
|
||||
nodeIds = new TLongArrayList();
|
||||
}
|
||||
if(nodes == null){
|
||||
if (nodes == null) {
|
||||
nodes = new ArrayList<Node>();
|
||||
}
|
||||
nodeIds.add(n.getId());
|
||||
nodes.add(n);
|
||||
}
|
||||
|
||||
public void addNode(Node n, int index){
|
||||
if(nodeIds == null){
|
||||
public void addNode(Node n, int index) {
|
||||
if (nodeIds == null) {
|
||||
nodeIds = new TLongArrayList();
|
||||
}
|
||||
if(nodes == null){
|
||||
if (nodes == null) {
|
||||
nodes = new ArrayList<Node>();
|
||||
}
|
||||
nodeIds.insert(index, n.getId());
|
||||
nodes.add(index, n);
|
||||
}
|
||||
|
||||
public long removeNodeByIndex(int i){
|
||||
if(nodeIds == null){
|
||||
public long removeNodeByIndex(int i) {
|
||||
if (nodeIds == null) {
|
||||
return -1;
|
||||
}
|
||||
long toReturn = nodeIds.removeAt(i);
|
||||
if(nodes != null && nodes.size() > i){
|
||||
if (nodes != null && nodes.size() > i) {
|
||||
nodes.remove(i);
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public TLongArrayList getNodeIds(){
|
||||
if(nodeIds == null){
|
||||
public TLongArrayList getNodeIds() {
|
||||
if (nodeIds == null) {
|
||||
return new TLongArrayList(0);
|
||||
}
|
||||
return nodeIds;
|
||||
}
|
||||
|
||||
public List<EntityId> getEntityIds(){
|
||||
if(nodeIds == null){
|
||||
public List<EntityId> getEntityIds() {
|
||||
if (nodeIds == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<EntityId> ls = new ArrayList<EntityId>();
|
||||
|
@ -126,7 +126,7 @@ public class Way extends Entity {
|
|||
}
|
||||
|
||||
public List<Node> getNodes() {
|
||||
if(nodes == null){
|
||||
if (nodes == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return nodes;
|
||||
|
@ -135,37 +135,37 @@ public class Way extends Entity {
|
|||
@Override
|
||||
public void initializeLinks(Map<EntityId, Entity> entities) {
|
||||
if (nodeIds != null) {
|
||||
if(nodes == null){
|
||||
nodes = new ArrayList<Node>();
|
||||
if (nodes == null) {
|
||||
nodes = new ArrayList<Node>();
|
||||
} else {
|
||||
nodes.clear();
|
||||
}
|
||||
int nIsize = nodeIds.size();
|
||||
for (int i = 0; i < nIsize; i++) {
|
||||
nodes.add((Node) entities.get(new EntityId(EntityType.NODE,nodeIds.get(i))));
|
||||
nodes.add((Node) entities.get(new EntityId(EntityType.NODE, nodeIds.get(i))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public QuadRect getLatLonBBox() {
|
||||
QuadRect qr = null;
|
||||
if(nodes != null) {
|
||||
for(Node n : nodes){
|
||||
if(qr == null) {
|
||||
if (nodes != null) {
|
||||
for (Node n : nodes) {
|
||||
if (qr == null) {
|
||||
qr = new QuadRect();
|
||||
qr.left = (float) n.getLongitude();
|
||||
qr.right = (float) n.getLongitude();
|
||||
qr.top = (float) n.getLatitude();
|
||||
qr.top = (float) n.getLatitude();
|
||||
qr.bottom = (float) n.getLatitude();
|
||||
}
|
||||
if(n.getLongitude() < qr.left) {
|
||||
if (n.getLongitude() < qr.left) {
|
||||
qr.left = (float) n.getLongitude();
|
||||
} else if(n.getLongitude() > qr.right) {
|
||||
} else if (n.getLongitude() > qr.right) {
|
||||
qr.right = (float) n.getLongitude();
|
||||
}
|
||||
if(n.getLatitude() > qr.top) {
|
||||
if (n.getLatitude() > qr.top) {
|
||||
qr.top = (float) n.getLatitude();
|
||||
} else if(n.getLatitude() < qr.bottom) {
|
||||
} else if (n.getLatitude() < qr.bottom) {
|
||||
qr.bottom = (float) n.getLatitude();
|
||||
}
|
||||
}
|
||||
|
@ -175,19 +175,20 @@ public class Way extends Entity {
|
|||
|
||||
@Override
|
||||
public LatLon getLatLon() {
|
||||
if(nodes == null){
|
||||
if (nodes == null) {
|
||||
return null;
|
||||
}
|
||||
return OsmMapUtils.getWeightCenterForWay(this);
|
||||
}
|
||||
|
||||
|
||||
public void reverseNodes() {
|
||||
if(nodes != null) {
|
||||
Collections.reverse(nodes);
|
||||
}
|
||||
if(nodeIds != null) {
|
||||
nodeIds.reverse();;
|
||||
}
|
||||
}
|
||||
public void reverseNodes() {
|
||||
if (nodes != null) {
|
||||
Collections.reverse(nodes);
|
||||
}
|
||||
if (nodeIds != null) {
|
||||
nodeIds.reverse();
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -970,7 +970,7 @@
|
|||
<string name="poi_mobile">Mobiltelefon</string>
|
||||
<string name="poi_animal_shelter_dog">Internat: hund</string>
|
||||
<string name="poi_animal_shelter_cat">Internat: kat</string>
|
||||
<string name="poi_animal_shelter_dog_cat">"Internat: hund, kat"</string>
|
||||
<string name="poi_animal_shelter_dog_cat">Internat: hund, kat</string>
|
||||
<string name="poi_animal_shelter_bird">Internat: fugl</string>
|
||||
|
||||
<string name="poi_shower">Bruser</string>
|
||||
|
@ -2966,8 +2966,8 @@
|
|||
<string name="poi_crossing_activation_automatic">Overkørsel aktivering: automatisk</string>
|
||||
<string name="poi_crossing_activation_local">Overkørsel aktivering: lokal</string>
|
||||
<string name="poi_crossing_activation_remote">Overkørsel aktivering: fjernbetjening</string>
|
||||
<string name="poi_crossing_barrier_no">Overkørsel med bom: nej</string>
|
||||
<string name="poi_crossing_barrier_yes>">Overkørsel med bom</string>
|
||||
<string name="poi_crossing_barrier_no">Overkørsel bom: nej</string>
|
||||
<string name="poi_crossing_barrier_yes">Overkørsel bom</string>
|
||||
<string name="poi_crossing_on_demand_yes">Overkørsel på forespørgsel</string>
|
||||
<string name="poi_crossing_on_demand_no">Overkørsel på forespørgsel: nej</string>
|
||||
</resources>
|
||||
|
|
|
@ -2920,7 +2920,7 @@
|
|||
<string name="poi_crossing_activation_local">Activación local del cruce</string>
|
||||
<string name="poi_crossing_activation_remote">Activación remota del cruce</string>
|
||||
<string name="poi_crossing_barrier_no">Cruce sin barreras</string>
|
||||
<string name="poi_crossing_barrier_yes>">Cruce con barreras</string>
|
||||
<string name="poi_crossing_barrier_yes">Cruce con barreras</string>
|
||||
<string name="poi_crossing_barrier_full">Cruce con barreras completas</string>
|
||||
<string name="poi_crossing_barrier_half">Cruce con semi-barreras</string>
|
||||
<string name="poi_crossing_barrier_double_half">Cruce con doble semi-barreras</string>
|
||||
|
|
|
@ -2683,7 +2683,7 @@
|
|||
<string name="poi_crossing_activation_local">Activación local del cruce</string>
|
||||
<string name="poi_crossing_activation_remote">Activación remota del cruce</string>
|
||||
<string name="poi_crossing_barrier_no">Cruce sin barreras</string>
|
||||
<string name="poi_crossing_barrier_yes>">Cruce con barreras</string>
|
||||
<string name="poi_crossing_barrier_yes">Cruce con barreras</string>
|
||||
<string name="poi_crossing_barrier_full">Cruce con barreras completas</string>
|
||||
<string name="poi_crossing_barrier_half">Cruce con semi-barreras</string>
|
||||
<string name="poi_crossing_barrier_double_half">Cruce con doble semi-barreras</string>
|
||||
|
|
|
@ -2878,7 +2878,7 @@
|
|||
<string name="poi_crossing_activation_local">Управление переездом: местное</string>
|
||||
<string name="poi_crossing_activation_remote">Управление переездом: дистанционное</string>
|
||||
<string name="poi_crossing_barrier_no">Барьер на перезде: нет</string>
|
||||
<string name="poi_crossing_barrier_yes>">Барьер на переезде</string>
|
||||
<string name="poi_crossing_barrier_yes">Барьер на переезде</string>
|
||||
<string name="poi_crossing_barrier_full">Барьер на переезде: полный</string>
|
||||
<string name="poi_crossing_barrier_half">Барьер на переезде: половинный</string>
|
||||
<string name="poi_crossing_barrier_double_half">Барьер на переезде: двойной половинный</string>
|
||||
|
@ -2895,4 +2895,18 @@
|
|||
<string name="poi_crossing_supervision_attendant">Наблюдение за переездом: смотрящий</string>
|
||||
<string name="poi_crossing_supervision_camera">Наблюдение за переездом: камера</string>
|
||||
|
||||
<string name="poi_dispensing_yes">Продажа лекарств по рецептам</string>
|
||||
<string name="poi_dispensing_no">Продажа лекарств по рецептам: нет</string>
|
||||
|
||||
<string name="poi_aerodrome_type_international">Международный</string>
|
||||
<string name="poi_aerodrome_type_regional">Региональный</string>
|
||||
<string name="poi_aerodrome_type_public">Общественный</string>
|
||||
<string name="poi_aerodrome_type_military">Военный</string>
|
||||
<string name="poi_aerodrome_type_military_public">Военный/общественный</string>
|
||||
<string name="poi_aerodrome_type_private">Частный</string>
|
||||
|
||||
<string name="poi_valley_balka">Балка</string>
|
||||
|
||||
<string name="poi_ventilation_shaft">Вентиляционная шахта</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -2882,7 +2882,7 @@
|
|||
<string name="poi_crossing_activation_local">Crossing activation: local</string>
|
||||
<string name="poi_crossing_activation_remote">Crossing activation: remote</string>
|
||||
<string name="poi_crossing_barrier_no">Crossing barrier: no</string>
|
||||
<string name="poi_crossing_barrier_yes>">Crossing barrier</string>
|
||||
<string name="poi_crossing_barrier_yes">Crossing barrier</string>
|
||||
<string name="poi_crossing_barrier_full">Crossing barrier: full</string>
|
||||
<string name="poi_crossing_barrier_half">Crossing barrier: half</string>
|
||||
<string name="poi_crossing_barrier_double_half">Crossing barrier: double half</string>
|
||||
|
@ -2899,4 +2899,18 @@
|
|||
<string name="poi_crossing_supervision_attendant">Crossing supervision: attendant</string>
|
||||
<string name="poi_crossing_supervision_camera">Crossing supervision: camera</string>
|
||||
|
||||
<string name="poi_dispensing_yes">Dispensing: yes</string>
|
||||
<string name="poi_dispensing_no">Dispensing: no</string>
|
||||
|
||||
<string name="poi_aerodrome_type_international">International</string>
|
||||
<string name="poi_aerodrome_type_regional">Regional</string>
|
||||
<string name="poi_aerodrome_type_public">Public</string>
|
||||
<string name="poi_aerodrome_type_military">Military</string>
|
||||
<string name="poi_aerodrome_type_military_public">Military/public</string>
|
||||
<string name="poi_aerodrome_type_private">Private</string>
|
||||
|
||||
<string name="poi_valley_balka">Balka</string>
|
||||
|
||||
<string name="poi_ventilation_shaft">Ventilation shaft</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue