Compare commits

..

1 Commits

Author SHA1 Message Date
Yannik Bloscheck
1cf88f1429 Display subtypes in search results
Signed-off-by: Yannik Bloscheck <git@yannikbloscheck.com>
2026-01-17 13:33:50 +01:00
7 changed files with 30 additions and 13 deletions

View File

@@ -1,8 +1,8 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionSha256Sum=72f44c9f8ebcb1af43838f45ee5c4aa9c5444898b3468ab3f4af7b6076c5bc3f
distributionSha256Sum=bd71102213493060956ec229d946beee57158dbd89d0e62b91bca0fa2c5f3531

View File

@@ -15,11 +15,10 @@
# a "forbidden" selector like [!oneway] matches [oneway=no] only or absence of this tag.
# If first 2 (1 for short types like "building") components of pre-matched types are the same,
# then leave only the longest types (there could be a few of them). Equal arity types are kept.
# Types added to data/subtypes.csv are always kept, too.
# - highway-primary-bridge is left while highway-primary is removed;
# - building-garages is left while building is removed;
# - amenity-parking-underground-fee is left while amenity-parking and amenity-parking-fee are removed;
# - both highway-primary-bridge and highway-primary-tunnel are left;
# - both amenity-charging_station-motorcar and amenity-charging_station-bicycle are left;
#
# A shorter format for the above example:
# highway|bus_stop;22;
Can't render this file because it contains an unexpected character in line 7 and column 16.

View File

@@ -31,7 +31,6 @@ There are some other files not mentioned here.
### Map features / classificator
- `mapcss-mapping.csv` - mapping between OSM tags and CoMaps types.
- `subtypes.csv` - declaring CoMaps types as having subtypes or being one.
- `replaced_tags.txt` - merging similar OSM tags.
- `mixed_tags.txt` - pedestrian streets of high popularity.

View File

@@ -67,13 +67,13 @@ preferably look for icons in [collections CoMaps uses already](../data/copyright
2. If necessary merge similar tags in via `data/replaced_tags.txt`
3. Define a priority for the new feature type in e.g. [`priorities_4_overlays.prio.txt`](../data/styles/default/include/priorities_4_overlays.prio.txt) and/or other priorities files
4. Add a new icon (see [above](#how-to-add-a-new-icon)) and/or other styling (area, line..)
5. If a new POI is a subtype or has subtypes, add it accordingly to `data/subtypes.csv`
6. If a new POI should be OSM-addable/editable then add it to `data/editor.config`
7. Add the English string (and optionally translations e.g. for your native language) into iOS (`iphone/Maps/LocalizedStrings/en.lproj/LocalizableTypes.strings`) and Android (`android/sdk/src/main/res/values/types_strings.xml`) type strings
8. Add search keywords into `data/categories-strings/en.json/localize.json`
9. Add new or fix current classifier tests at `generator/generator_tests/osm_type_tests.cpp` if you can
10. [Test](#testing-your-changes) your changes
11. Relax and wait for the next maps update :)
5. If a new POI should be OSM-addable/editable then add it to `data/editor.config`
6. Add the English string (and optionally translations e.g. for your native language) into iOS and Android type strings
e strings
7. Add search keywords into `data/categories.txt`
8. Add new or fix current classifier tests at `generator/generator_tests/osm_type_tests.cpp` if you can
9. [Test](#testing-your-changes) your changes
10. Relax and wait for the next maps update :)
## Testing your changes

View File

@@ -4,6 +4,7 @@
#include "indexer/feature_data.hpp"
#include "indexer/feature_visibility.hpp"
#include "indexer/ftypes_matcher.hpp"
#include "indexer/ftypes_subtypes.hpp"
#include "indexer/scales.hpp"
#include "platform/distance.hpp"
@@ -440,6 +441,17 @@ vector<int8_t> GetDescriptionLangPriority(RegionData const & regionData)
return PrioritizedLanguages(preferredLangs, DefaultLanguage(regionData, preferredLangs));
}
vector<string> GetLocalizedSubtypes(TypesHolder const & types)
{
auto const & classificator = classif();
auto subtypes = ftypes::Subtypes::Instance();
vector<string> localizedSubtypes;
for (auto const & type : types)
if (subtypes.IsSubtype(type))
localizedSubtypes.push_back(platform::GetLocalizedTypeName(classificator.GetReadableObjectName(type)));
return localizedSubtypes;
}
vector<string> GetCuisines(TypesHolder const & types)
{
auto const & isCuisine = ftypes::IsCuisineChecker::Instance();

View File

@@ -149,6 +149,9 @@ bool GetPreferredName(StringUtf8Multilang const & src, int8_t deviceLang, std::s
/// - default language code;
std::vector<int8_t> GetDescriptionLangPriority(RegionData const & regionData);
// Returns vector of subtypes localized by platform.
std::vector<std::string> GetLocalizedSubtypes(TypesHolder const & types);
// Returns vector of cuisines readable names from classificator.
std::vector<std::string> GetCuisines(TypesHolder const & types);

View File

@@ -279,7 +279,8 @@ void FillDetails(FeatureType & ft, std::string const & name, Result::Details & d
}
}
feature::TypesHolder const typesHolder(ft);
feature::TypesHolder typesHolder(ft);
typesHolder.SortBySpec();
std::string stars;
uint8_t starsCount = 0;
@@ -287,6 +288,8 @@ void FillDetails(FeatureType & ft, std::string const & name, Result::Details & d
if (isHotel && strings::to_uint(ft.GetMetadata(feature::Metadata::FMD_STARS), starsCount))
stars = feature::FormatStars(starsCount);
auto const subtypes = strings::JoinStrings(feature::GetLocalizedSubtypes(typesHolder), feature::kFieldsSeparator);
auto const cuisines = feature::GetLocalizedCuisines(typesHolder);
auto const cuisine = strings::JoinStrings(cuisines, feature::kFieldsSeparator);
@@ -314,6 +317,7 @@ void FillDetails(FeatureType & ft, std::string const & name, Result::Details & d
append(brand);
append(elevation);
append(cuisine);
append(subtypes);
append(fee);
details.m_description = std::move(description);