| 116 | } |
| 117 | |
| 118 | std::string MapObject::GetLocalizedAllTypes(bool withMainType) const |
| 119 | { |
| 120 | ASSERT(!m_types.Empty(), ()); |
| 121 | feature::TypesHolder copy(m_types); |
| 122 | copy.SortBySpec(); |
| 123 | |
| 124 | auto const & isPoi = ftypes::IsPoiChecker::Instance(); |
| 125 | auto const & isNeverMainTypeChecker = ftypes::IsNeverMainTypeChecker::Instance(); |
| 126 | auto const & isTourismAttraction = ftypes::IsTourismAttractionChecker::Instance(); |
| 127 | auto const & subtypes = ftypes::Subtypes::Instance(); |
| 128 | auto const & amenityChecker = ftypes::IsAmenityChecker::Instance(); |
| 129 | |
| 130 | std::ostringstream oss; |
| 131 | bool isMainType = true; |
| 132 | // The tourist attraction type can get added to features as main type for which their original main type usually only would be shown, if it is the main type, because it is no POI according to the POI checker. They also should be shown though, if the main type is tourist attraction. |
| 133 | bool isOnlyTypeTouristAttraction = false; |
| 134 | bool isFirst = true; |
| 135 | for (auto const type : copy) |
| 136 | { |
| 137 | if (isMainType) |
| 138 | { |
| 139 | isOnlyTypeTouristAttraction = isTourismAttraction(type); |
| 140 | if (!withMainType) |
| 141 | { |
| 142 | isMainType = false; |
| 143 | continue; |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | // Ignore types that never should be main types |
| 148 | if ((isMainType || isOnlyTypeTouristAttraction) && isNeverMainTypeChecker(type)) |
| 149 | continue; |
| 150 | |
| 151 | // Ignore types that are neither POI or known subtypes |
| 152 | if (!isMainType && !isOnlyTypeTouristAttraction && !isPoi(type) && !subtypes.IsTypeWithSubtypesOrSubtype(type)) |
| 153 | continue; |
| 154 | |
| 155 | // Ignore general amenity |
| 156 | if (!isMainType && !isOnlyTypeTouristAttraction && amenityChecker.GetType() == type) |
| 157 | continue; |
| 158 | |
| 159 | if (!isMainType) |
| 160 | isOnlyTypeTouristAttraction = false; |
| 161 | isMainType = false; |
| 162 | |
| 163 | // Add fields separator between types |
| 164 | if (isFirst) |
| 165 | isFirst = false; |
| 166 | else |
| 167 | oss << feature::kFieldsSeparator; |
| 168 | |
| 169 | oss << localisation::TranslatedFeatureType(classif().GetReadableObjectName(type)); |
| 170 | } |
| 171 | |
| 172 | return oss.str(); |
| 173 | } |
| 174 | |
| 175 | std::string MapObject::GetAllReadableTypes() const |