Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-11-07 22:58:06 +01:00
commit 4863f31cf9
2 changed files with 29 additions and 10 deletions

View file

@ -1,14 +1,5 @@
package net.osmand.osm;
import net.osmand.PlatformUtil;
import net.osmand.StringMatcher;
import net.osmand.data.Amenity;
import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
@ -25,6 +16,15 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import net.osmand.PlatformUtil;
import net.osmand.StringMatcher;
import net.osmand.data.Amenity;
import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
public class MapPoiTypes {
private static MapPoiTypes DEFAULT_INSTANCE = null;
@ -389,6 +389,7 @@ public class MapPoiTypes {
tp.setOsmValue2(parser.getAttributeValue("", "value2"));
tp.setText("text".equals(parser.getAttributeValue("", "type")));
tp.setNameOnly("true".equals(parser.getAttributeValue("", "name_only")));
tp.setNameTag(parser.getAttributeValue("", "name_tag"));
tp.setRelation("true".equals(parser.getAttributeValue("", "relation")));
if (lastFilter != null) {
lastFilter.addPoiType(tp);
@ -544,7 +545,8 @@ public class MapPoiTypes {
public Amenity parseAmenity(String tag, String val, boolean relation, Map<String, String> otherTags) {
boolean hasName = !Algorithms.isEmpty(otherTags.get("name"));
initPoiTypesByTag();
PoiType pt = poiTypesByTag.get(tag+"/"+val);
if(pt == null) {
@ -561,6 +563,11 @@ public class MapPoiTypes {
if(pt.getCategory() == getOtherMapCategory()) {
return null;
}
String nameValue = otherTags.get("name");
if(pt.getNameTag() != null) {
nameValue = otherTags.get(pt.getNameTag());
}
boolean hasName = !Algorithms.isEmpty(nameValue);
if(!hasName && pt.isNameOnly()) {
return null;
}
@ -571,6 +578,9 @@ public class MapPoiTypes {
Amenity a = new Amenity();
a.setType(pt.getCategory());
a.setSubType(pt.getKeyName());
if(pt.getNameTag() != null) {
a.setName(nameValue);
}
// additional info
Iterator<Entry<String, String>> it = otherTags.entrySet().iterator();
while(it.hasNext()) {

View file

@ -13,6 +13,7 @@ public class PoiType extends AbstractPoiType {
private String osmValue;
private String osmValue2;
private String nameTag;
private boolean text;
private boolean nameOnly;
private boolean relation;
@ -118,6 +119,14 @@ public class PoiType extends AbstractPoiType {
public void setText(boolean text) {
this.text = text;
}
public String getNameTag() {
return nameTag;
}
public void setNameTag(String nameTag) {
this.nameTag = nameTag;
}
public boolean isNameOnly() {
return nameOnly;