mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-16 19:55:13 +00:00
Compare commits
2 Commits
yannikblos
...
zy-docker-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c79bc5d28 | ||
|
|
6ee40d4414 |
@@ -34,28 +34,79 @@ on:
|
||||
- track_generator/**
|
||||
- xcode/**
|
||||
|
||||
env:
|
||||
SUBMODULE_CACHE_PATHS: |
|
||||
.git/modules
|
||||
3party/CMake-MetalShaderSupport
|
||||
3party/Vulkan-Headers
|
||||
3party/boost
|
||||
3party/expat
|
||||
3party/fast_double_parser
|
||||
3party/fast_obj
|
||||
3party/freetype/freetype
|
||||
3party/gflags
|
||||
3party/glaze
|
||||
3party/glfw
|
||||
3party/glm
|
||||
3party/googletest
|
||||
3party/harfbuzz/harfbuzz
|
||||
3party/icu/icu
|
||||
3party/imgui/imgui
|
||||
3party/jansson/jansson
|
||||
3party/just_gtfs
|
||||
3party/protobuf/protobuf
|
||||
3party/pugixml/pugixml
|
||||
3party/utfcpp
|
||||
tools/kothic
|
||||
tools/osmctools
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Android Lint
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: codeberg.org/comaps/docker-android-sdk:latest
|
||||
options: --user root
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Parallel submodules checkout
|
||||
- name: Cache world map
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: data/world_mwm
|
||||
key: world-mwm
|
||||
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.SUBMODULE_CACHE_PATHS }}
|
||||
key: submodules-${{ hashFiles('.gitmodules') }}
|
||||
restore-keys: |
|
||||
submodules-
|
||||
|
||||
- name: Sync and update submodules
|
||||
shell: bash
|
||||
run: git submodule update --depth 1 --init --recursive --jobs=$(($(nproc) * 20))
|
||||
run: |
|
||||
git submodule sync --recursive
|
||||
git submodule update --depth 1 --init --recursive --jobs=$(($(nproc) * 20))
|
||||
|
||||
- name: Lint
|
||||
shell: bash
|
||||
working-directory: android
|
||||
run: ./gradlew -Pandroidauto=true lint
|
||||
run: |
|
||||
# cd ..
|
||||
# ./configure.sh
|
||||
# cd android
|
||||
./gradlew -Pandroidauto=true lint
|
||||
|
||||
android-check:
|
||||
name: Build Android Debug
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: codeberg.org/comaps/docker-android-sdk:latest
|
||||
options: --user root
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -71,23 +122,32 @@ jobs:
|
||||
cancel-in-progress: true
|
||||
|
||||
steps:
|
||||
- name: Install build tools and dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y ninja-build
|
||||
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 200 # enough to get all commits for the current day
|
||||
|
||||
- name: Parallel submodules checkout
|
||||
- name: Cache world map
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: data/world_mwm
|
||||
key: world-mwm
|
||||
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.SUBMODULE_CACHE_PATHS }}
|
||||
key: submodules-${{ hashFiles('.gitmodules') }}
|
||||
restore-keys: |
|
||||
submodules-
|
||||
|
||||
- name: Sync and update submodules
|
||||
shell: bash
|
||||
run: git submodule update --depth 1 --init --recursive --jobs=$(($(nproc) * 20))
|
||||
run: |
|
||||
git submodule sync --recursive
|
||||
git submodule update --depth 1 --init --recursive --jobs=$(($(nproc) * 20))
|
||||
|
||||
- name: Configure ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
uses: https://github.com/hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{ github.workflow }}-${{ matrix.flavor }}
|
||||
|
||||
@@ -98,13 +158,14 @@ jobs:
|
||||
CMAKE_C_COMPILER_LAUNCHER: ccache
|
||||
CMAKE_CXX_COMPILER_LAUNCHER: ccache
|
||||
run: |
|
||||
cmake --version
|
||||
ninja --version
|
||||
cd ..
|
||||
./configure.sh
|
||||
cd android
|
||||
./gradlew -P${{ matrix.arch }} assemble${{ matrix.flavor }}
|
||||
|
||||
- name: Upload ${{ matrix.flavor }} apk
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: android-${{ matrix.flavor }}
|
||||
path: android/app/build/outputs/apk/**/OrganicMaps-*.apk
|
||||
path: android/app/build/outputs/apk/**/*.apk
|
||||
if-no-files-found: error
|
||||
|
||||
@@ -104,8 +104,7 @@ if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
|
||||
elseif (${CMAKE_BUILD_TYPE} MATCHES "Rel")
|
||||
add_definitions(-DRELEASE)
|
||||
if (NOT MSVC)
|
||||
add_compile_options(-O3)
|
||||
set (CMAKE_INTERPROCEDURAL_OPTIMIZATION True)
|
||||
add_compile_options(-O3 $<$<CXX_COMPILER_ID:GNU>:-flto=auto>)
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown build type: " ${CMAKE_BUILD_TYPE})
|
||||
|
||||
@@ -41,5 +41,5 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="bottom|start"
|
||||
android:background="?appBackground"/>
|
||||
android:background="?colorSurfaceContainerLow"/>
|
||||
</FrameLayout>
|
||||
|
||||
@@ -40,5 +40,5 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="bottom|center"
|
||||
android:background="?appBackground"/>
|
||||
android:background="?colorSurfaceContainerLow"/>
|
||||
</FrameLayout>
|
||||
|
||||
@@ -151,7 +151,7 @@
|
||||
<item name="colorSurfaceContainerHigh">@color/md_theme_surfaceContainerHigh</item>
|
||||
<item name="colorSurfaceContainerHighest">@color/md_theme_surfaceContainerHighest</item>
|
||||
|
||||
<item name="appBackground">@color/bg_app</item>
|
||||
<item name="appBackground">?android:attr/colorBackground</item>
|
||||
</style>
|
||||
|
||||
<style name="MwmTheme" parent="MwmTheme.Base"/>
|
||||
|
||||
@@ -287,13 +287,13 @@
|
||||
</style>
|
||||
|
||||
<style name="MwmWidget.BottomSheetDialog" parent="Widget.Material3.BottomSheet.Modal">
|
||||
<item name="backgroundTint">?appBackground</item>
|
||||
<item name="backgroundTint">?colorSurfaceContainerLow</item>
|
||||
<item name="elevationOverlayEnabled">false</item>
|
||||
<item name="shapeAppearance">@style/ShapeAppearance.Material3.LargeComponent</item>
|
||||
</style>
|
||||
|
||||
<style name="MwmWidget.BottomSheet" parent="MwmWidget.BottomSheetDialog">
|
||||
<item name="android:background">?appBackground</item>
|
||||
<item name="android:background">?colorSurfaceContainerLow</item>
|
||||
<item name="behavior_hideable">false</item>
|
||||
</style>
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../../../../../data/subtypes.csv
|
||||
|
@@ -186,7 +186,7 @@
|
||||
"place-state": "Щат|провинция",
|
||||
"place-region": "Район|Регион",
|
||||
"place-island|place-islet": "Остров",
|
||||
"place-suburb|place-quarter|place-neighbourhood|landuse-residential": "Район|микрорайон|окръг|квартал|Предградие|Жилищен комплекс|ЖК",
|
||||
"place-suburb|place-quarter|place-neighbourhood|landuse-residential": "Район|микрорайон|окръг|квартал|Предградие|Жилищен комплекс|ж.к.|ЖК",
|
||||
"place-hamlet": "Село",
|
||||
"place-village": "Село",
|
||||
"place-locality": "местност|регион|Място",
|
||||
|
||||
@@ -199,7 +199,7 @@
|
||||
"place-state": "Штат|провинция",
|
||||
"place-region": "Район",
|
||||
"place-island|place-islet": "Остров",
|
||||
"place-suburb|place-quarter|place-neighbourhood|landuse-residential": "Район|микрорайон|квартал|Жилая зона|Жилой комплекс|ЖК",
|
||||
"place-suburb|place-quarter|place-neighbourhood|landuse-residential": "Район|микрорайон|квартал|Жилая зона|Жилой комплекс|ж.к.|ЖК",
|
||||
"place-hamlet": "Посёлок|деревня",
|
||||
"place-village": "Деревня|поселок",
|
||||
"place-locality": "Местность|регион",
|
||||
|
||||
@@ -196,7 +196,7 @@
|
||||
"place-state": "Штат|провінція|регіон",
|
||||
"place-region": "Район|область",
|
||||
"place-island|place-islet": "Острів",
|
||||
"place-suburb|place-quarter|place-neighbourhood|landuse-residential": "Район|мікрорайон|квартал|округа|Сусідство|Житловий комплекс|ЖК",
|
||||
"place-suburb|place-quarter|place-neighbourhood|landuse-residential": "Район|мікрорайон|квартал|округа|Сусідство|Житловий комплекс|ж.к.|ЖК",
|
||||
"place-hamlet": "Поселення|селище|село",
|
||||
"place-village": "Село|хутір|поселення",
|
||||
"place-locality": "Місцевість|регіон|Місце",
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
Types;Related Subtypes
|
||||
amenity|charging_station;amenity|charging_station|motorcar,amenity|charging_station|motorcycle,amenity|charging_station|bicycle,amenity|charging_station|small,amenity|charging_station|carless
|
||||
|
@@ -113,7 +113,6 @@ auto constexpr TMP_OFFSETS_EXT = OFFSET_EXT EXTENSION_TMP;
|
||||
#define SKIPPED_ELEMENTS_FILE "skipped_elements.json"
|
||||
|
||||
#define MAPCSS_MAPPING_FILE "mapcss-mapping.csv"
|
||||
#define SUBTYPES_FILE "subtypes.csv"
|
||||
#define REPLACED_TAGS_FILE "replaced_tags.txt"
|
||||
#define MIXED_TAGS_FILE "mixed_tags.txt"
|
||||
#define MIXED_NODES_FILE "mixed_nodes.txt"
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "indexer/classificator.hpp"
|
||||
#include "indexer/feature_impl.hpp"
|
||||
#include "indexer/ftypes_matcher.hpp"
|
||||
#include "indexer/ftypes_subtypes.hpp"
|
||||
|
||||
#include "platform/platform.hpp"
|
||||
|
||||
@@ -352,11 +351,9 @@ private:
|
||||
// - both amenity-charging_station-motorcar and amenity-charging_station-bicycle are left;
|
||||
void LeaveLongestTypes(std::vector<generator::TypeStrings> & matchedTypes)
|
||||
{
|
||||
// Prevents types, that either have subtypes or are subtypes, from being removed
|
||||
auto subtypes = ftypes::Subtypes::Instance();
|
||||
auto const hasSubtypeRelatedTypes = [subtypes](auto const & lhs, auto const & rhs)
|
||||
auto const isChargingStation = [](auto const & lhs, auto const & rhs)
|
||||
{
|
||||
return subtypes.IsPathOfTypeWithSubtypesOrSubtype(lhs) || subtypes.IsPathOfTypeWithSubtypesOrSubtype(rhs);
|
||||
return lhs.size() > 1 && rhs.size() > 1 && lhs.at(1) == "charging_station" && rhs.at(1) == "charging_station" && lhs.at(0) == "amenity" && rhs.at(0) == "amenity";
|
||||
};
|
||||
|
||||
auto const equalPrefix = [](auto const & lhs, auto const & rhs)
|
||||
@@ -377,10 +374,9 @@ void LeaveLongestTypes(std::vector<generator::TypeStrings> & matchedTypes)
|
||||
return lhs < rhs;
|
||||
};
|
||||
|
||||
// `true` means it will be deleted, because being equal means it isn't unique
|
||||
auto const isEqual = [&equalPrefix, &hasSubtypeRelatedTypes](auto const & lhs, auto const & rhs)
|
||||
auto const isEqual = [&equalPrefix, &isChargingStation](auto const & lhs, auto const & rhs)
|
||||
{
|
||||
if (hasSubtypeRelatedTypes(lhs, rhs))
|
||||
if (isChargingStation(lhs, rhs))
|
||||
return false;
|
||||
|
||||
if (equalPrefix(lhs, rhs))
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
270C9C282E16AB6F00ABA688 /* Profile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 270C9C252E16AB6300ABA688 /* Profile.swift */; };
|
||||
27176A862E65B0150015F25F /* Icon.icon in Resources */ = {isa = PBXBuildFile; fileRef = 27176A852E65B0150015F25F /* Icon.icon */; };
|
||||
27176A8A2E65B01B0015F25F /* Debug Icon.icon in Resources */ = {isa = PBXBuildFile; fileRef = 27176A892E65B01B0015F25F /* Debug Icon.icon */; };
|
||||
272CA4492F127221005A3F5B /* subtypes.csv in Resources */ = {isa = PBXBuildFile; fileRef = 272CA4482F127221005A3F5B /* subtypes.csv */; };
|
||||
272F1F392E0EE09000FA52EF /* ExistingProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 272F1F382E0EE08A00FA52EF /* ExistingProfileView.swift */; };
|
||||
272F1F3B2E0EE0A300FA52EF /* NoExistingProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 272F1F3A2E0EE09500FA52EF /* NoExistingProfileView.swift */; };
|
||||
272F1F3D2E0EE0C800FA52EF /* ProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 272F1F3C2E0EE0C400FA52EF /* ProfileView.swift */; };
|
||||
@@ -765,7 +764,6 @@
|
||||
270C9C252E16AB6300ABA688 /* Profile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Profile.swift; sourceTree = "<group>"; };
|
||||
27176A852E65B0150015F25F /* Icon.icon */ = {isa = PBXFileReference; lastKnownFileType = folder.iconcomposer.icon; path = Icon.icon; sourceTree = "<group>"; };
|
||||
27176A892E65B01B0015F25F /* Debug Icon.icon */ = {isa = PBXFileReference; lastKnownFileType = folder.iconcomposer.icon; path = "Debug Icon.icon"; sourceTree = "<group>"; };
|
||||
272CA4482F127221005A3F5B /* subtypes.csv */ = {isa = PBXFileReference; lastKnownFileType = text; name = subtypes.csv; path = ../../data/subtypes.csv; sourceTree = SOURCE_ROOT; };
|
||||
272F1F382E0EE08A00FA52EF /* ExistingProfileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExistingProfileView.swift; sourceTree = "<group>"; };
|
||||
272F1F3A2E0EE09500FA52EF /* NoExistingProfileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoExistingProfileView.swift; sourceTree = "<group>"; };
|
||||
272F1F3C2E0EE0C400FA52EF /* ProfileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileView.swift; sourceTree = "<group>"; };
|
||||
@@ -3956,7 +3954,6 @@
|
||||
F623DA6A1C9C2731006A3436 /* opening_hours_how_to_edit.html */,
|
||||
FA85F632145DDDC20090E1A0 /* packed_polygons.bin */,
|
||||
451950391B7A3E070085DA05 /* patterns.txt */,
|
||||
272CA4482F127221005A3F5B /* subtypes.csv */,
|
||||
FAAEA7D0161BD26600CCD661 /* synonyms.txt */,
|
||||
BB25B1A51FB32767007276FA /* transit_colors.txt */,
|
||||
FA64D9A813F975AD00350ECF /* types.txt */,
|
||||
@@ -4284,7 +4281,6 @@
|
||||
34AB66681FC5AA330078E451 /* TransportTransitPedestrian.xib in Resources */,
|
||||
F6D67CDE2062BBA60032FD38 /* MWMBCCreateCategoryAlert.xib in Resources */,
|
||||
3490D2E31CE9DD2500D0B838 /* MWMSideButtonsView.xib in Resources */,
|
||||
272CA4492F127221005A3F5B /* subtypes.csv in Resources */,
|
||||
F6E2FE2E1E097BA00083EBEC /* MWMStreetEditorEditTableViewCell.xib in Resources */,
|
||||
3463BA691DE81DB90082417F /* MWMTrafficButtonViewController.xib in Resources */,
|
||||
F623DA6C1C9C2731006A3436 /* opening_hours_how_to_edit.html in Resources */,
|
||||
|
||||
@@ -88,8 +88,6 @@ set(SRC
|
||||
ftraits.hpp
|
||||
ftypes_matcher.cpp
|
||||
ftypes_matcher.hpp
|
||||
ftypes_subtypes.cpp
|
||||
ftypes_subtypes.hpp
|
||||
house_to_street_iface.hpp
|
||||
index_builder.cpp
|
||||
index_builder.hpp
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "indexer/classificator.hpp"
|
||||
#include "indexer/feature.hpp"
|
||||
#include "indexer/ftypes_matcher.hpp"
|
||||
#include "indexer/ftypes_subtypes.hpp"
|
||||
|
||||
#include "base/assert.hpp"
|
||||
#include "base/macros.hpp"
|
||||
@@ -192,13 +191,25 @@ void TypesHolder::SortBySpec()
|
||||
auto const getPriority = [&cl](uint32_t type) { return cl.GetObject(type)->GetMaxOverlaysPriority(); };
|
||||
|
||||
auto const & checker = UselessTypesChecker::Instance();
|
||||
auto const & subtypes = ftypes::Subtypes::Instance();
|
||||
auto const & isChargingStationChecker = ftypes::IsCharingStationChecker::Instance();
|
||||
auto const & isChargingStationSmallChecker = ftypes::IsCharingStationSmallChecker::Instance();
|
||||
|
||||
std::stable_sort(begin(), end(), [&checker, &getPriority, &subtypes](uint32_t t1, uint32_t t2)
|
||||
std::stable_sort(begin(), end(), [&checker, &getPriority, &isChargingStationChecker, &isChargingStationSmallChecker](uint32_t t1, uint32_t t2)
|
||||
{
|
||||
std::optional<bool> const comaprisonResultBasedOnTypeRelation = subtypes.ComaprisonResultBasedOnTypeRelation(t1, t2);
|
||||
if (comaprisonResultBasedOnTypeRelation.has_value())
|
||||
return comaprisonResultBasedOnTypeRelation.value();
|
||||
if (isChargingStationChecker(t1) && isChargingStationChecker(t2))
|
||||
{
|
||||
if (isChargingStationSmallChecker(t1) && !isChargingStationSmallChecker(t2))
|
||||
return false;
|
||||
else if (!isChargingStationSmallChecker(t1) && isChargingStationSmallChecker(t2))
|
||||
return true;
|
||||
|
||||
uint8_t const t1Level = ftype::GetLevel(t1);
|
||||
uint8_t const t2Level = ftype::GetLevel(t2);
|
||||
if (t1Level == 2 && t2Level != 2)
|
||||
return true;
|
||||
else if (t1Level != 2 && t2Level == 2)
|
||||
return false;
|
||||
}
|
||||
|
||||
int const p1 = getPriority(t1);
|
||||
int const p2 = getPriority(t2);
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#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"
|
||||
@@ -441,19 +440,6 @@ vector<int8_t> GetDescriptionLangPriority(RegionData const & regionData)
|
||||
return PrioritizedLanguages(preferredLangs, DefaultLanguage(regionData, preferredLangs));
|
||||
}
|
||||
|
||||
vector<string> GetLocalizedSubtypes(TypesHolder const & types)
|
||||
{
|
||||
TypesHolder copiedTypes = types;
|
||||
copiedTypes.SortBySpec();
|
||||
auto const & classificator = classif();
|
||||
auto subtypes = ftypes::Subtypes::Instance();
|
||||
vector<string> localizedSubtypes;
|
||||
for (auto const type : copiedTypes)
|
||||
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();
|
||||
|
||||
@@ -149,9 +149,6 @@ 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);
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "indexer/feature.hpp"
|
||||
#include "indexer/feature_data.hpp"
|
||||
#include "indexer/ftypes_matcher.hpp"
|
||||
#include "indexer/ftypes_subtypes.hpp"
|
||||
#include "indexer/scales.hpp"
|
||||
|
||||
#include "base/assert.hpp"
|
||||
@@ -136,9 +135,6 @@ bool TypeAlwaysExists(uint32_t type, GeomType geomType = GeomType::Undefined)
|
||||
if (IsUsefulStandaloneType(type, geomType))
|
||||
return true;
|
||||
|
||||
if (ftypes::Subtypes::Instance().IsTypeWithSubtypesOrSubtype(type))
|
||||
return true;
|
||||
|
||||
uint8_t const typeLevel = ftype::GetLevel(type);
|
||||
ftype::TruncValue(type, 1);
|
||||
|
||||
|
||||
@@ -753,6 +753,12 @@ IsDirectionalChecker::IsDirectionalChecker() : ftypes::BaseChecker(1 /* level */
|
||||
m_types.push_back(c.GetTypeByPath({"lateral"}));
|
||||
}
|
||||
|
||||
IsCharingStationChecker::IsCharingStationChecker() : ftypes::BaseChecker(2 /* level */)
|
||||
{
|
||||
Classificator const & c = classif();
|
||||
m_types.push_back(c.GetTypeByPath({"amenity", "charging_station"}));
|
||||
}
|
||||
|
||||
IsCharingStationCarChecker::IsCharingStationCarChecker() : ftypes::BaseChecker(3 /* level */)
|
||||
{
|
||||
Classificator const & c = classif();
|
||||
|
||||
@@ -519,6 +519,14 @@ public:
|
||||
DECLARE_CHECKER_INSTANCE(IsDirectionalChecker);
|
||||
};
|
||||
|
||||
class IsCharingStationChecker : public ftypes::BaseChecker
|
||||
{
|
||||
IsCharingStationChecker();
|
||||
|
||||
public:
|
||||
DECLARE_CHECKER_INSTANCE(IsCharingStationChecker);
|
||||
};
|
||||
|
||||
class IsCharingStationCarChecker : public ftypes::BaseChecker
|
||||
{
|
||||
IsCharingStationCarChecker();
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
#include "indexer/ftypes_subtypes.hpp"
|
||||
|
||||
#include "base/assert.hpp"
|
||||
#include "coding/csv_reader.hpp"
|
||||
#include "coding/reader_streambuf.hpp"
|
||||
#include "indexer/classificator.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
#include "defines.hpp"
|
||||
|
||||
namespace ftypes
|
||||
{
|
||||
/// Constructor
|
||||
Subtypes::Subtypes()
|
||||
{
|
||||
auto const & classificator = classif();
|
||||
|
||||
// Get the stream to the CSV file.
|
||||
Platform & platform = GetPlatform();
|
||||
unique_ptr<ModelReader> reader = platform.GetReader(SUBTYPES_FILE);
|
||||
ReaderStreamBuf buffer(std::move(reader));
|
||||
istream stream(&buffer);
|
||||
|
||||
// Load the CSV file and go through the lines of it one by one.
|
||||
for (auto const & columns : coding::CSVRunner(coding::CSVReader(stream, true, ';')))
|
||||
{
|
||||
// Skip empty lines.
|
||||
if (columns.empty())
|
||||
continue;
|
||||
|
||||
// There only should be two columns.
|
||||
if (columns.size() != 2)
|
||||
{
|
||||
ASSERT(false, ("Parsing of subtypes file: Invalid columns \"", columns, "\""));
|
||||
break;
|
||||
}
|
||||
|
||||
// Parse the column. The first column has the type definitions(s) and the second one has the associated subtype definitions(s).
|
||||
vector<uint32_t> types;
|
||||
vector<uint32_t> subtypes;
|
||||
for (int columnIndex = 0; columnIndex < 2; columnIndex++) {
|
||||
string_view const column = columns[columnIndex];
|
||||
|
||||
// Separate the different type definitions by the `,`. There needs to be at least one.
|
||||
vector<string_view> const typeDefinitions = strings::Tokenize(column, ",");
|
||||
if (typeDefinitions.size() < 1)
|
||||
{
|
||||
ASSERT(columnIndex != 0, ("Parsing of subtypes file: Invalid or missing types definition \"", column, "\""));
|
||||
ASSERT(columnIndex == 0, ("Parsing of subtypes file: Invalid or missing subtypes definition \"", column, "\""));
|
||||
break;
|
||||
}
|
||||
|
||||
// Parse the type definitions and convert them to actual types. Invalid types are getting skipped.
|
||||
vector<uint32_t> typesInColumn;
|
||||
for (auto typeDefinition : typeDefinitions)
|
||||
{
|
||||
vector<string_view> const typePath = strings::Tokenize(typeDefinition, "|");
|
||||
uint32_t const type = classificator.GetTypeByPathSafe(typePath);
|
||||
if (type != IndexAndTypeMapping::INVALID_TYPE)
|
||||
{
|
||||
typesInColumn.push_back(type);
|
||||
|
||||
vector<string> typesAndSubtypesPath(typePath.begin(), typePath.end());
|
||||
if (find(m_typesAndSubtypesPaths.begin(), m_typesAndSubtypesPaths.end(), typesAndSubtypesPath) == m_typesAndSubtypesPaths.end())
|
||||
m_typesAndSubtypesPaths.push_back(typesAndSubtypesPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(columnIndex != 0, ("Parsing of subtypes file: Invalid type \"", typeDefinition, "\""));
|
||||
ASSERT(columnIndex == 0, ("Parsing of subtypes file: Invalid subtype \"", typeDefinition, "\""));
|
||||
}
|
||||
}
|
||||
|
||||
if (columnIndex == 0)
|
||||
types = typesInColumn;
|
||||
else
|
||||
subtypes = typesInColumn;
|
||||
}
|
||||
|
||||
for (auto type : types)
|
||||
{
|
||||
m_types.insert(type);
|
||||
m_typesWithSubtypes[type] = subtypes;
|
||||
}
|
||||
|
||||
for (auto subtype : subtypes)
|
||||
{
|
||||
m_subtypes.insert(subtype);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Static instance
|
||||
Subtypes const & Subtypes::Instance()
|
||||
{
|
||||
static Subtypes instance;
|
||||
return instance;
|
||||
}
|
||||
} // namespace ftypes
|
||||
@@ -1,122 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
namespace ftypes
|
||||
{
|
||||
using namespace std;
|
||||
|
||||
class Subtypes
|
||||
{
|
||||
public:
|
||||
/// Static instance
|
||||
static Subtypes const & Instance();
|
||||
|
||||
/**
|
||||
* Checks if the given type is a type with subtypes or a subtype
|
||||
* @param type The type to check
|
||||
* @return `true` if it is a type with subtypes or a subtype, otherwise `false`
|
||||
*/
|
||||
bool IsTypeWithSubtypesOrSubtype(uint32_t const type) const
|
||||
{
|
||||
return IsTypeWithSubtypes(type) || IsSubtype(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given type is a type with subtypes
|
||||
* @param type The type to check
|
||||
* @return `true` if it is a type with subtypes, otherwise `false`
|
||||
*/
|
||||
bool IsTypeWithSubtypes(uint32_t const type) const
|
||||
{
|
||||
return find(m_types.begin(), m_types.end(), type) != m_types.end();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given type is a subtype
|
||||
* @param type The type to check
|
||||
* @return `true` if it is a subtype, otherwise `false`
|
||||
*/
|
||||
bool IsSubtype(uint32_t const type) const
|
||||
{
|
||||
return find(m_subtypes.begin(), m_subtypes.end(), type) != m_subtypes.end();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given type is a subtype of a given parent type
|
||||
* @param type The type to check
|
||||
* @param parentType The possible parent type
|
||||
* @return `true` if it is a subtype of the parent type, otherwise `false`
|
||||
*/
|
||||
bool IsSubtypeOfParentType(uint32_t const type, uint32_t const parentType) const
|
||||
{
|
||||
auto position = m_typesWithSubtypes.find(parentType);
|
||||
if (position != m_typesWithSubtypes.end()) {
|
||||
vector<uint32_t> subtypes = position->second;
|
||||
return find(subtypes.begin(), subtypes.end(), type) != subtypes.end();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares to given types based on their type relation
|
||||
* @param firstType The first type to compare
|
||||
* @param secondType The type to compare
|
||||
* @return `true` if the first type is a subtype but the second one isn't, `false` if it is the other way around
|
||||
*/
|
||||
optional<bool> ComaprisonResultBasedOnTypeRelation(uint32_t const firstType, uint32_t const secondType) const
|
||||
{
|
||||
bool const firstTypeIsSubtype = IsSubtype(firstType);
|
||||
bool const secondTypeIsSubtype = IsSubtype(secondType);
|
||||
if (!firstTypeIsSubtype && !secondTypeIsSubtype)
|
||||
return {};
|
||||
else if (firstTypeIsSubtype && !secondTypeIsSubtype)
|
||||
return false;
|
||||
else if (!firstTypeIsSubtype && secondTypeIsSubtype)
|
||||
return true;
|
||||
|
||||
// If they got to here, both are subtypes. So use the order of the subtypes for the comparison.
|
||||
for (auto [types, subtypes] : m_typesWithSubtypes)
|
||||
{
|
||||
for (auto const subtype : subtypes)
|
||||
{
|
||||
if (subtype == firstType)
|
||||
return true;
|
||||
else if (subtype == secondType)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given type path belongs to a type with subtypes or a subtype
|
||||
* @param typePath The type path to check
|
||||
* @return `true` if it is a type with subtypes or a subtype, otherwise `false`
|
||||
*/
|
||||
bool IsPathOfTypeWithSubtypesOrSubtype(vector<string> const typePath) const
|
||||
{
|
||||
return find(m_typesAndSubtypesPaths.begin(), m_typesAndSubtypesPaths.end(), typePath) != m_typesAndSubtypesPaths.end();
|
||||
}
|
||||
|
||||
private:
|
||||
/// Constructor
|
||||
Subtypes();
|
||||
|
||||
/// Types, which have subtypes, as unordered set for faster check performance
|
||||
unordered_set<uint32_t> m_types;
|
||||
|
||||
/// Subypes as unordered set for faster check performance
|
||||
unordered_set<uint32_t> m_subtypes;
|
||||
|
||||
/// Types with their associated subtypes
|
||||
map<uint32_t, vector<uint32_t>> m_typesWithSubtypes;
|
||||
|
||||
/// Paths of types, which have subtypes, and subtypes for the generator
|
||||
vector<vector<string>> m_typesAndSubtypesPaths;
|
||||
};
|
||||
} // namespace ftypes
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "indexer/feature.hpp"
|
||||
#include "indexer/feature_algo.hpp"
|
||||
#include "indexer/ftypes_matcher.hpp"
|
||||
#include "indexer/ftypes_subtypes.hpp"
|
||||
#include "indexer/road_shields_parser.hpp"
|
||||
|
||||
#include "geometry/mercator.hpp"
|
||||
@@ -120,7 +119,6 @@ std::string MapObject::GetLocalizedAllTypes(bool withMainType) const
|
||||
copy.SortBySpec();
|
||||
|
||||
auto const & isPoi = ftypes::IsPoiChecker::Instance();
|
||||
auto const & subtypes = ftypes::Subtypes::Instance();
|
||||
auto const & isDirectional = ftypes::IsDirectionalChecker::Instance();
|
||||
auto const & amenityChecker = ftypes::IsAmenityChecker::Instance();
|
||||
auto const & charingStationCarChecker = ftypes::IsCharingStationCarChecker::Instance();
|
||||
@@ -143,7 +141,7 @@ std::string MapObject::GetLocalizedAllTypes(bool withMainType) const
|
||||
}
|
||||
|
||||
// Ignore types that are not POI
|
||||
if (!isMainType && !isPoi(type) && !subtypes.IsTypeWithSubtypesOrSubtype(type) && !isDirectional(type))
|
||||
if (!isMainType && !isPoi(type) && !isDirectional(type))
|
||||
continue;
|
||||
|
||||
// Ignore general amenity
|
||||
|
||||
@@ -33,8 +33,7 @@ std::array<UniString, 11> const kAllowedMisprints = {
|
||||
};
|
||||
|
||||
static std::pair<UniString, UniString> const kPreprocessReplacements[] = {
|
||||
{MakeUniString("a. d."), MakeUniString("auf an den der")},
|
||||
{MakeUniString("a.d."), MakeUniString("auf an den der")}, // hacks to handle "(auf/an) (den/der)" in German
|
||||
{MakeUniString("a. d."), MakeUniString("an den")},
|
||||
{MakeUniString("arm. gen"), MakeUniString("armádneho generála")},
|
||||
{MakeUniString("atr'"), MakeUniString("ambohitr'")},
|
||||
{MakeUniString("a. v."), MakeUniString("asociación vecinal")},
|
||||
@@ -128,7 +127,6 @@ static std::pair<UniString, UniString> const kPreprocessReplacements[] = {
|
||||
{MakeUniString("пр-д"), MakeUniString("проезд")},
|
||||
{MakeUniString("пр-т"), MakeUniString("проспект")},
|
||||
{MakeUniString("р-н"), MakeUniString("район")},
|
||||
{MakeUniString("ж.к."), MakeUniString("жк")},
|
||||
{MakeUniString("আ/এ"), MakeUniString("আবাসিক এলাকা")},
|
||||
};
|
||||
|
||||
|
||||
@@ -287,8 +287,6 @@ 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);
|
||||
|
||||
@@ -320,7 +318,6 @@ void FillDetails(FeatureType & ft, std::string const & name, Result::Details & d
|
||||
append(elevation);
|
||||
append(cuisine);
|
||||
append(recycling);
|
||||
append(subtypes);
|
||||
append(fee);
|
||||
|
||||
details.m_description = std::move(description);
|
||||
|
||||
@@ -94,6 +94,7 @@ unordered_map<string, vector<string>> const kSynonyms = {
|
||||
{"accs", {"access"}},
|
||||
{"aceq", {"acequia"}},
|
||||
{"ach", {"ancien chemin"}},
|
||||
//{"a.d", {"auf der", "an der"}}, // unreachable
|
||||
{"adi", {"ambodi"}},
|
||||
{"adm", {"admirała", "admirał"}},
|
||||
{"afb", {"air force base"}},
|
||||
@@ -621,7 +622,7 @@ unordered_map<string, vector<string>> const kSynonyms = {
|
||||
{"hse", {"house"}},
|
||||
{"hs", {"haus", "high school"}},
|
||||
{"hst", {"haltestelle"}},
|
||||
{"ht", {"heights", "hinteres", "hinterer", "hinter", "hintere"}},
|
||||
{"ht", {"heights", "hinteres", "hinterer", "hinter…", "hintere"}},
|
||||
{"htl", {"höhere technische lehranstalt"}},
|
||||
{"hts", {"heights"}},
|
||||
{"htt", {"hütte"}},
|
||||
@@ -679,12 +680,12 @@ unordered_map<string, vector<string>> const kSynonyms = {
|
||||
{"kel", {"kelurahan"}},
|
||||
{"kga", {"kleingartenanlage"}},
|
||||
{"kgg", {"kagalang-galang"}},
|
||||
{"kg", {"katastralgemeinde", "kampong", "kogel"}},
|
||||
{"kg", {"katastralgemeinde", "…kogel", "kampong", "kogel"}},
|
||||
{"kgv", {"kleingartenverein"}},
|
||||
{"kh", {"krankenhaus"}},
|
||||
{"kj", {"kuja"}},
|
||||
{"k", {"kalea", "katu", "koło", "kolo", "kort", "korte"}},
|
||||
{"kl", {"konzentrationslager", "klein", "kleines", "kleiner", "kleine", "kylä"}},
|
||||
{"k", {"kalea", "katu", "koło", "kolo", "kort(e)"}},
|
||||
{"kl", {"konzentrationslager", "klein…", "kleines", "kleiner", "kleine", "kylä"}},
|
||||
{"knm", {"khu nghỉ mát"}},
|
||||
{"kol", {"kolonel", "kolonia"}},
|
||||
{"kon", {"koning", "koningin"}},
|
||||
@@ -1506,11 +1507,12 @@ void QueryParams::ClearStreetIndices()
|
||||
AdditionalCommonTokens()
|
||||
{
|
||||
char const * arr[] = {
|
||||
"a", "and", "s", "the", // English
|
||||
"am", "an", "auf", "der", "im", "und", "zum", // German
|
||||
"as", "d", "da", "das", "de", "del", "di", "do", "dos", "du", "e",
|
||||
"el", "et", "la", "las", "le", "les", "los", "o", "os", "y", // French, Italian, Portuguese, Spanish
|
||||
"в", "и", "за", "к", "на", "я" // Cyrillic
|
||||
"a", "and", "s", "the", // English
|
||||
"am", "an", "auf", "der", "im", "und", "zum", // German
|
||||
"as", "d", "da", "das", "de", "del", "di", "do",
|
||||
"dos", "du", "e", "el", "et", "la", "las", "le",
|
||||
"les", "los", "o", "os", "y", // French, Italian, Portuguese, Spanish
|
||||
"в", "и", "на", "я" // Cyrillic
|
||||
};
|
||||
for (char const * s : arr)
|
||||
m_strings.insert(NormalizeAndSimplifyString(s));
|
||||
|
||||
@@ -124,7 +124,6 @@ copy_resources(
|
||||
editor.config
|
||||
packed_polygons.bin
|
||||
patterns.txt
|
||||
subtypes.csv
|
||||
transit_colors.txt
|
||||
types.txt
|
||||
mapcss-mapping.csv
|
||||
|
||||
@@ -7,9 +7,6 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
272CA4462F126795005A3F5B /* ftypes_subtypes.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 272CA4442F126795005A3F5B /* ftypes_subtypes.hpp */; };
|
||||
272CA4472F126795005A3F5B /* ftypes_subtypes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 272CA4452F126795005A3F5B /* ftypes_subtypes.cpp */; };
|
||||
272CA44D2F12723B005A3F5B /* subtypes.csv in Resources */ = {isa = PBXBuildFile; fileRef = 272CA44C2F12723B005A3F5B /* subtypes.csv */; };
|
||||
27BCD5272E93E625002C50F0 /* feature_charge_sockets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27BCD5262E93E625002C50F0 /* feature_charge_sockets.cpp */; };
|
||||
27BCD5282E93E625002C50F0 /* feature_charge_sockets.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 27BCD5252E93E625002C50F0 /* feature_charge_sockets.hpp */; };
|
||||
27BCD52A2E93E670002C50F0 /* feature_charge_sockets_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 27BCD5292E93E670002C50F0 /* feature_charge_sockets_test.cpp */; };
|
||||
@@ -233,9 +230,6 @@
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
272CA4442F126795005A3F5B /* ftypes_subtypes.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ftypes_subtypes.hpp; sourceTree = "<group>"; };
|
||||
272CA4452F126795005A3F5B /* ftypes_subtypes.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ftypes_subtypes.cpp; sourceTree = "<group>"; };
|
||||
272CA44C2F12723B005A3F5B /* subtypes.csv */ = {isa = PBXFileReference; lastKnownFileType = text; name = subtypes.csv; path = ../../data/subtypes.csv; sourceTree = "<group>"; };
|
||||
27BCD5252E93E625002C50F0 /* feature_charge_sockets.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = feature_charge_sockets.hpp; sourceTree = "<group>"; };
|
||||
27BCD5262E93E625002C50F0 /* feature_charge_sockets.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = feature_charge_sockets.cpp; sourceTree = "<group>"; };
|
||||
27BCD5292E93E670002C50F0 /* feature_charge_sockets_test.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = feature_charge_sockets_test.cpp; sourceTree = "<group>"; };
|
||||
@@ -505,7 +499,6 @@
|
||||
3496AB9C1DC1FA5200C5DDBA /* drules_proto.bin */,
|
||||
3496ABA21DC1FA7200C5DDBA /* editor.config */,
|
||||
3496ABAE1DC1FAC900C5DDBA /* minsk-pass.mwm */,
|
||||
272CA44C2F12723B005A3F5B /* subtypes.csv */,
|
||||
3496AB961DC1FA2000C5DDBA /* types.txt */,
|
||||
);
|
||||
name = Resources;
|
||||
@@ -696,8 +689,6 @@
|
||||
3D74ABBB1EA67C1E0063A898 /* ftypes_mapping.hpp */,
|
||||
675340D51A3F540F00A0A8C3 /* ftypes_matcher.cpp */,
|
||||
675340D61A3F540F00A0A8C3 /* ftypes_matcher.hpp */,
|
||||
272CA4452F126795005A3F5B /* ftypes_subtypes.cpp */,
|
||||
272CA4442F126795005A3F5B /* ftypes_subtypes.hpp */,
|
||||
675340DB1A3F540F00A0A8C3 /* index_builder.cpp */,
|
||||
675340DC1A3F540F00A0A8C3 /* index_builder.hpp */,
|
||||
675340DF1A3F540F00A0A8C3 /* interval_index_builder.hpp */,
|
||||
@@ -824,7 +815,6 @@
|
||||
675341411A3F540F00A0A8C3 /* scales.hpp in Headers */,
|
||||
675341321A3F540F00A0A8C3 /* interval_index_builder.hpp in Headers */,
|
||||
40009062201F5CB000963E18 /* cell_value_pair.hpp in Headers */,
|
||||
272CA4462F126795005A3F5B /* ftypes_subtypes.hpp in Headers */,
|
||||
347F337C1C454242009758CC /* rank_table.hpp in Headers */,
|
||||
40D62CEF23F2E8BE009A20F5 /* dat_section_header.hpp in Headers */,
|
||||
F61F83071E4B187500B37B7A /* road_shields_parser.hpp in Headers */,
|
||||
@@ -945,7 +935,6 @@
|
||||
3496ABA31DC1FA7200C5DDBA /* editor.config in Resources */,
|
||||
3496AB9D1DC1FA5200C5DDBA /* drules_proto_clear.bin in Resources */,
|
||||
3496AB9E1DC1FA5200C5DDBA /* drules_proto_dark.bin in Resources */,
|
||||
272CA44D2F12723B005A3F5B /* subtypes.csv in Resources */,
|
||||
FA67C84F26BB36D700B33DCA /* categories_brands.txt in Resources */,
|
||||
FA67C84626BB356800B33DCA /* categories_cuisines.txt in Resources */,
|
||||
3496ABA11DC1FA5200C5DDBA /* drules_proto.bin in Resources */,
|
||||
@@ -1038,7 +1027,6 @@
|
||||
4043C0B924ACBA3300545FD8 /* transliteration_loader.cpp in Sources */,
|
||||
6753411C1A3F540F00A0A8C3 /* shared_load_info.cpp in Sources */,
|
||||
67BC92F41D21476500A4A378 /* string_slice.cpp in Sources */,
|
||||
272CA4472F126795005A3F5B /* ftypes_subtypes.cpp in Sources */,
|
||||
BBB7060F23E46E0100A7F29A /* isolines_info.cpp in Sources */,
|
||||
408FE47724FEB95600F5D06D /* metadata_serdes.cpp in Sources */,
|
||||
34583BCB1C88552100F94664 /* map_object.cpp in Sources */,
|
||||
|
||||
Reference in New Issue
Block a user