Commit poi with name
This commit is contained in:
parent
7a7d2b325a
commit
c95dcf10e4
3 changed files with 19 additions and 9 deletions
|
@ -60,13 +60,13 @@ public class BinaryInspector {
|
||||||
// test cases show info
|
// test cases show info
|
||||||
if(args.length == 1 && "test".equals(args[0])) {
|
if(args.length == 1 && "test".equals(args[0])) {
|
||||||
in.inspector(new String[]{
|
in.inspector(new String[]{
|
||||||
//"-vpoi",
|
"-vpoi",
|
||||||
// "-vmap", "-vmapobjects",
|
// "-vmap", "-vmapobjects",
|
||||||
// "-vrouting",
|
// "-vrouting",
|
||||||
// "-vaddress", "-vcities", "-vstreets", "-vstreetgroups","-vbuildings",
|
// "-vaddress", "-vcities", "-vstreets", "-vstreetgroups","-vbuildings",
|
||||||
//"-zoom=16",
|
//"-zoom=16",
|
||||||
//"-bbox=4,55,7,50",
|
//"-bbox=4,55,7,50",
|
||||||
// "/home/victor/projects/osmand/osm-gen/Map.obf"
|
"/home/victor/projects/osmand/osm-gen/Map.obf"
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
in.inspector(args);
|
in.inspector(args);
|
||||||
|
|
|
@ -305,6 +305,7 @@ public class MapRenderingTypes {
|
||||||
rType.poiSpecified = parent.poiSpecified;
|
rType.poiSpecified = parent.poiSpecified;
|
||||||
rType.poiCategory = parent.poiCategory;
|
rType.poiCategory = parent.poiCategory;
|
||||||
rType.poiPrefix = parent.poiPrefix;
|
rType.poiPrefix = parent.poiPrefix;
|
||||||
|
rType.poiWithNameOnly = parent.poiWithNameOnly;
|
||||||
rType.namePrefix = parent.namePrefix;
|
rType.namePrefix = parent.namePrefix;
|
||||||
rType = registerRuleType(rType);
|
rType = registerRuleType(rType);
|
||||||
}
|
}
|
||||||
|
@ -375,15 +376,15 @@ public class MapRenderingTypes {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AmenityType getAmenityType(String tag, String val){
|
public AmenityType getAmenityType(String tag, String val, boolean hasName){
|
||||||
return getAmenityType(tag, val, false);
|
return getAmenityType(tag, val, false, hasName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AmenityType getAmenityTypeForRelation(String tag, String val){
|
public AmenityType getAmenityTypeForRelation(String tag, String val, boolean hasName){
|
||||||
return getAmenityType(tag, val, true);
|
return getAmenityType(tag, val, true, hasName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private AmenityType getAmenityType(String tag, String val, boolean relation){
|
private AmenityType getAmenityType(String tag, String val, boolean relation, boolean hasName){
|
||||||
// register amenity types
|
// register amenity types
|
||||||
Map<String, MapRulType> rules = getEncodingRuleTypes();
|
Map<String, MapRulType> rules = getEncodingRuleTypes();
|
||||||
MapRulType rt = rules.get(constructRuleKey(tag, val));
|
MapRulType rt = rules.get(constructRuleKey(tag, val));
|
||||||
|
@ -391,6 +392,9 @@ public class MapRenderingTypes {
|
||||||
if((relation && !rt.relation) || rt.isAdditionalOrText()) {
|
if((relation && !rt.relation) || rt.isAdditionalOrText()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
if(rt.poiWithNameOnly && !hasName) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return rt.poiCategory;
|
return rt.poiCategory;
|
||||||
}
|
}
|
||||||
rt = rules.get(constructRuleKey(tag, null));
|
rt = rules.get(constructRuleKey(tag, null));
|
||||||
|
@ -398,6 +402,9 @@ public class MapRenderingTypes {
|
||||||
if((relation && !rt.relation) || rt.isAdditionalOrText()) {
|
if((relation && !rt.relation) || rt.isAdditionalOrText()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
if(rt.poiWithNameOnly && !hasName) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return rt.poiCategory;
|
return rt.poiCategory;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -526,6 +533,7 @@ public class MapRenderingTypes {
|
||||||
rtype.poiCategory = AmenityType.getAndRegisterType(poiCategory);
|
rtype.poiCategory = AmenityType.getAndRegisterType(poiCategory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
rtype.poiWithNameOnly = Boolean.parseBoolean(parser.getAttributeValue("", "poi_with_name"));
|
||||||
String poiPrefix = parser.getAttributeValue("", "poi_prefix");
|
String poiPrefix = parser.getAttributeValue("", "poi_prefix");
|
||||||
if (poiPrefix != null) {
|
if (poiPrefix != null) {
|
||||||
rtype.poiPrefix = poiPrefix;
|
rtype.poiPrefix = poiPrefix;
|
||||||
|
@ -704,6 +712,7 @@ public class MapRenderingTypes {
|
||||||
|
|
||||||
protected String category = null;
|
protected String category = null;
|
||||||
protected String poiPrefix;
|
protected String poiPrefix;
|
||||||
|
protected boolean poiWithNameOnly;
|
||||||
protected AmenityType poiCategory;
|
protected AmenityType poiCategory;
|
||||||
// poi_category was specially removed for one tag/value, to skip unnecessary objects
|
// poi_category was specially removed for one tag/value, to skip unnecessary objects
|
||||||
protected boolean poiSpecified;
|
protected boolean poiSpecified;
|
||||||
|
|
|
@ -114,9 +114,10 @@ public class EntityParser {
|
||||||
for(Map<String, String> tags : it) {
|
for(Map<String, String> tags : it) {
|
||||||
if (!tags.isEmpty()) {
|
if (!tags.isEmpty()) {
|
||||||
boolean purerelation = relation && !"multipolygon".equals(tags.get("type"));
|
boolean purerelation = relation && !"multipolygon".equals(tags.get("type"));
|
||||||
|
boolean hasName = !Algorithms.isEmpty(tags.get("name"));
|
||||||
for (Map.Entry<String, String> e : tags.entrySet()) {
|
for (Map.Entry<String, String> e : tags.entrySet()) {
|
||||||
AmenityType type = purerelation ? renderingTypes.getAmenityTypeForRelation(e.getKey(), e.getValue())
|
AmenityType type = purerelation ? renderingTypes.getAmenityTypeForRelation(e.getKey(), e.getValue(), hasName)
|
||||||
: renderingTypes.getAmenityType(e.getKey(), e.getValue());
|
: renderingTypes.getAmenityType(e.getKey(), e.getValue(), hasName );
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
String subtype = renderingTypes.getAmenitySubtype(e.getKey(), e.getValue());
|
String subtype = renderingTypes.getAmenitySubtype(e.getKey(), e.getValue());
|
||||||
Amenity a = parseAmenity(entity, type, subtype, tags, renderingTypes);
|
Amenity a = parseAmenity(entity, type, subtype, tags, renderingTypes);
|
||||||
|
|
Loading…
Reference in a new issue