Fixed poi_additional_category

This commit is contained in:
Alexey Kulish 2016-10-05 15:52:47 +03:00
parent 391c0954f4
commit 610245dc18
2 changed files with 23 additions and 4 deletions

View file

@ -269,6 +269,7 @@ public class MapPoiTypes {
final Map<String, PoiType> allTypes = new LinkedHashMap<String, PoiType>();
final Map<String, List<PoiType>> categoryPoiAdditionalMap = new LinkedHashMap<String, List<PoiType>>();
final Map<AbstractPoiType, Set<String>> abstractTypeAdditionalCategories = new LinkedHashMap<AbstractPoiType, Set<String>>();
final Map<String, AbstractPoiType> additionalCategoryOriginMap = new LinkedHashMap<String, AbstractPoiType>();
if (resourceName != null) {
this.resourceName = resourceName;
}
@ -354,6 +355,13 @@ public class MapPoiTypes {
if (!Algorithms.isEmpty(icon)) {
poiAdditionalCategoryIcons.put(lastPoiAdditionalCategory, icon);
}
if (lastType != null) {
additionalCategoryOriginMap.put(lastPoiAdditionalCategory, lastType);
} else if (lastFilter != null) {
additionalCategoryOriginMap.put(lastPoiAdditionalCategory, lastFilter);
} else if (lastCategory != null) {
additionalCategoryOriginMap.put(lastPoiAdditionalCategory, lastCategory);
}
}
} else if (name.equals("poi_type")) {
@ -429,16 +437,18 @@ public class MapPoiTypes {
gt.setReferenceType(pt);
}
}
/*
for (Entry<AbstractPoiType, Set<String>> entry : abstractTypeAdditionalCategories.entrySet()) {
for (String category : entry.getValue()) {
List<PoiType> poiAdditionals = categoryPoiAdditionalMap.get(category);
if (poiAdditionals != null) {
boolean reference = additionalCategoryOriginMap.get(category) != entry.getKey();
for (PoiType poiType : poiAdditionals) {
poiType.setPoiAdditionalReference(reference);
}
entry.getKey().addPoiAdditionalsCategorized(poiAdditionals);
}
}
}
*/
findDefaultOtherCategory();
init = true;
log.info("Time to init poi types " + (System.currentTimeMillis() - time)); //$NON-NLS-1$
@ -662,7 +672,7 @@ public class MapPoiTypes {
private void initPoiType(PoiType p) {
if (!p.isReference()) {
if (!p.isReference() && !p.isPoiAdditionalReference()) {
String key = null;
if (p.isAdditional()) {
key = p.isText() ? p.getRawOsmTag() :

View file

@ -12,7 +12,8 @@ public class PoiType extends AbstractPoiType {
private String osmTag2;
private String osmValue;
private String osmValue2;
private boolean poiAdditionalReference;
private String nameTag;
private boolean text;
@ -92,6 +93,14 @@ public class PoiType extends AbstractPoiType {
this.osmValue2 = osmValue2;
}
public boolean isPoiAdditionalReference() {
return poiAdditionalReference;
}
public void setPoiAdditionalReference(boolean poiAdditionalReference) {
this.poiAdditionalReference = poiAdditionalReference;
}
public PoiCategory getCategory() {
return category;
}