Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Kuznetsov <r.kuznetsow@gmail.com>2017-06-06 17:15:15 +0300
committerGitHub <noreply@github.com>2017-06-06 17:15:15 +0300
commit5253f4158be330438fbb51989b233cb95697b942 (patch)
tree10e782324a76db8e9936ac04bef186e77c94194b
parentb8ad04b02e90b1249d3c092cd6415a6c123e8704 (diff)
parentbfa9478db6722b5f2acc92b8962b9e54ef067676 (diff)
Merge pull request #6203 from milchakov/chairs_accessabilitybeta-850
[indexer] Wheelchair type info added into MapObject class
-rw-r--r--indexer/CMakeLists.txt1
-rw-r--r--indexer/indexer.pro1
-rw-r--r--indexer/indexer_tests/CMakeLists.txt1
-rw-r--r--indexer/indexer_tests/indexer_tests.pro1
-rw-r--r--indexer/indexer_tests/wheelchair_tests.cpp34
-rw-r--r--indexer/map_object.cpp5
-rw-r--r--indexer/map_object.hpp2
-rw-r--r--indexer/wheelchair.hpp55
-rw-r--r--xcode/indexer/indexer.xcodeproj/project.pbxproj16
9 files changed, 116 insertions, 0 deletions
diff --git a/indexer/CMakeLists.txt b/indexer/CMakeLists.txt
index e3f074ff67..8051eada66 100644
--- a/indexer/CMakeLists.txt
+++ b/indexer/CMakeLists.txt
@@ -127,6 +127,7 @@ set(
types_mapping.cpp
types_mapping.hpp
unique_index.hpp
+ wheelchair.hpp
)
set(
diff --git a/indexer/indexer.pro b/indexer/indexer.pro
index 2dfa56dbc6..6e3620ea7a 100644
--- a/indexer/indexer.pro
+++ b/indexer/indexer.pro
@@ -134,6 +134,7 @@ HEADERS += \
trie_reader.hpp \
types_mapping.hpp \
unique_index.hpp \
+ wheelchair.hpp \
OTHER_FILES += drules_struct.proto
diff --git a/indexer/indexer_tests/CMakeLists.txt b/indexer/indexer_tests/CMakeLists.txt
index 3fcf24f0d7..ffadc3d332 100644
--- a/indexer/indexer_tests/CMakeLists.txt
+++ b/indexer/indexer_tests/CMakeLists.txt
@@ -36,6 +36,7 @@ set(
test_type.cpp
trie_test.cpp
visibility_test.cpp
+ wheelchair_tests.cpp
)
omim_add_test(${PROJECT_NAME} ${SRC})
diff --git a/indexer/indexer_tests/indexer_tests.pro b/indexer/indexer_tests/indexer_tests.pro
index e324f2a352..78d6fe1d5f 100644
--- a/indexer/indexer_tests/indexer_tests.pro
+++ b/indexer/indexer_tests/indexer_tests.pro
@@ -59,3 +59,4 @@ SOURCES += \
test_type.cpp \
trie_test.cpp \
visibility_test.cpp \
+ wheelchair_tests.cpp \
diff --git a/indexer/indexer_tests/wheelchair_tests.cpp b/indexer/indexer_tests/wheelchair_tests.cpp
new file mode 100644
index 0000000000..642955596f
--- /dev/null
+++ b/indexer/indexer_tests/wheelchair_tests.cpp
@@ -0,0 +1,34 @@
+#include "testing/testing.hpp"
+
+#include "indexer/classificator.hpp"
+#include "indexer/classificator_loader.hpp"
+#include "indexer/wheelchair.hpp"
+
+UNIT_TEST(Wheelchair_GetType)
+{
+ classificator::Load();
+ Classificator const & c = classif();
+
+ feature::TypesHolder holder;
+ {
+ holder.Assign(c.GetTypeByPath({"wheelchair", "no"}));
+ TEST_EQUAL(wheelchair::Matcher::GetType(holder), wheelchair::Type::No, ());
+ }
+ {
+ holder.Assign(c.GetTypeByPath({"wheelchair", "yes"}));
+ TEST_EQUAL(wheelchair::Matcher::GetType(holder), wheelchair::Type::Yes, ());
+ }
+ {
+ holder.Assign(c.GetTypeByPath({"wheelchair", "limited"}));
+ TEST_EQUAL(wheelchair::Matcher::GetType(holder), wheelchair::Type::Limited, ());
+ }
+ {
+ holder.Assign(c.GetTypeByPath({"amenity", "dentist"}));
+ TEST_EQUAL(wheelchair::Matcher::GetType(holder), wheelchair::Type::No, ());
+ }
+ {
+ holder.Assign(c.GetTypeByPath({"amenity", "dentist"}));
+ holder.Add(c.GetTypeByPath({"wheelchair", "yes"}));
+ TEST_EQUAL(wheelchair::Matcher::GetType(holder), wheelchair::Type::Yes, ());
+ }
+}
diff --git a/indexer/map_object.cpp b/indexer/map_object.cpp
index 8ab26b6dea..3db6a7e40c 100644
--- a/indexer/map_object.cpp
+++ b/indexer/map_object.cpp
@@ -198,6 +198,11 @@ string MapObject::GetBuildingLevels() const
return m_metadata.Get(feature::Metadata::FMD_BUILDING_LEVELS);
}
+wheelchair::Type MapObject::GetWheelchairType() const
+{
+ return wheelchair::Matcher::GetType(m_types);
+}
+
feature::Metadata const & MapObject::GetMetadata() const { return m_metadata; }
bool MapObject::IsPointType() const { return m_geomType == feature::EGeomType::GEOM_POINT; }
bool MapObject::IsBuilding() const { return ftypes::IsBuildingChecker::Instance()(m_types); }
diff --git a/indexer/map_object.hpp b/indexer/map_object.hpp
index 23c408b6ab..b144baa8b2 100644
--- a/indexer/map_object.hpp
+++ b/indexer/map_object.hpp
@@ -3,6 +3,7 @@
#include "indexer/feature_data.hpp"
#include "indexer/feature_decl.hpp"
#include "indexer/feature_meta.hpp"
+#include "indexer/wheelchair.hpp"
#include "geometry/latlon.hpp"
#include "geometry/mercator.hpp"
@@ -88,6 +89,7 @@ public:
string GetWikipediaLink() const;
string GetFlats() const;
string GetBuildingLevels() const;
+ wheelchair::Type GetWheelchairType() const;
// TODO(Vlad, yunikkk): Use Props enum + getters instead of direct metadata access.
// TODO: Remove this method.
diff --git a/indexer/wheelchair.hpp b/indexer/wheelchair.hpp
new file mode 100644
index 0000000000..815094f186
--- /dev/null
+++ b/indexer/wheelchair.hpp
@@ -0,0 +1,55 @@
+#pragma once
+
+#include "indexer/feature.hpp"
+#include "indexer/feature_data.hpp"
+#include "indexer/ftypes_mapping.hpp"
+
+#include <cstdint>
+#include <initializer_list>
+#include <string>
+
+namespace wheelchair
+{
+enum class Type
+{
+ No,
+ Yes,
+ Limited
+};
+
+inline std::string DebugPrint(Type wheelchair)
+{
+ switch (wheelchair)
+ {
+ case Type::No: return "No";
+ case Type::Yes: return "Yes";
+ case Type::Limited: return "Limited";
+ }
+}
+
+class Matcher
+{
+public:
+ static Type GetType(feature::TypesHolder const & types)
+ {
+ static Matcher instance;
+ auto const it = instance.m_matcher.Find(types);
+ if (!instance.m_matcher.IsValid(it))
+ return Type::No;
+
+ return it->second;
+ }
+
+private:
+ using TypesInitializer = std::initializer_list<std::initializer_list<char const *>>;
+
+ Matcher()
+ {
+ m_matcher.Append<TypesInitializer>({{"wheelchair", "no"}}, Type::No);
+ m_matcher.Append<TypesInitializer>({{"wheelchair", "yes"}}, Type::Yes);
+ m_matcher.Append<TypesInitializer>({{"wheelchair", "limited"}}, Type::Limited);
+ }
+
+ ftypes::HashMapMatcher<uint32_t, Type> m_matcher;
+};
+} // namespace wheelchair
diff --git a/xcode/indexer/indexer.xcodeproj/project.pbxproj b/xcode/indexer/indexer.xcodeproj/project.pbxproj
index 71ca52b3b3..1bebc96b88 100644
--- a/xcode/indexer/indexer.xcodeproj/project.pbxproj
+++ b/xcode/indexer/indexer.xcodeproj/project.pbxproj
@@ -42,6 +42,10 @@
34AF87E61DBE565F00E5E7DC /* helpers.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 34AF87E41DBE565F00E5E7DC /* helpers.hpp */; };
34AF87E71DBE567C00E5E7DC /* libindexer_tests_support.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 34AF87D71DBE561400E5E7DC /* libindexer_tests_support.a */; };
34AF87E81DBE570200E5E7DC /* helpers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 34AF87E31DBE565F00E5E7DC /* helpers.cpp */; };
+ 3D452AF61EE6D3A0009EAB9B /* wheelchair.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3D452AF51EE6D3A0009EAB9B /* wheelchair.hpp */; };
+ 3D452AFA1EE6D9F5009EAB9B /* wheelchair_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D452AF71EE6D9F5009EAB9B /* wheelchair_tests.cpp */; };
+ 3D452AFB1EE6D9F5009EAB9B /* feature_names_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D452AF81EE6D9F5009EAB9B /* feature_names_test.cpp */; };
+ 3D452AFC1EE6D9F5009EAB9B /* centers_table_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D452AF91EE6D9F5009EAB9B /* centers_table_test.cpp */; };
3D489BC61D3D220F0052AA38 /* editable_map_object_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D489BA71D3D1F8A0052AA38 /* editable_map_object_test.cpp */; };
3D489BC71D3D22150052AA38 /* features_vector_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D489BA81D3D1F8A0052AA38 /* features_vector_test.cpp */; };
3D489BC81D3D22190052AA38 /* string_slice_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D489BA91D3D1F8A0052AA38 /* string_slice_tests.cpp */; };
@@ -263,6 +267,10 @@
34AF87D71DBE561400E5E7DC /* libindexer_tests_support.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libindexer_tests_support.a; sourceTree = BUILT_PRODUCTS_DIR; };
34AF87E31DBE565F00E5E7DC /* helpers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = helpers.cpp; sourceTree = "<group>"; };
34AF87E41DBE565F00E5E7DC /* helpers.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = helpers.hpp; sourceTree = "<group>"; };
+ 3D452AF51EE6D3A0009EAB9B /* wheelchair.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = wheelchair.hpp; sourceTree = "<group>"; };
+ 3D452AF71EE6D9F5009EAB9B /* wheelchair_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wheelchair_tests.cpp; sourceTree = "<group>"; };
+ 3D452AF81EE6D9F5009EAB9B /* feature_names_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = feature_names_test.cpp; sourceTree = "<group>"; };
+ 3D452AF91EE6D9F5009EAB9B /* centers_table_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = centers_table_test.cpp; sourceTree = "<group>"; };
3D489BA71D3D1F8A0052AA38 /* editable_map_object_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = editable_map_object_test.cpp; sourceTree = "<group>"; };
3D489BA81D3D1F8A0052AA38 /* features_vector_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = features_vector_test.cpp; sourceTree = "<group>"; };
3D489BA91D3D1F8A0052AA38 /* string_slice_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = string_slice_tests.cpp; sourceTree = "<group>"; };
@@ -563,6 +571,9 @@
670C60F81AB0657700C38A8C /* indexer_tests */ = {
isa = PBXGroup;
children = (
+ 3D452AF71EE6D9F5009EAB9B /* wheelchair_tests.cpp */,
+ 3D452AF81EE6D9F5009EAB9B /* feature_names_test.cpp */,
+ 3D452AF91EE6D9F5009EAB9B /* centers_table_test.cpp */,
45C108AF1E9CFE3E000FE1F6 /* polyline_point_to_int64_test.cpp */,
3D489BF11D4F87740052AA38 /* osm_editor_test.cpp */,
3D489BF21D4F87740052AA38 /* osm_editor_test.hpp */,
@@ -639,6 +650,7 @@
6753409C1A3F53CB00A0A8C3 /* indexer */ = {
isa = PBXGroup;
children = (
+ 3D452AF51EE6D3A0009EAB9B /* wheelchair.hpp */,
3D74ABBB1EA67C1E0063A898 /* ftypes_mapping.hpp */,
3D928F651D50F9FE001670E0 /* index_helpers.cpp */,
3D928F661D50F9FE001670E0 /* index_helpers.hpp */,
@@ -843,6 +855,7 @@
6753414B1A3F540F00A0A8C3 /* tesselator_decl.hpp in Headers */,
F61F83071E4B187500B37B7A /* road_shields_parser.hpp in Headers */,
347F33801C454242009758CC /* trie_reader.hpp in Headers */,
+ 3D452AF61EE6D3A0009EAB9B /* wheelchair.hpp in Headers */,
675341191A3F540F00A0A8C3 /* feature_decl.hpp in Headers */,
674125141B4C02F100A3E828 /* map_style_reader.hpp in Headers */,
675341221A3F540F00A0A8C3 /* feature_utils.hpp in Headers */,
@@ -1054,6 +1067,7 @@
6753414D1A3F540F00A0A8C3 /* types_mapping.cpp in Sources */,
6753412A1A3F540F00A0A8C3 /* geometry_coding.cpp in Sources */,
34583BC71C88552100F94664 /* cuisines.cpp in Sources */,
+ 3D452AFA1EE6D9F5009EAB9B /* wheelchair_tests.cpp in Sources */,
675341121A3F540F00A0A8C3 /* feature_algo.cpp in Sources */,
675341211A3F540F00A0A8C3 /* feature_utils.cpp in Sources */,
675341231A3F540F00A0A8C3 /* feature_visibility.cpp in Sources */,
@@ -1070,6 +1084,8 @@
6753412C1A3F540F00A0A8C3 /* geometry_serialization.cpp in Sources */,
F61F83061E4B187500B37B7A /* road_shields_parser.cpp in Sources */,
670EE56C1B60033A001E8064 /* features_vector.cpp in Sources */,
+ 3D452AFB1EE6D9F5009EAB9B /* feature_names_test.cpp in Sources */,
+ 3D452AFC1EE6D9F5009EAB9B /* centers_table_test.cpp in Sources */,
34664CF31D49FEC1003D7096 /* altitude_loader.cpp in Sources */,
6726C1D11A49DAAC005EEA39 /* feature_meta.cpp in Sources */,
6753411C1A3F540F00A0A8C3 /* feature_loader_base.cpp in Sources */,