diff --git a/generator/generator_tests/osm_type_test.cpp b/generator/generator_tests/osm_type_test.cpp index a16d85c545..aca08a8c2d 100644 --- a/generator/generator_tests/osm_type_test.cpp +++ b/generator/generator_tests/osm_type_test.cpp @@ -155,22 +155,45 @@ UNIT_CLASS_TEST(TestWithClassificator, OsmType_Combined) UNIT_CLASS_TEST(TestWithClassificator, OsmType_Address) { - Tags const tags = { - { "addr:conscriptionnumber", "223" }, - { "addr:housenumber", "223/5" }, - { "addr:postcode", "11000" }, - { "addr:street", "Řetězová" }, - { "addr:streetnumber", "5" }, - { "source:addr", "uir_adr" }, - { "uir_adr:ADRESA_KOD", "21717036" } - }; + { + Tags const tags = { + { "addr:conscriptionnumber", "223" }, + { "addr:housenumber", "223/5" }, + { "addr:postcode", "11000" }, + { "addr:street", "Řetězová" }, + { "addr:streetnumber", "5" }, + { "source:addr", "uir_adr" }, + { "uir_adr:ADRESA_KOD", "21717036" } + }; - auto const params = GetFeatureBuilderParams(tags); + auto const params = GetFeatureBuilderParams(tags); - TEST_EQUAL(params.m_types.size(), 1, (params)); - TEST(params.IsTypeExist(GetType({"building", "address"})), ()); + TEST_EQUAL(params.m_types.size(), 1, (params)); + TEST(params.IsTypeExist(GetType({"building", "address"})), ()); - TEST_EQUAL(params.house.Get(), "223/5", ()); + TEST_EQUAL(params.house.Get(), "223/5", ()); + } + + { + Tags const tags = { + {"addr:city", "Zürich"}, + {"addr:housenumber", "41"}, + {"addr:postcode", "8050"}, + {"addr:street", "Leutschenbachstrasse"}, + {"entrance", "main"}, + {"survey:date", "2020-12-17"}, + {"wheelchair", "no"}, + }; + + auto const params = GetFeatureBuilderParams(tags); + + TEST_EQUAL(params.m_types.size(), 2, (params)); + TEST(params.IsTypeExist(GetType({"building", "address"})), ()); + TEST(params.IsTypeExist(GetType({"wheelchair", "no"})), ()); + TEST(!params.IsTypeExist(GetType({"entrance"})), ()); + + TEST_EQUAL(params.house.Get(), "41", ()); + } } UNIT_CLASS_TEST(TestWithClassificator, OsmType_PlaceState) diff --git a/generator/osm2type.cpp b/generator/osm2type.cpp index 97d07df2c3..e46d874e5e 100644 --- a/generator/osm2type.cpp +++ b/generator/osm2type.cpp @@ -231,6 +231,7 @@ public: Wlan, RailwayStation, SubwayStation, + WheelchairAny, WheelchairYes, BarrierGate, Toll, @@ -265,6 +266,7 @@ public: {Type::Wlan, {"internet_access", "wlan"}}, {Type::RailwayStation, {"railway", "station"}}, {Type::SubwayStation, {"railway", "station", "subway"}}, + {Type::WheelchairAny, {"wheelchair"}}, {Type::WheelchairYes, {"wheelchair", "yes"}}, {Type::BarrierGate, {"barrier", "gate"}}, {Type::Toll, {"hwtag", "toll"}}, @@ -717,7 +719,8 @@ void PostprocessElement(OsmElement * p, FeatureBuilderParams & params) { // Delete "entrance" type for house number (use it only with refs). // Add "address" type if we have house number but no valid types. - if (params.PopExactType(types.Get(CachedTypes::Type::Entrance))) + if (params.PopExactType(types.Get(CachedTypes::Type::Entrance)) || + (params.m_types.size() == 1 && params.IsTypeExist(types.Get(CachedTypes::Type::WheelchairAny), 1))) { params.name.Clear(); // If we have address (house name or number), we should assign valid type.