Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
4863f31cf9
2 changed files with 29 additions and 10 deletions
|
@ -1,14 +1,5 @@
|
||||||
package net.osmand.osm;
|
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.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -25,6 +16,15 @@ import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.TreeMap;
|
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 {
|
public class MapPoiTypes {
|
||||||
private static MapPoiTypes DEFAULT_INSTANCE = null;
|
private static MapPoiTypes DEFAULT_INSTANCE = null;
|
||||||
|
@ -389,6 +389,7 @@ public class MapPoiTypes {
|
||||||
tp.setOsmValue2(parser.getAttributeValue("", "value2"));
|
tp.setOsmValue2(parser.getAttributeValue("", "value2"));
|
||||||
tp.setText("text".equals(parser.getAttributeValue("", "type")));
|
tp.setText("text".equals(parser.getAttributeValue("", "type")));
|
||||||
tp.setNameOnly("true".equals(parser.getAttributeValue("", "name_only")));
|
tp.setNameOnly("true".equals(parser.getAttributeValue("", "name_only")));
|
||||||
|
tp.setNameTag(parser.getAttributeValue("", "name_tag"));
|
||||||
tp.setRelation("true".equals(parser.getAttributeValue("", "relation")));
|
tp.setRelation("true".equals(parser.getAttributeValue("", "relation")));
|
||||||
if (lastFilter != null) {
|
if (lastFilter != null) {
|
||||||
lastFilter.addPoiType(tp);
|
lastFilter.addPoiType(tp);
|
||||||
|
@ -544,7 +545,8 @@ public class MapPoiTypes {
|
||||||
|
|
||||||
|
|
||||||
public Amenity parseAmenity(String tag, String val, boolean relation, Map<String, String> otherTags) {
|
public Amenity parseAmenity(String tag, String val, boolean relation, Map<String, String> otherTags) {
|
||||||
boolean hasName = !Algorithms.isEmpty(otherTags.get("name"));
|
|
||||||
|
|
||||||
initPoiTypesByTag();
|
initPoiTypesByTag();
|
||||||
PoiType pt = poiTypesByTag.get(tag+"/"+val);
|
PoiType pt = poiTypesByTag.get(tag+"/"+val);
|
||||||
if(pt == null) {
|
if(pt == null) {
|
||||||
|
@ -561,6 +563,11 @@ public class MapPoiTypes {
|
||||||
if(pt.getCategory() == getOtherMapCategory()) {
|
if(pt.getCategory() == getOtherMapCategory()) {
|
||||||
return null;
|
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()) {
|
if(!hasName && pt.isNameOnly()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -571,6 +578,9 @@ public class MapPoiTypes {
|
||||||
Amenity a = new Amenity();
|
Amenity a = new Amenity();
|
||||||
a.setType(pt.getCategory());
|
a.setType(pt.getCategory());
|
||||||
a.setSubType(pt.getKeyName());
|
a.setSubType(pt.getKeyName());
|
||||||
|
if(pt.getNameTag() != null) {
|
||||||
|
a.setName(nameValue);
|
||||||
|
}
|
||||||
// additional info
|
// additional info
|
||||||
Iterator<Entry<String, String>> it = otherTags.entrySet().iterator();
|
Iterator<Entry<String, String>> it = otherTags.entrySet().iterator();
|
||||||
while(it.hasNext()) {
|
while(it.hasNext()) {
|
||||||
|
|
|
@ -13,6 +13,7 @@ public class PoiType extends AbstractPoiType {
|
||||||
private String osmValue;
|
private String osmValue;
|
||||||
private String osmValue2;
|
private String osmValue2;
|
||||||
|
|
||||||
|
private String nameTag;
|
||||||
private boolean text;
|
private boolean text;
|
||||||
private boolean nameOnly;
|
private boolean nameOnly;
|
||||||
private boolean relation;
|
private boolean relation;
|
||||||
|
@ -119,6 +120,14 @@ public class PoiType extends AbstractPoiType {
|
||||||
this.text = text;
|
this.text = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getNameTag() {
|
||||||
|
return nameTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNameTag(String nameTag) {
|
||||||
|
this.nameTag = nameTag;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isNameOnly() {
|
public boolean isNameOnly() {
|
||||||
return nameOnly;
|
return nameOnly;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue