use of net.osmand.osm.PoiFilter in project Osmand by osmandapp.
the class QuickSearchPoiFilterFragment method getExcludedPoiAdditionalCategories.
@NonNull
private Set<String> getExcludedPoiAdditionalCategories() {
Set<String> excludedPoiAdditionalCategories = new LinkedHashSet<>();
if (filter.getAcceptedTypes().size() == 0) {
return excludedPoiAdditionalCategories;
}
MapPoiTypes poiTypes = getMyApplication().getPoiTypes();
PoiCategory topCategory = null;
for (Entry<PoiCategory, LinkedHashSet<String>> entry : filter.getAcceptedTypes().entrySet()) {
if (topCategory == null) {
topCategory = entry.getKey();
}
if (entry.getValue() != null) {
Set<String> excluded = new LinkedHashSet<>();
for (String keyName : entry.getValue()) {
PoiType poiType = poiTypes.getPoiTypeByKeyInCategory(topCategory, keyName);
if (poiType != null) {
collectExcludedPoiAdditionalCategories(poiType, excluded);
if (!poiType.isReference()) {
PoiFilter poiFilter = poiType.getFilter();
if (poiFilter != null) {
collectExcludedPoiAdditionalCategories(poiFilter, excluded);
}
PoiCategory poiCategory = poiType.getCategory();
if (poiCategory != null) {
collectExcludedPoiAdditionalCategories(poiCategory, excluded);
}
}
}
if (excludedPoiAdditionalCategories.size() == 0) {
excludedPoiAdditionalCategories.addAll(excluded);
} else {
excludedPoiAdditionalCategories.retainAll(excluded);
}
excluded.clear();
}
}
}
if (topCategory != null && topCategory.getExcludedPoiAdditionalCategories() != null) {
excludedPoiAdditionalCategories.addAll(topCategory.getExcludedPoiAdditionalCategories());
}
return excludedPoiAdditionalCategories;
}
Aggregations