From d1ad3e14711e392fcdf6c3ec20bedfee9640a134 Mon Sep 17 00:00:00 2001 From: ivanPyrohivskyi Date: Thu, 26 Sep 2024 21:48:08 +0300 Subject: [PATCH 1/6] Read tagGroups (cities) --- CMakeLists.txt | 2 +- include/OsmAndCore/Data/Amenity.h | 4 + include/OsmAndCore/Data/ObfPoiSectionInfo.h | 13 + protos/OBF.pb.cc | 861 ++++++++++++++++++-- protos/OBF.pb.h | 423 +++++++++- src/Data/Amenity.cpp | 26 + src/Data/ObfPoiSectionInfo.cpp | 20 + src/Data/ObfPoiSectionReader_P.cpp | 199 ++++- src/Data/ObfPoiSectionReader_P.h | 18 +- 9 files changed, 1459 insertions(+), 107 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 629a3cd29..b5ffa9734 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ project(OsmAndCore) -# Bump this number each time a new source file is committed to repository, source file removed from repository or renamed: 187 +# Bump this number each time a new source file is committed to repository, source file removed from repository or renamed: 188 set(target_specific_sources "") set(target_specific_public_definitions "") diff --git a/include/OsmAndCore/Data/Amenity.h b/include/OsmAndCore/Data/Amenity.h index 97b74a6dd..f440ea1c4 100644 --- a/include/OsmAndCore/Data/Amenity.h +++ b/include/OsmAndCore/Data/Amenity.h @@ -21,6 +21,7 @@ namespace OsmAnd { class ObfPoiSectionInfo; struct ObfPoiSectionSubtype; + struct TagValue; class OSMAND_CORE_API Amenity Q_DECL_FINAL { @@ -46,6 +47,7 @@ namespace OsmAnd }; private: + QHash> tagGroups; protected: public: Amenity(const std::shared_ptr& obfSection); @@ -72,6 +74,8 @@ namespace OsmAnd const QList< std::shared_ptr >& input); QString getName(const QString lang, bool transliterate) const; + void addTagGroup(int id, QList tagValues); + QString getCityFromTagGroups(QString lang) const; }; } diff --git a/include/OsmAndCore/Data/ObfPoiSectionInfo.h b/include/OsmAndCore/Data/ObfPoiSectionInfo.h index 6755e55e4..05f7a286b 100644 --- a/include/OsmAndCore/Data/ObfPoiSectionInfo.h +++ b/include/OsmAndCore/Data/ObfPoiSectionInfo.h @@ -11,6 +11,7 @@ #include #include #include +#include namespace OsmAnd { @@ -76,6 +77,15 @@ namespace OsmAnd friend class OsmAnd::ObfPoiSectionReader_P; }; + typedef OsmAnd::QuadTree BBoxIndexTree; + + struct TagValue + { + QString tag; + QString value; + TagValue(QString tag, QString value); + }; + class ObfPoiSectionInfo_P; class OSMAND_CORE_API ObfPoiSectionInfo : public ObfSectionInfo { @@ -93,9 +103,12 @@ namespace OsmAnd uint32_t nameIndexInnerOffset; uint32_t subtypesInnerOffset; uint32_t firstBoxInnerOffset; + mutable QHash> tagGroups; + mutable BBoxIndexTree bboxIndexCache; std::shared_ptr getCategories() const; std::shared_ptr getSubtypes() const; + QList getTagValues(int id) const; friend class OsmAnd::ObfPoiSectionReader_P; }; diff --git a/protos/OBF.pb.cc b/protos/OBF.pb.cc index 9ec978f6c..823f365ee 100644 --- a/protos/OBF.pb.cc +++ b/protos/OBF.pb.cc @@ -136,6 +136,12 @@ const ::google::protobuf::internal::GeneratedMessageReflection* const ::google::protobuf::Descriptor* OsmAndPoiSubtype_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* OsmAndPoiSubtype_reflection_ = NULL; +const ::google::protobuf::Descriptor* OsmAndPoiTagGroup_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + OsmAndPoiTagGroup_reflection_ = NULL; +const ::google::protobuf::Descriptor* OsmAndPoiTagGroups_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + OsmAndPoiTagGroups_reflection_ = NULL; const ::google::protobuf::Descriptor* OsmAndPoiBox_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* OsmAndPoiBox_reflection_ = NULL; @@ -930,12 +936,45 @@ void protobuf_AssignDesc_OBF_2eproto() { ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(OsmAndPoiSubtype)); - OsmAndPoiBox_descriptor_ = file->message_type(32); - static const int OsmAndPoiBox_offsets_[6] = { + OsmAndPoiTagGroup_descriptor_ = file->message_type(32); + static const int OsmAndPoiTagGroup_offsets_[2] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiTagGroup, id_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiTagGroup, tagvalues_), + }; + OsmAndPoiTagGroup_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + OsmAndPoiTagGroup_descriptor_, + OsmAndPoiTagGroup::default_instance_, + OsmAndPoiTagGroup_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiTagGroup, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiTagGroup, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(OsmAndPoiTagGroup)); + OsmAndPoiTagGroups_descriptor_ = file->message_type(33); + static const int OsmAndPoiTagGroups_offsets_[2] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiTagGroups, ids_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiTagGroups, groups_), + }; + OsmAndPoiTagGroups_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + OsmAndPoiTagGroups_descriptor_, + OsmAndPoiTagGroups::default_instance_, + OsmAndPoiTagGroups_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiTagGroups, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiTagGroups, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(OsmAndPoiTagGroups)); + OsmAndPoiBox_descriptor_ = file->message_type(34); + static const int OsmAndPoiBox_offsets_[7] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiBox, zoom_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiBox, left_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiBox, top_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiBox, categories_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiBox, taggroups_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiBox, subboxes_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiBox, shifttodata_), }; @@ -950,7 +989,7 @@ void protobuf_AssignDesc_OBF_2eproto() { ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(OsmAndPoiBox)); - OsmAndPoiCategories_descriptor_ = file->message_type(33); + OsmAndPoiCategories_descriptor_ = file->message_type(35); static const int OsmAndPoiCategories_offsets_[2] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiCategories, categories_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiCategories, subcategories_), @@ -966,7 +1005,7 @@ void protobuf_AssignDesc_OBF_2eproto() { ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(OsmAndPoiCategories)); - OsmAndPoiBoxData_descriptor_ = file->message_type(34); + OsmAndPoiBoxData_descriptor_ = file->message_type(36); static const int OsmAndPoiBoxData_offsets_[4] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiBoxData, zoom_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiBoxData, x_), @@ -984,8 +1023,8 @@ void protobuf_AssignDesc_OBF_2eproto() { ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(OsmAndPoiBoxData)); - OsmAndPoiBoxDataAtom_descriptor_ = file->message_type(35); - static const int OsmAndPoiBoxDataAtom_offsets_[14] = { + OsmAndPoiBoxDataAtom_descriptor_ = file->message_type(37); + static const int OsmAndPoiBoxDataAtom_offsets_[15] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiBoxDataAtom, dx_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiBoxDataAtom, dy_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiBoxDataAtom, categories_), @@ -1000,6 +1039,7 @@ void protobuf_AssignDesc_OBF_2eproto() { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiBoxDataAtom, textcategories_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiBoxDataAtom, textvalues_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiBoxDataAtom, precisionxy_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndPoiBoxDataAtom, taggroups_), }; OsmAndPoiBoxDataAtom_reflection_ = new ::google::protobuf::internal::GeneratedMessageReflection( @@ -1012,7 +1052,7 @@ void protobuf_AssignDesc_OBF_2eproto() { ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(OsmAndPoiBoxDataAtom)); - IdTable_descriptor_ = file->message_type(36); + IdTable_descriptor_ = file->message_type(38); static const int IdTable_offsets_[1] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(IdTable, routeid_), }; @@ -1027,7 +1067,7 @@ void protobuf_AssignDesc_OBF_2eproto() { ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(IdTable)); - RestrictionData_descriptor_ = file->message_type(37); + RestrictionData_descriptor_ = file->message_type(39); static const int RestrictionData_offsets_[4] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RestrictionData, type_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RestrictionData, from_), @@ -1045,7 +1085,7 @@ void protobuf_AssignDesc_OBF_2eproto() { ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(RestrictionData)); - RouteData_descriptor_ = file->message_type(38); + RouteData_descriptor_ = file->message_type(40); static const int RouteData_offsets_[6] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RouteData, points_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RouteData, pointtypes_), @@ -1065,7 +1105,7 @@ void protobuf_AssignDesc_OBF_2eproto() { ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(RouteData)); - OsmAndRoutingIndex_descriptor_ = file->message_type(39); + OsmAndRoutingIndex_descriptor_ = file->message_type(41); static const int OsmAndRoutingIndex_offsets_[5] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndRoutingIndex, name_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndRoutingIndex, rules_), @@ -1139,7 +1179,7 @@ void protobuf_AssignDesc_OBF_2eproto() { ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(OsmAndRoutingIndex_RouteDataBlock)); - OsmAndHHRoutingIndex_descriptor_ = file->message_type(40); + OsmAndHHRoutingIndex_descriptor_ = file->message_type(42); static const int OsmAndHHRoutingIndex_offsets_[6] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndHHRoutingIndex, edition_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndHHRoutingIndex, profile_), @@ -1240,7 +1280,7 @@ void protobuf_AssignDesc_OBF_2eproto() { ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(OsmAndHHRoutingIndex_HHRoutePointSegments)); - OsmAndOwner_descriptor_ = file->message_type(41); + OsmAndOwner_descriptor_ = file->message_type(43); static const int OsmAndOwner_offsets_[4] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndOwner, name_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OsmAndOwner, resource_), @@ -1346,6 +1386,10 @@ void protobuf_RegisterTypes(const ::std::string&) { OsmAndSubtypesTable_descriptor_, &OsmAndSubtypesTable::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( OsmAndPoiSubtype_descriptor_, &OsmAndPoiSubtype::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + OsmAndPoiTagGroup_descriptor_, &OsmAndPoiTagGroup::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + OsmAndPoiTagGroups_descriptor_, &OsmAndPoiTagGroups::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( OsmAndPoiBox_descriptor_, &OsmAndPoiBox::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( @@ -1461,6 +1505,10 @@ void protobuf_ShutdownFile_OBF_2eproto() { delete OsmAndSubtypesTable_reflection_; delete OsmAndPoiSubtype::default_instance_; delete OsmAndPoiSubtype_reflection_; + delete OsmAndPoiTagGroup::default_instance_; + delete OsmAndPoiTagGroup_reflection_; + delete OsmAndPoiTagGroups::default_instance_; + delete OsmAndPoiTagGroups_reflection_; delete OsmAndPoiBox::default_instance_; delete OsmAndPoiBox_reflection_; delete OsmAndPoiCategories::default_instance_; @@ -1658,75 +1706,80 @@ void protobuf_AddDesc_OBF_2eproto() { "mAndPoiSubtype\"\205\001\n\020OsmAndPoiSubtype\022\014\n\004n" "ame\030\001 \002(\t\022\017\n\007tagname\030\002 \001(\t\022\016\n\006isText\030\003 \002" "(\010\022\021\n\tfrequency\030\005 \001(\r\022\031\n\021subtypeValuesSi" - "ze\030\006 \001(\r\022\024\n\014subtypeValue\030\010 \003(\t\"\255\001\n\014OsmAn" - "dPoiBox\022\014\n\004zoom\030\001 \002(\r\022\014\n\004left\030\002 \002(\021\022\013\n\003t" - "op\030\003 \002(\021\0223\n\ncategories\030\004 \001(\0132\037.OsmAnd.OB" - "F.OsmAndPoiCategories\022*\n\010subBoxes\030\n \003(\0132" - "\030.OsmAnd.OBF.OsmAndPoiBox\022\023\n\013shiftToData" - "\030\016 \001(\007\"@\n\023OsmAndPoiCategories\022\022\n\ncategor" - "ies\030\003 \003(\r\022\025\n\rsubcategories\030\005 \003(\r\"i\n\020OsmA" - "ndPoiBoxData\022\014\n\004zoom\030\001 \001(\r\022\t\n\001x\030\002 \001(\r\022\t\n" - "\001y\030\003 \001(\r\0221\n\007poiData\030\005 \003(\0132 .OsmAnd.OBF.O" - "smAndPoiBoxDataAtom\"\205\002\n\024OsmAndPoiBoxData" - "Atom\022\n\n\002dx\030\002 \002(\021\022\n\n\002dy\030\003 \002(\021\022\022\n\ncategori" - "es\030\004 \003(\r\022\025\n\rsubcategories\030\005 \003(\r\022\014\n\004name\030" - "\006 \001(\t\022\016\n\006nameEn\030\007 \001(\t\022\n\n\002id\030\010 \001(\004\022\024\n\014ope" - "ningHours\030\n \001(\t\022\014\n\004site\030\013 \001(\t\022\r\n\005phone\030\014" - " \001(\t\022\014\n\004note\030\r \001(\t\022\026\n\016textCategories\030\016 \003" - "(\r\022\022\n\ntextValues\030\017 \003(\t\022\023\n\013precisionXY\030\020 " - "\001(\005\"\032\n\007IdTable\022\017\n\007routeId\030\001 \003(\022\"F\n\017Restr" - "ictionData\022\014\n\004type\030\001 \002(\005\022\014\n\004from\030\002 \002(\005\022\n" - "\n\002to\030\003 \002(\005\022\013\n\003via\030\004 \001(\005\"x\n\tRouteData\022\016\n\006" - "points\030\001 \002(\014\022\022\n\npointTypes\030\004 \001(\014\022\022\n\npoin" - "tNames\030\005 \001(\014\022\r\n\005types\030\007 \002(\014\022\017\n\007routeId\030\014" - " \002(\005\022\023\n\013stringNames\030\016 \001(\014\"\304\005\n\022OsmAndRout" - "ingIndex\022\014\n\004name\030\001 \002(\t\022\?\n\005rules\030\002 \003(\01320." - "OsmAnd.OBF.OsmAndRoutingIndex.RouteEncod" - "ingRule\022>\n\trootBoxes\030\003 \003(\0132+.OsmAnd.OBF." - "OsmAndRoutingIndex.RouteDataBox\022A\n\014basem" - "apBoxes\030\004 \003(\0132+.OsmAnd.OBF.OsmAndRouting" - "Index.RouteDataBox\022=\n\006blocks\030\005 \003(\0132-.Osm" - "And.OBF.OsmAndRoutingIndex.RouteDataBloc" - "k\032;\n\021RouteEncodingRule\022\013\n\003tag\030\003 \002(\t\022\r\n\005v" - "alue\030\005 \002(\t\022\n\n\002id\030\007 \001(\r\032\231\001\n\014RouteDataBox\022" - "\014\n\004left\030\001 \002(\021\022\r\n\005right\030\002 \002(\021\022\013\n\003top\030\003 \002(" - "\021\022\016\n\006bottom\030\004 \002(\021\022\023\n\013shiftToData\030\005 \001(\007\022:" - "\n\005boxes\030\007 \003(\0132+.OsmAnd.OBF.OsmAndRouting" - "Index.RouteDataBox\032\303\001\n\016RouteDataBlock\022$\n" - "\007idTable\030\005 \001(\0132\023.OsmAnd.OBF.IdTable\022*\n\013d" - "ataObjects\030\006 \003(\0132\025.OsmAnd.OBF.RouteData\022" - "1\n\014restrictions\030\007 \003(\0132\033.OsmAnd.OBF.Restr" - "ictionData\022,\n\013stringTable\030\010 \001(\0132\027.OsmAnd" - ".OBF.StringTable\"\231\010\n\024OsmAndHHRoutingInde" - "x\022\017\n\007edition\030\001 \002(\003\022\017\n\007profile\030\002 \002(\t\022\025\n\rp" - "rofileParams\030\003 \003(\t\022/\n\016tagValuesTable\030\004 \001" - "(\0132\027.OsmAnd.OBF.StringTable\022E\n\npointBoxe" - "s\030\005 \002(\01321.OsmAnd.OBF.OsmAndHHRoutingInde" - "x.HHRoutePointsBox\022L\n\rpointSegments\030\006 \003(" - "\01325.OsmAnd.OBF.OsmAndHHRoutingIndex.HHRo" - "uteBlockSegments\032\324\001\n\020HHRoutePointsBox\022\014\n" - "\004left\030\002 \002(\021\022\r\n\005right\030\003 \002(\021\022\013\n\003top\030\004 \002(\021\022" - "\016\n\006bottom\030\005 \002(\021\022@\n\005boxes\030\006 \003(\01321.OsmAnd." - "OBF.OsmAndHHRoutingIndex.HHRoutePointsBo" - "x\022D\n\006points\030\007 \003(\01324.OsmAnd.OBF.OsmAndHHR" - "outingIndex.HHRouteNetworkPoint\032\366\001\n\023HHRo" - "uteNetworkPoint\022\n\n\002id\030\001 \002(\005\022\n\n\002dx\030\002 \002(\021\022" - "\n\n\002dy\030\003 \002(\021\022\020\n\010globalId\030\004 \002(\005\022\016\n\006roadId\030" - "\005 \002(\003\022\031\n\021roadStartEndIndex\030\006 \002(\005\022\021\n\tclus" - "terId\030\007 \001(\005\022\023\n\013dualPointId\030\010 \001(\005\022\025\n\rdual" - "ClusterId\030\t \001(\005\022\022\n\nprofileIds\030\n \003(\005\022\022\n\np" - "artialInd\030\013 \001(\005\022\027\n\013tagValueIds\030\014 \003(\005B\002\020\001" - "\032\360\001\n\024HHRouteBlockSegments\022\024\n\014idRangeStar" - "t\030\001 \002(\005\022\025\n\ridRangeLength\030\002 \002(\005\022\021\n\tprofil" - "eId\030\003 \001(\005\022J\n\013innerBlocks\030\006 \003(\01325.OsmAnd." - "OBF.OsmAndHHRoutingIndex.HHRouteBlockSeg" - "ments\022L\n\rpointSegments\030\004 \003(\01325.OsmAnd.OB" - "F.OsmAndHHRoutingIndex.HHRoutePointSegme" - "nts\032\?\n\024HHRoutePointSegments\022\022\n\nsegmentsI" - "n\030\002 \002(\014\022\023\n\013segmentsOut\030\003 \002(\014\"T\n\013OsmAndOw" - "ner\022\014\n\004name\030\001 \002(\t\022\020\n\010resource\030\002 \001(\t\022\023\n\013d" - "escription\030\003 \001(\t\022\020\n\010pluginid\030\004 \001(\tB\036\n\021ne" - "t.osmand.binaryB\tOsmandOdb", 8906); + "ze\030\006 \001(\r\022\024\n\014subtypeValue\030\010 \003(\t\"2\n\021OsmAnd" + "PoiTagGroup\022\n\n\002id\030\001 \002(\r\022\021\n\ttagValues\030\005 \003" + "(\t\"T\n\022OsmAndPoiTagGroups\022\017\n\003ids\030\002 \003(\rB\002\020" + "\001\022-\n\006groups\030\005 \003(\0132\035.OsmAnd.OBF.OsmAndPoi" + "TagGroup\"\340\001\n\014OsmAndPoiBox\022\014\n\004zoom\030\001 \002(\r\022" + "\014\n\004left\030\002 \002(\021\022\013\n\003top\030\003 \002(\021\0223\n\ncategories" + "\030\004 \001(\0132\037.OsmAnd.OBF.OsmAndPoiCategories\022" + "1\n\ttagGroups\030\010 \001(\0132\036.OsmAnd.OBF.OsmAndPo" + "iTagGroups\022*\n\010subBoxes\030\n \003(\0132\030.OsmAnd.OB" + "F.OsmAndPoiBox\022\023\n\013shiftToData\030\016 \001(\007\"@\n\023O" + "smAndPoiCategories\022\022\n\ncategories\030\003 \003(\r\022\025" + "\n\rsubcategories\030\005 \003(\r\"i\n\020OsmAndPoiBoxDat" + "a\022\014\n\004zoom\030\001 \001(\r\022\t\n\001x\030\002 \001(\r\022\t\n\001y\030\003 \001(\r\0221\n" + "\007poiData\030\005 \003(\0132 .OsmAnd.OBF.OsmAndPoiBox" + "DataAtom\"\234\002\n\024OsmAndPoiBoxDataAtom\022\n\n\002dx\030" + "\002 \002(\021\022\n\n\002dy\030\003 \002(\021\022\022\n\ncategories\030\004 \003(\r\022\025\n" + "\rsubcategories\030\005 \003(\r\022\014\n\004name\030\006 \001(\t\022\016\n\006na" + "meEn\030\007 \001(\t\022\n\n\002id\030\010 \001(\004\022\024\n\014openingHours\030\n" + " \001(\t\022\014\n\004site\030\013 \001(\t\022\r\n\005phone\030\014 \001(\t\022\014\n\004not" + "e\030\r \001(\t\022\026\n\016textCategories\030\016 \003(\r\022\022\n\ntextV" + "alues\030\017 \003(\t\022\023\n\013precisionXY\030\020 \001(\005\022\025\n\ttagG" + "roups\030\021 \003(\rB\002\020\001\"\032\n\007IdTable\022\017\n\007routeId\030\001 " + "\003(\022\"F\n\017RestrictionData\022\014\n\004type\030\001 \002(\005\022\014\n\004" + "from\030\002 \002(\005\022\n\n\002to\030\003 \002(\005\022\013\n\003via\030\004 \001(\005\"x\n\tR" + "outeData\022\016\n\006points\030\001 \002(\014\022\022\n\npointTypes\030\004" + " \001(\014\022\022\n\npointNames\030\005 \001(\014\022\r\n\005types\030\007 \002(\014\022" + "\017\n\007routeId\030\014 \002(\005\022\023\n\013stringNames\030\016 \001(\014\"\304\005" + "\n\022OsmAndRoutingIndex\022\014\n\004name\030\001 \002(\t\022\?\n\005ru" + "les\030\002 \003(\01320.OsmAnd.OBF.OsmAndRoutingInde" + "x.RouteEncodingRule\022>\n\trootBoxes\030\003 \003(\0132+" + ".OsmAnd.OBF.OsmAndRoutingIndex.RouteData" + "Box\022A\n\014basemapBoxes\030\004 \003(\0132+.OsmAnd.OBF.O" + "smAndRoutingIndex.RouteDataBox\022=\n\006blocks" + "\030\005 \003(\0132-.OsmAnd.OBF.OsmAndRoutingIndex.R" + "outeDataBlock\032;\n\021RouteEncodingRule\022\013\n\003ta" + "g\030\003 \002(\t\022\r\n\005value\030\005 \002(\t\022\n\n\002id\030\007 \001(\r\032\231\001\n\014R" + "outeDataBox\022\014\n\004left\030\001 \002(\021\022\r\n\005right\030\002 \002(\021" + "\022\013\n\003top\030\003 \002(\021\022\016\n\006bottom\030\004 \002(\021\022\023\n\013shiftTo" + "Data\030\005 \001(\007\022:\n\005boxes\030\007 \003(\0132+.OsmAnd.OBF.O" + "smAndRoutingIndex.RouteDataBox\032\303\001\n\016Route" + "DataBlock\022$\n\007idTable\030\005 \001(\0132\023.OsmAnd.OBF." + "IdTable\022*\n\013dataObjects\030\006 \003(\0132\025.OsmAnd.OB" + "F.RouteData\0221\n\014restrictions\030\007 \003(\0132\033.OsmA" + "nd.OBF.RestrictionData\022,\n\013stringTable\030\010 " + "\001(\0132\027.OsmAnd.OBF.StringTable\"\231\010\n\024OsmAndH" + "HRoutingIndex\022\017\n\007edition\030\001 \002(\003\022\017\n\007profil" + "e\030\002 \002(\t\022\025\n\rprofileParams\030\003 \003(\t\022/\n\016tagVal" + "uesTable\030\004 \001(\0132\027.OsmAnd.OBF.StringTable\022" + "E\n\npointBoxes\030\005 \002(\01321.OsmAnd.OBF.OsmAndH" + "HRoutingIndex.HHRoutePointsBox\022L\n\rpointS" + "egments\030\006 \003(\01325.OsmAnd.OBF.OsmAndHHRouti" + "ngIndex.HHRouteBlockSegments\032\324\001\n\020HHRoute" + "PointsBox\022\014\n\004left\030\002 \002(\021\022\r\n\005right\030\003 \002(\021\022\013" + "\n\003top\030\004 \002(\021\022\016\n\006bottom\030\005 \002(\021\022@\n\005boxes\030\006 \003" + "(\01321.OsmAnd.OBF.OsmAndHHRoutingIndex.HHR" + "outePointsBox\022D\n\006points\030\007 \003(\01324.OsmAnd.O" + "BF.OsmAndHHRoutingIndex.HHRouteNetworkPo" + "int\032\366\001\n\023HHRouteNetworkPoint\022\n\n\002id\030\001 \002(\005\022" + "\n\n\002dx\030\002 \002(\021\022\n\n\002dy\030\003 \002(\021\022\020\n\010globalId\030\004 \002(" + "\005\022\016\n\006roadId\030\005 \002(\003\022\031\n\021roadStartEndIndex\030\006" + " \002(\005\022\021\n\tclusterId\030\007 \001(\005\022\023\n\013dualPointId\030\010" + " \001(\005\022\025\n\rdualClusterId\030\t \001(\005\022\022\n\nprofileId" + "s\030\n \003(\005\022\022\n\npartialInd\030\013 \001(\005\022\027\n\013tagValueI" + "ds\030\014 \003(\005B\002\020\001\032\360\001\n\024HHRouteBlockSegments\022\024\n" + "\014idRangeStart\030\001 \002(\005\022\025\n\ridRangeLength\030\002 \002" + "(\005\022\021\n\tprofileId\030\003 \001(\005\022J\n\013innerBlocks\030\006 \003" + "(\01325.OsmAnd.OBF.OsmAndHHRoutingIndex.HHR" + "outeBlockSegments\022L\n\rpointSegments\030\004 \003(\013" + "25.OsmAnd.OBF.OsmAndHHRoutingIndex.HHRou" + "tePointSegments\032\?\n\024HHRoutePointSegments\022" + "\022\n\nsegmentsIn\030\002 \002(\014\022\023\n\013segmentsOut\030\003 \002(\014" + "\"T\n\013OsmAndOwner\022\014\n\004name\030\001 \002(\t\022\020\n\010resourc" + "e\030\002 \001(\t\022\023\n\013description\030\003 \001(\t\022\020\n\010pluginid" + "\030\004 \001(\tB\036\n\021net.osmand.binaryB\tOsmandOdb", 9118); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "OBF.proto", &protobuf_RegisterTypes); OsmAndStructure::default_instance_ = new OsmAndStructure(); @@ -1767,6 +1820,8 @@ void protobuf_AddDesc_OBF_2eproto() { OsmAndCategoryTable::default_instance_ = new OsmAndCategoryTable(); OsmAndSubtypesTable::default_instance_ = new OsmAndSubtypesTable(); OsmAndPoiSubtype::default_instance_ = new OsmAndPoiSubtype(); + OsmAndPoiTagGroup::default_instance_ = new OsmAndPoiTagGroup(); + OsmAndPoiTagGroups::default_instance_ = new OsmAndPoiTagGroups(); OsmAndPoiBox::default_instance_ = new OsmAndPoiBox(); OsmAndPoiCategories::default_instance_ = new OsmAndPoiCategories(); OsmAndPoiBoxData::default_instance_ = new OsmAndPoiBoxData(); @@ -1822,6 +1877,8 @@ void protobuf_AddDesc_OBF_2eproto() { OsmAndCategoryTable::default_instance_->InitAsDefaultInstance(); OsmAndSubtypesTable::default_instance_->InitAsDefaultInstance(); OsmAndPoiSubtype::default_instance_->InitAsDefaultInstance(); + OsmAndPoiTagGroup::default_instance_->InitAsDefaultInstance(); + OsmAndPoiTagGroups::default_instance_->InitAsDefaultInstance(); OsmAndPoiBox::default_instance_->InitAsDefaultInstance(); OsmAndPoiCategories::default_instance_->InitAsDefaultInstance(); OsmAndPoiBoxData::default_instance_->InitAsDefaultInstance(); @@ -17214,6 +17271,534 @@ ::google::protobuf::Metadata OsmAndPoiSubtype::GetMetadata() const { } +// =================================================================== + +#ifndef _MSC_VER +const int OsmAndPoiTagGroup::kIdFieldNumber; +const int OsmAndPoiTagGroup::kTagValuesFieldNumber; +#endif // !_MSC_VER + +OsmAndPoiTagGroup::OsmAndPoiTagGroup() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void OsmAndPoiTagGroup::InitAsDefaultInstance() { +} + +OsmAndPoiTagGroup::OsmAndPoiTagGroup(const OsmAndPoiTagGroup& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void OsmAndPoiTagGroup::SharedCtor() { + _cached_size_ = 0; + id_ = 0u; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +OsmAndPoiTagGroup::~OsmAndPoiTagGroup() { + SharedDtor(); +} + +void OsmAndPoiTagGroup::SharedDtor() { + if (this != default_instance_) { + } +} + +void OsmAndPoiTagGroup::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* OsmAndPoiTagGroup::descriptor() { + protobuf_AssignDescriptorsOnce(); + return OsmAndPoiTagGroup_descriptor_; +} + +const OsmAndPoiTagGroup& OsmAndPoiTagGroup::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_OBF_2eproto(); + return *default_instance_; +} + +OsmAndPoiTagGroup* OsmAndPoiTagGroup::default_instance_ = NULL; + +OsmAndPoiTagGroup* OsmAndPoiTagGroup::New() const { + return new OsmAndPoiTagGroup; +} + +void OsmAndPoiTagGroup::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + id_ = 0u; + } + tagvalues_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool OsmAndPoiTagGroup::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // required uint32 id = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>( + input, &id_))); + set_has_id(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(42)) goto parse_tagValues; + break; + } + + // repeated string tagValues = 5; + case 5: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_tagValues: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->add_tagvalues())); + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->tagvalues(this->tagvalues_size() - 1).data(), + this->tagvalues(this->tagvalues_size() - 1).length(), + ::google::protobuf::internal::WireFormat::PARSE); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(42)) goto parse_tagValues; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void OsmAndPoiTagGroup::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // required uint32 id = 1; + if (has_id()) { + ::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->id(), output); + } + + // repeated string tagValues = 5; + for (int i = 0; i < this->tagvalues_size(); i++) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->tagvalues(i).data(), this->tagvalues(i).length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + ::google::protobuf::internal::WireFormatLite::WriteString( + 5, this->tagvalues(i), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* OsmAndPoiTagGroup::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // required uint32 id = 1; + if (has_id()) { + target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->id(), target); + } + + // repeated string tagValues = 5; + for (int i = 0; i < this->tagvalues_size(); i++) { + ::google::protobuf::internal::WireFormat::VerifyUTF8String( + this->tagvalues(i).data(), this->tagvalues(i).length(), + ::google::protobuf::internal::WireFormat::SERIALIZE); + target = ::google::protobuf::internal::WireFormatLite:: + WriteStringToArray(5, this->tagvalues(i), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int OsmAndPoiTagGroup::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // required uint32 id = 1; + if (has_id()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::UInt32Size( + this->id()); + } + + } + // repeated string tagValues = 5; + total_size += 1 * this->tagvalues_size(); + for (int i = 0; i < this->tagvalues_size(); i++) { + total_size += ::google::protobuf::internal::WireFormatLite::StringSize( + this->tagvalues(i)); + } + + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void OsmAndPoiTagGroup::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const OsmAndPoiTagGroup* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void OsmAndPoiTagGroup::MergeFrom(const OsmAndPoiTagGroup& from) { + GOOGLE_CHECK_NE(&from, this); + tagvalues_.MergeFrom(from.tagvalues_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_id()) { + set_id(from.id()); + } + } + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void OsmAndPoiTagGroup::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void OsmAndPoiTagGroup::CopyFrom(const OsmAndPoiTagGroup& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool OsmAndPoiTagGroup::IsInitialized() const { + if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; + + return true; +} + +void OsmAndPoiTagGroup::Swap(OsmAndPoiTagGroup* other) { + if (other != this) { + std::swap(id_, other->id_); + tagvalues_.Swap(&other->tagvalues_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata OsmAndPoiTagGroup::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = OsmAndPoiTagGroup_descriptor_; + metadata.reflection = OsmAndPoiTagGroup_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int OsmAndPoiTagGroups::kIdsFieldNumber; +const int OsmAndPoiTagGroups::kGroupsFieldNumber; +#endif // !_MSC_VER + +OsmAndPoiTagGroups::OsmAndPoiTagGroups() + : ::google::protobuf::Message() { + SharedCtor(); +} + +void OsmAndPoiTagGroups::InitAsDefaultInstance() { +} + +OsmAndPoiTagGroups::OsmAndPoiTagGroups(const OsmAndPoiTagGroups& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); +} + +void OsmAndPoiTagGroups::SharedCtor() { + _cached_size_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +OsmAndPoiTagGroups::~OsmAndPoiTagGroups() { + SharedDtor(); +} + +void OsmAndPoiTagGroups::SharedDtor() { + if (this != default_instance_) { + } +} + +void OsmAndPoiTagGroups::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* OsmAndPoiTagGroups::descriptor() { + protobuf_AssignDescriptorsOnce(); + return OsmAndPoiTagGroups_descriptor_; +} + +const OsmAndPoiTagGroups& OsmAndPoiTagGroups::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_OBF_2eproto(); + return *default_instance_; +} + +OsmAndPoiTagGroups* OsmAndPoiTagGroups::default_instance_ = NULL; + +OsmAndPoiTagGroups* OsmAndPoiTagGroups::New() const { + return new OsmAndPoiTagGroups; +} + +void OsmAndPoiTagGroups::Clear() { + ids_.Clear(); + groups_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + mutable_unknown_fields()->Clear(); +} + +bool OsmAndPoiTagGroups::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // repeated uint32 ids = 2 [packed = true]; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< + ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>( + input, this->mutable_ids()))); + } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) + == ::google::protobuf::internal::WireFormatLite:: + WIRETYPE_VARINT) { + DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< + ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>( + 1, 18, input, this->mutable_ids()))); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(42)) goto parse_groups; + break; + } + + // repeated .OsmAnd.OBF.OsmAndPoiTagGroup groups = 5; + case 5: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_groups: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_groups())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(42)) goto parse_groups; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } + return true; +#undef DO_ +} + +void OsmAndPoiTagGroups::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // repeated uint32 ids = 2 [packed = true]; + if (this->ids_size() > 0) { + ::google::protobuf::internal::WireFormatLite::WriteTag(2, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); + output->WriteVarint32(_ids_cached_byte_size_); + } + for (int i = 0; i < this->ids_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteUInt32NoTag( + this->ids(i), output); + } + + // repeated .OsmAnd.OBF.OsmAndPoiTagGroup groups = 5; + for (int i = 0; i < this->groups_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 5, this->groups(i), output); + } + + if (!unknown_fields().empty()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } +} + +::google::protobuf::uint8* OsmAndPoiTagGroups::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // repeated uint32 ids = 2 [packed = true]; + if (this->ids_size() > 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( + 2, + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, + target); + target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( + _ids_cached_byte_size_, target); + } + for (int i = 0; i < this->ids_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteUInt32NoTagToArray(this->ids(i), target); + } + + // repeated .OsmAnd.OBF.OsmAndPoiTagGroup groups = 5; + for (int i = 0; i < this->groups_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 5, this->groups(i), target); + } + + if (!unknown_fields().empty()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + return target; +} + +int OsmAndPoiTagGroups::ByteSize() const { + int total_size = 0; + + // repeated uint32 ids = 2 [packed = true]; + { + int data_size = 0; + for (int i = 0; i < this->ids_size(); i++) { + data_size += ::google::protobuf::internal::WireFormatLite:: + UInt32Size(this->ids(i)); + } + if (data_size > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _ids_cached_byte_size_ = data_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + total_size += data_size; + } + + // repeated .OsmAnd.OBF.OsmAndPoiTagGroup groups = 5; + total_size += 1 * this->groups_size(); + for (int i = 0; i < this->groups_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->groups(i)); + } + + if (!unknown_fields().empty()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void OsmAndPoiTagGroups::MergeFrom(const ::google::protobuf::Message& from) { + GOOGLE_CHECK_NE(&from, this); + const OsmAndPoiTagGroups* source = + ::google::protobuf::internal::dynamic_cast_if_available( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void OsmAndPoiTagGroups::MergeFrom(const OsmAndPoiTagGroups& from) { + GOOGLE_CHECK_NE(&from, this); + ids_.MergeFrom(from.ids_); + groups_.MergeFrom(from.groups_); + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); +} + +void OsmAndPoiTagGroups::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void OsmAndPoiTagGroups::CopyFrom(const OsmAndPoiTagGroups& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool OsmAndPoiTagGroups::IsInitialized() const { + + for (int i = 0; i < groups_size(); i++) { + if (!this->groups(i).IsInitialized()) return false; + } + return true; +} + +void OsmAndPoiTagGroups::Swap(OsmAndPoiTagGroups* other) { + if (other != this) { + ids_.Swap(&other->ids_); + groups_.Swap(&other->groups_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _unknown_fields_.Swap(&other->_unknown_fields_); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::google::protobuf::Metadata OsmAndPoiTagGroups::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = OsmAndPoiTagGroups_descriptor_; + metadata.reflection = OsmAndPoiTagGroups_reflection_; + return metadata; +} + + // =================================================================== #ifndef _MSC_VER @@ -17221,6 +17806,7 @@ const int OsmAndPoiBox::kZoomFieldNumber; const int OsmAndPoiBox::kLeftFieldNumber; const int OsmAndPoiBox::kTopFieldNumber; const int OsmAndPoiBox::kCategoriesFieldNumber; +const int OsmAndPoiBox::kTagGroupsFieldNumber; const int OsmAndPoiBox::kSubBoxesFieldNumber; const int OsmAndPoiBox::kShiftToDataFieldNumber; #endif // !_MSC_VER @@ -17232,6 +17818,7 @@ OsmAndPoiBox::OsmAndPoiBox() void OsmAndPoiBox::InitAsDefaultInstance() { categories_ = const_cast< ::OsmAnd::OBF::OsmAndPoiCategories*>(&::OsmAnd::OBF::OsmAndPoiCategories::default_instance()); + taggroups_ = const_cast< ::OsmAnd::OBF::OsmAndPoiTagGroups*>(&::OsmAnd::OBF::OsmAndPoiTagGroups::default_instance()); } OsmAndPoiBox::OsmAndPoiBox(const OsmAndPoiBox& from) @@ -17246,6 +17833,7 @@ void OsmAndPoiBox::SharedCtor() { left_ = 0; top_ = 0; categories_ = NULL; + taggroups_ = NULL; shifttodata_ = 0u; ::memset(_has_bits_, 0, sizeof(_has_bits_)); } @@ -17257,6 +17845,7 @@ OsmAndPoiBox::~OsmAndPoiBox() { void OsmAndPoiBox::SharedDtor() { if (this != default_instance_) { delete categories_; + delete taggroups_; } } @@ -17289,6 +17878,9 @@ void OsmAndPoiBox::Clear() { if (has_categories()) { if (categories_ != NULL) categories_->::OsmAnd::OBF::OsmAndPoiCategories::Clear(); } + if (has_taggroups()) { + if (taggroups_ != NULL) taggroups_->::OsmAnd::OBF::OsmAndPoiTagGroups::Clear(); + } shifttodata_ = 0u; } subboxes_.Clear(); @@ -17359,6 +17951,20 @@ bool OsmAndPoiBox::MergePartialFromCodedStream( } else { goto handle_uninterpreted; } + if (input->ExpectTag(66)) goto parse_tagGroups; + break; + } + + // optional .OsmAnd.OBF.OsmAndPoiTagGroups tagGroups = 8; + case 8: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_tagGroups: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_taggroups())); + } else { + goto handle_uninterpreted; + } if (input->ExpectTag(82)) goto parse_subBoxes; break; } @@ -17433,6 +18039,12 @@ void OsmAndPoiBox::SerializeWithCachedSizes( 4, this->categories(), output); } + // optional .OsmAnd.OBF.OsmAndPoiTagGroups tagGroups = 8; + if (has_taggroups()) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 8, this->taggroups(), output); + } + // repeated .OsmAnd.OBF.OsmAndPoiBox subBoxes = 10; for (int i = 0; i < this->subboxes_size(); i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( @@ -17474,6 +18086,13 @@ ::google::protobuf::uint8* OsmAndPoiBox::SerializeWithCachedSizesToArray( 4, this->categories(), target); } + // optional .OsmAnd.OBF.OsmAndPoiTagGroups tagGroups = 8; + if (has_taggroups()) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 8, this->taggroups(), target); + } + // repeated .OsmAnd.OBF.OsmAndPoiBox subBoxes = 10; for (int i = 0; i < this->subboxes_size(); i++) { target = ::google::protobuf::internal::WireFormatLite:: @@ -17525,6 +18144,13 @@ int OsmAndPoiBox::ByteSize() const { this->categories()); } + // optional .OsmAnd.OBF.OsmAndPoiTagGroups tagGroups = 8; + if (has_taggroups()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->taggroups()); + } + // optional fixed32 shiftToData = 14; if (has_shifttodata()) { total_size += 1 + 4; @@ -17578,6 +18204,9 @@ void OsmAndPoiBox::MergeFrom(const OsmAndPoiBox& from) { if (from.has_categories()) { mutable_categories()->::OsmAnd::OBF::OsmAndPoiCategories::MergeFrom(from.categories()); } + if (from.has_taggroups()) { + mutable_taggroups()->::OsmAnd::OBF::OsmAndPoiTagGroups::MergeFrom(from.taggroups()); + } if (from.has_shifttodata()) { set_shifttodata(from.shifttodata()); } @@ -17600,6 +18229,9 @@ void OsmAndPoiBox::CopyFrom(const OsmAndPoiBox& from) { bool OsmAndPoiBox::IsInitialized() const { if ((_has_bits_[0] & 0x00000007) != 0x00000007) return false; + if (has_taggroups()) { + if (!this->taggroups().IsInitialized()) return false; + } for (int i = 0; i < subboxes_size(); i++) { if (!this->subboxes(i).IsInitialized()) return false; } @@ -17612,6 +18244,7 @@ void OsmAndPoiBox::Swap(OsmAndPoiBox* other) { std::swap(left_, other->left_); std::swap(top_, other->top_); std::swap(categories_, other->categories_); + std::swap(taggroups_, other->taggroups_); subboxes_.Swap(&other->subboxes_); std::swap(shifttodata_, other->shifttodata_); std::swap(_has_bits_[0], other->_has_bits_[0]); @@ -18236,6 +18869,7 @@ const int OsmAndPoiBoxDataAtom::kNoteFieldNumber; const int OsmAndPoiBoxDataAtom::kTextCategoriesFieldNumber; const int OsmAndPoiBoxDataAtom::kTextValuesFieldNumber; const int OsmAndPoiBoxDataAtom::kPrecisionXYFieldNumber; +const int OsmAndPoiBoxDataAtom::kTagGroupsFieldNumber; #endif // !_MSC_VER OsmAndPoiBoxDataAtom::OsmAndPoiBoxDataAtom() @@ -18358,6 +18992,7 @@ void OsmAndPoiBoxDataAtom::Clear() { subcategories_.Clear(); textcategories_.Clear(); textvalues_.Clear(); + taggroups_.Clear(); ::memset(_has_bits_, 0, sizeof(_has_bits_)); mutable_unknown_fields()->Clear(); } @@ -18614,6 +19249,27 @@ bool OsmAndPoiBoxDataAtom::MergePartialFromCodedStream( } else { goto handle_uninterpreted; } + if (input->ExpectTag(138)) goto parse_tagGroups; + break; + } + + // repeated uint32 tagGroups = 17 [packed = true]; + case 17: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_tagGroups: + DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< + ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>( + input, this->mutable_taggroups()))); + } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) + == ::google::protobuf::internal::WireFormatLite:: + WIRETYPE_VARINT) { + DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< + ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>( + 2, 138, input, this->mutable_taggroups()))); + } else { + goto handle_uninterpreted; + } if (input->ExpectAtEnd()) return true; break; } @@ -18737,6 +19393,16 @@ void OsmAndPoiBoxDataAtom::SerializeWithCachedSizes( ::google::protobuf::internal::WireFormatLite::WriteInt32(16, this->precisionxy(), output); } + // repeated uint32 tagGroups = 17 [packed = true]; + if (this->taggroups_size() > 0) { + ::google::protobuf::internal::WireFormatLite::WriteTag(17, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); + output->WriteVarint32(_taggroups_cached_byte_size_); + } + for (int i = 0; i < this->taggroups_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteUInt32NoTag( + this->taggroups(i), output); + } + if (!unknown_fields().empty()) { ::google::protobuf::internal::WireFormat::SerializeUnknownFields( unknown_fields(), output); @@ -18852,6 +19518,20 @@ ::google::protobuf::uint8* OsmAndPoiBoxDataAtom::SerializeWithCachedSizesToArray target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(16, this->precisionxy(), target); } + // repeated uint32 tagGroups = 17 [packed = true]; + if (this->taggroups_size() > 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( + 17, + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, + target); + target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( + _taggroups_cached_byte_size_, target); + } + for (int i = 0; i < this->taggroups_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteUInt32NoTagToArray(this->taggroups(i), target); + } + if (!unknown_fields().empty()) { target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( unknown_fields(), target); @@ -18973,6 +19653,23 @@ int OsmAndPoiBoxDataAtom::ByteSize() const { this->textvalues(i)); } + // repeated uint32 tagGroups = 17 [packed = true]; + { + int data_size = 0; + for (int i = 0; i < this->taggroups_size(); i++) { + data_size += ::google::protobuf::internal::WireFormatLite:: + UInt32Size(this->taggroups(i)); + } + if (data_size > 0) { + total_size += 2 + + ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _taggroups_cached_byte_size_ = data_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + total_size += data_size; + } + if (!unknown_fields().empty()) { total_size += ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( @@ -19002,6 +19699,7 @@ void OsmAndPoiBoxDataAtom::MergeFrom(const OsmAndPoiBoxDataAtom& from) { subcategories_.MergeFrom(from.subcategories_); textcategories_.MergeFrom(from.textcategories_); textvalues_.MergeFrom(from.textvalues_); + taggroups_.MergeFrom(from.taggroups_); if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { if (from.has_dx()) { set_dx(from.dx()); @@ -19073,6 +19771,7 @@ void OsmAndPoiBoxDataAtom::Swap(OsmAndPoiBoxDataAtom* other) { textcategories_.Swap(&other->textcategories_); textvalues_.Swap(&other->textvalues_); std::swap(precisionxy_, other->precisionxy_); + taggroups_.Swap(&other->taggroups_); std::swap(_has_bits_[0], other->_has_bits_[0]); _unknown_fields_.Swap(&other->_unknown_fields_); std::swap(_cached_size_, other->_cached_size_); diff --git a/protos/OBF.pb.h b/protos/OBF.pb.h index 5f0cdaf18..7656f633f 100644 --- a/protos/OBF.pb.h +++ b/protos/OBF.pb.h @@ -73,6 +73,8 @@ class OsmAndPoiNameIndexDataAtom; class OsmAndCategoryTable; class OsmAndSubtypesTable; class OsmAndPoiSubtype; +class OsmAndPoiTagGroup; +class OsmAndPoiTagGroups; class OsmAndPoiBox; class OsmAndPoiCategories; class OsmAndPoiBoxData; @@ -5345,6 +5347,204 @@ class OsmAndPoiSubtype : public ::google::protobuf::Message { }; // ------------------------------------------------------------------- +class OsmAndPoiTagGroup : public ::google::protobuf::Message { + public: + OsmAndPoiTagGroup(); + virtual ~OsmAndPoiTagGroup(); + + OsmAndPoiTagGroup(const OsmAndPoiTagGroup& from); + + inline OsmAndPoiTagGroup& operator=(const OsmAndPoiTagGroup& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const OsmAndPoiTagGroup& default_instance(); + + void Swap(OsmAndPoiTagGroup* other); + + // implements Message ---------------------------------------------- + + OsmAndPoiTagGroup* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const OsmAndPoiTagGroup& from); + void MergeFrom(const OsmAndPoiTagGroup& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // required uint32 id = 1; + inline bool has_id() const; + inline void clear_id(); + static const int kIdFieldNumber = 1; + inline ::google::protobuf::uint32 id() const; + inline void set_id(::google::protobuf::uint32 value); + + // repeated string tagValues = 5; + inline int tagvalues_size() const; + inline void clear_tagvalues(); + static const int kTagValuesFieldNumber = 5; + inline const ::std::string& tagvalues(int index) const; + inline ::std::string* mutable_tagvalues(int index); + inline void set_tagvalues(int index, const ::std::string& value); + inline void set_tagvalues(int index, const char* value); + inline void set_tagvalues(int index, const char* value, size_t size); + inline ::std::string* add_tagvalues(); + inline void add_tagvalues(const ::std::string& value); + inline void add_tagvalues(const char* value); + inline void add_tagvalues(const char* value, size_t size); + inline const ::google::protobuf::RepeatedPtrField< ::std::string>& tagvalues() const; + inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_tagvalues(); + + // @@protoc_insertion_point(class_scope:OsmAnd.OBF.OsmAndPoiTagGroup) + private: + inline void set_has_id(); + inline void clear_has_id(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedPtrField< ::std::string> tagvalues_; + ::google::protobuf::uint32 id_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void protobuf_AddDesc_OBF_2eproto(); + friend void protobuf_AssignDesc_OBF_2eproto(); + friend void protobuf_ShutdownFile_OBF_2eproto(); + + void InitAsDefaultInstance(); + static OsmAndPoiTagGroup* default_instance_; +}; +// ------------------------------------------------------------------- + +class OsmAndPoiTagGroups : public ::google::protobuf::Message { + public: + OsmAndPoiTagGroups(); + virtual ~OsmAndPoiTagGroups(); + + OsmAndPoiTagGroups(const OsmAndPoiTagGroups& from); + + inline OsmAndPoiTagGroups& operator=(const OsmAndPoiTagGroups& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const OsmAndPoiTagGroups& default_instance(); + + void Swap(OsmAndPoiTagGroups* other); + + // implements Message ---------------------------------------------- + + OsmAndPoiTagGroups* New() const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const OsmAndPoiTagGroups& from); + void MergeFrom(const OsmAndPoiTagGroups& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated uint32 ids = 2 [packed = true]; + inline int ids_size() const; + inline void clear_ids(); + static const int kIdsFieldNumber = 2; + inline ::google::protobuf::uint32 ids(int index) const; + inline void set_ids(int index, ::google::protobuf::uint32 value); + inline void add_ids(::google::protobuf::uint32 value); + inline const ::google::protobuf::RepeatedField< ::google::protobuf::uint32 >& + ids() const; + inline ::google::protobuf::RepeatedField< ::google::protobuf::uint32 >* + mutable_ids(); + + // repeated .OsmAnd.OBF.OsmAndPoiTagGroup groups = 5; + inline int groups_size() const; + inline void clear_groups(); + static const int kGroupsFieldNumber = 5; + inline const ::OsmAnd::OBF::OsmAndPoiTagGroup& groups(int index) const; + inline ::OsmAnd::OBF::OsmAndPoiTagGroup* mutable_groups(int index); + inline ::OsmAnd::OBF::OsmAndPoiTagGroup* add_groups(); + inline const ::google::protobuf::RepeatedPtrField< ::OsmAnd::OBF::OsmAndPoiTagGroup >& + groups() const; + inline ::google::protobuf::RepeatedPtrField< ::OsmAnd::OBF::OsmAndPoiTagGroup >* + mutable_groups(); + + // @@protoc_insertion_point(class_scope:OsmAnd.OBF.OsmAndPoiTagGroups) + private: + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::RepeatedField< ::google::protobuf::uint32 > ids_; + mutable int _ids_cached_byte_size_; + ::google::protobuf::RepeatedPtrField< ::OsmAnd::OBF::OsmAndPoiTagGroup > groups_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void protobuf_AddDesc_OBF_2eproto(); + friend void protobuf_AssignDesc_OBF_2eproto(); + friend void protobuf_ShutdownFile_OBF_2eproto(); + + void InitAsDefaultInstance(); + static OsmAndPoiTagGroups* default_instance_; +}; +// ------------------------------------------------------------------- + class OsmAndPoiBox : public ::google::protobuf::Message { public: OsmAndPoiBox(); @@ -5429,6 +5629,15 @@ class OsmAndPoiBox : public ::google::protobuf::Message { inline ::OsmAnd::OBF::OsmAndPoiCategories* release_categories(); inline void set_allocated_categories(::OsmAnd::OBF::OsmAndPoiCategories* categories); + // optional .OsmAnd.OBF.OsmAndPoiTagGroups tagGroups = 8; + inline bool has_taggroups() const; + inline void clear_taggroups(); + static const int kTagGroupsFieldNumber = 8; + inline const ::OsmAnd::OBF::OsmAndPoiTagGroups& taggroups() const; + inline ::OsmAnd::OBF::OsmAndPoiTagGroups* mutable_taggroups(); + inline ::OsmAnd::OBF::OsmAndPoiTagGroups* release_taggroups(); + inline void set_allocated_taggroups(::OsmAnd::OBF::OsmAndPoiTagGroups* taggroups); + // repeated .OsmAnd.OBF.OsmAndPoiBox subBoxes = 10; inline int subboxes_size() const; inline void clear_subboxes(); @@ -5458,6 +5667,8 @@ class OsmAndPoiBox : public ::google::protobuf::Message { inline void clear_has_top(); inline void set_has_categories(); inline void clear_has_categories(); + inline void set_has_taggroups(); + inline void clear_has_taggroups(); inline void set_has_shifttodata(); inline void clear_has_shifttodata(); @@ -5466,12 +5677,13 @@ class OsmAndPoiBox : public ::google::protobuf::Message { ::google::protobuf::uint32 zoom_; ::google::protobuf::int32 left_; ::OsmAnd::OBF::OsmAndPoiCategories* categories_; + ::OsmAnd::OBF::OsmAndPoiTagGroups* taggroups_; ::google::protobuf::int32 top_; ::google::protobuf::uint32 shifttodata_; ::google::protobuf::RepeatedPtrField< ::OsmAnd::OBF::OsmAndPoiBox > subboxes_; mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(6 + 31) / 32]; + ::google::protobuf::uint32 _has_bits_[(7 + 31) / 32]; friend void protobuf_AddDesc_OBF_2eproto(); friend void protobuf_AssignDesc_OBF_2eproto(); @@ -5901,6 +6113,18 @@ class OsmAndPoiBoxDataAtom : public ::google::protobuf::Message { inline ::google::protobuf::int32 precisionxy() const; inline void set_precisionxy(::google::protobuf::int32 value); + // repeated uint32 tagGroups = 17 [packed = true]; + inline int taggroups_size() const; + inline void clear_taggroups(); + static const int kTagGroupsFieldNumber = 17; + inline ::google::protobuf::uint32 taggroups(int index) const; + inline void set_taggroups(int index, ::google::protobuf::uint32 value); + inline void add_taggroups(::google::protobuf::uint32 value); + inline const ::google::protobuf::RepeatedField< ::google::protobuf::uint32 >& + taggroups() const; + inline ::google::protobuf::RepeatedField< ::google::protobuf::uint32 >* + mutable_taggroups(); + // @@protoc_insertion_point(class_scope:OsmAnd.OBF.OsmAndPoiBoxDataAtom) private: inline void set_has_dx(); @@ -5939,10 +6163,12 @@ class OsmAndPoiBoxDataAtom : public ::google::protobuf::Message { ::std::string* note_; ::google::protobuf::RepeatedField< ::google::protobuf::uint32 > textcategories_; ::google::protobuf::RepeatedPtrField< ::std::string> textvalues_; + ::google::protobuf::RepeatedField< ::google::protobuf::uint32 > taggroups_; + mutable int _taggroups_cached_byte_size_; ::google::protobuf::int32 precisionxy_; mutable int _cached_size_; - ::google::protobuf::uint32 _has_bits_[(14 + 31) / 32]; + ::google::protobuf::uint32 _has_bits_[(15 + 31) / 32]; friend void protobuf_AddDesc_OBF_2eproto(); friend void protobuf_AssignDesc_OBF_2eproto(); @@ -14643,6 +14869,130 @@ OsmAndPoiSubtype::mutable_subtypevalue() { // ------------------------------------------------------------------- +// OsmAndPoiTagGroup + +// required uint32 id = 1; +inline bool OsmAndPoiTagGroup::has_id() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void OsmAndPoiTagGroup::set_has_id() { + _has_bits_[0] |= 0x00000001u; +} +inline void OsmAndPoiTagGroup::clear_has_id() { + _has_bits_[0] &= ~0x00000001u; +} +inline void OsmAndPoiTagGroup::clear_id() { + id_ = 0u; + clear_has_id(); +} +inline ::google::protobuf::uint32 OsmAndPoiTagGroup::id() const { + return id_; +} +inline void OsmAndPoiTagGroup::set_id(::google::protobuf::uint32 value) { + set_has_id(); + id_ = value; +} + +// repeated string tagValues = 5; +inline int OsmAndPoiTagGroup::tagvalues_size() const { + return tagvalues_.size(); +} +inline void OsmAndPoiTagGroup::clear_tagvalues() { + tagvalues_.Clear(); +} +inline const ::std::string& OsmAndPoiTagGroup::tagvalues(int index) const { + return tagvalues_.Get(index); +} +inline ::std::string* OsmAndPoiTagGroup::mutable_tagvalues(int index) { + return tagvalues_.Mutable(index); +} +inline void OsmAndPoiTagGroup::set_tagvalues(int index, const ::std::string& value) { + tagvalues_.Mutable(index)->assign(value); +} +inline void OsmAndPoiTagGroup::set_tagvalues(int index, const char* value) { + tagvalues_.Mutable(index)->assign(value); +} +inline void OsmAndPoiTagGroup::set_tagvalues(int index, const char* value, size_t size) { + tagvalues_.Mutable(index)->assign( + reinterpret_cast(value), size); +} +inline ::std::string* OsmAndPoiTagGroup::add_tagvalues() { + return tagvalues_.Add(); +} +inline void OsmAndPoiTagGroup::add_tagvalues(const ::std::string& value) { + tagvalues_.Add()->assign(value); +} +inline void OsmAndPoiTagGroup::add_tagvalues(const char* value) { + tagvalues_.Add()->assign(value); +} +inline void OsmAndPoiTagGroup::add_tagvalues(const char* value, size_t size) { + tagvalues_.Add()->assign(reinterpret_cast(value), size); +} +inline const ::google::protobuf::RepeatedPtrField< ::std::string>& +OsmAndPoiTagGroup::tagvalues() const { + return tagvalues_; +} +inline ::google::protobuf::RepeatedPtrField< ::std::string>* +OsmAndPoiTagGroup::mutable_tagvalues() { + return &tagvalues_; +} + +// ------------------------------------------------------------------- + +// OsmAndPoiTagGroups + +// repeated uint32 ids = 2 [packed = true]; +inline int OsmAndPoiTagGroups::ids_size() const { + return ids_.size(); +} +inline void OsmAndPoiTagGroups::clear_ids() { + ids_.Clear(); +} +inline ::google::protobuf::uint32 OsmAndPoiTagGroups::ids(int index) const { + return ids_.Get(index); +} +inline void OsmAndPoiTagGroups::set_ids(int index, ::google::protobuf::uint32 value) { + ids_.Set(index, value); +} +inline void OsmAndPoiTagGroups::add_ids(::google::protobuf::uint32 value) { + ids_.Add(value); +} +inline const ::google::protobuf::RepeatedField< ::google::protobuf::uint32 >& +OsmAndPoiTagGroups::ids() const { + return ids_; +} +inline ::google::protobuf::RepeatedField< ::google::protobuf::uint32 >* +OsmAndPoiTagGroups::mutable_ids() { + return &ids_; +} + +// repeated .OsmAnd.OBF.OsmAndPoiTagGroup groups = 5; +inline int OsmAndPoiTagGroups::groups_size() const { + return groups_.size(); +} +inline void OsmAndPoiTagGroups::clear_groups() { + groups_.Clear(); +} +inline const ::OsmAnd::OBF::OsmAndPoiTagGroup& OsmAndPoiTagGroups::groups(int index) const { + return groups_.Get(index); +} +inline ::OsmAnd::OBF::OsmAndPoiTagGroup* OsmAndPoiTagGroups::mutable_groups(int index) { + return groups_.Mutable(index); +} +inline ::OsmAnd::OBF::OsmAndPoiTagGroup* OsmAndPoiTagGroups::add_groups() { + return groups_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::OsmAnd::OBF::OsmAndPoiTagGroup >& +OsmAndPoiTagGroups::groups() const { + return groups_; +} +inline ::google::protobuf::RepeatedPtrField< ::OsmAnd::OBF::OsmAndPoiTagGroup >* +OsmAndPoiTagGroups::mutable_groups() { + return &groups_; +} + +// ------------------------------------------------------------------- + // OsmAndPoiBox // required uint32 zoom = 1; @@ -14749,6 +15099,44 @@ inline void OsmAndPoiBox::set_allocated_categories(::OsmAnd::OBF::OsmAndPoiCateg } } +// optional .OsmAnd.OBF.OsmAndPoiTagGroups tagGroups = 8; +inline bool OsmAndPoiBox::has_taggroups() const { + return (_has_bits_[0] & 0x00000010u) != 0; +} +inline void OsmAndPoiBox::set_has_taggroups() { + _has_bits_[0] |= 0x00000010u; +} +inline void OsmAndPoiBox::clear_has_taggroups() { + _has_bits_[0] &= ~0x00000010u; +} +inline void OsmAndPoiBox::clear_taggroups() { + if (taggroups_ != NULL) taggroups_->::OsmAnd::OBF::OsmAndPoiTagGroups::Clear(); + clear_has_taggroups(); +} +inline const ::OsmAnd::OBF::OsmAndPoiTagGroups& OsmAndPoiBox::taggroups() const { + return taggroups_ != NULL ? *taggroups_ : *default_instance_->taggroups_; +} +inline ::OsmAnd::OBF::OsmAndPoiTagGroups* OsmAndPoiBox::mutable_taggroups() { + set_has_taggroups(); + if (taggroups_ == NULL) taggroups_ = new ::OsmAnd::OBF::OsmAndPoiTagGroups; + return taggroups_; +} +inline ::OsmAnd::OBF::OsmAndPoiTagGroups* OsmAndPoiBox::release_taggroups() { + clear_has_taggroups(); + ::OsmAnd::OBF::OsmAndPoiTagGroups* temp = taggroups_; + taggroups_ = NULL; + return temp; +} +inline void OsmAndPoiBox::set_allocated_taggroups(::OsmAnd::OBF::OsmAndPoiTagGroups* taggroups) { + delete taggroups_; + taggroups_ = taggroups; + if (taggroups) { + set_has_taggroups(); + } else { + clear_has_taggroups(); + } +} + // repeated .OsmAnd.OBF.OsmAndPoiBox subBoxes = 10; inline int OsmAndPoiBox::subboxes_size() const { return subboxes_.size(); @@ -14776,13 +15164,13 @@ OsmAndPoiBox::mutable_subboxes() { // optional fixed32 shiftToData = 14; inline bool OsmAndPoiBox::has_shifttodata() const { - return (_has_bits_[0] & 0x00000020u) != 0; + return (_has_bits_[0] & 0x00000040u) != 0; } inline void OsmAndPoiBox::set_has_shifttodata() { - _has_bits_[0] |= 0x00000020u; + _has_bits_[0] |= 0x00000040u; } inline void OsmAndPoiBox::clear_has_shifttodata() { - _has_bits_[0] &= ~0x00000020u; + _has_bits_[0] &= ~0x00000040u; } inline void OsmAndPoiBox::clear_shifttodata() { shifttodata_ = 0u; @@ -15576,6 +15964,31 @@ inline void OsmAndPoiBoxDataAtom::set_precisionxy(::google::protobuf::int32 valu precisionxy_ = value; } +// repeated uint32 tagGroups = 17 [packed = true]; +inline int OsmAndPoiBoxDataAtom::taggroups_size() const { + return taggroups_.size(); +} +inline void OsmAndPoiBoxDataAtom::clear_taggroups() { + taggroups_.Clear(); +} +inline ::google::protobuf::uint32 OsmAndPoiBoxDataAtom::taggroups(int index) const { + return taggroups_.Get(index); +} +inline void OsmAndPoiBoxDataAtom::set_taggroups(int index, ::google::protobuf::uint32 value) { + taggroups_.Set(index, value); +} +inline void OsmAndPoiBoxDataAtom::add_taggroups(::google::protobuf::uint32 value) { + taggroups_.Add(value); +} +inline const ::google::protobuf::RepeatedField< ::google::protobuf::uint32 >& +OsmAndPoiBoxDataAtom::taggroups() const { + return taggroups_; +} +inline ::google::protobuf::RepeatedField< ::google::protobuf::uint32 >* +OsmAndPoiBoxDataAtom::mutable_taggroups() { + return &taggroups_; +} + // ------------------------------------------------------------------- // IdTable diff --git a/src/Data/Amenity.cpp b/src/Data/Amenity.cpp index 24f9efe28..3757c8f80 100644 --- a/src/Data/Amenity.cpp +++ b/src/Data/Amenity.cpp @@ -241,3 +241,29 @@ QString OsmAnd::Amenity::getName(const QString lang, bool transliterate) const else return name; } + +void OsmAnd::Amenity::addTagGroup(int id, QList tagValues) +{ + tagGroups.insert(id, tagValues); +} + +QString OsmAnd::Amenity::getCityFromTagGroups(QString lang) const +{ + QString result = ""; + for (auto i = tagGroups.begin(); i != tagGroups.end(); ++i) + { + for (const auto & tagValue : i.value()) + { + if (tagValue.tag.endsWith("city:" + lang)) { + if (result.isEmpty()) + result = tagValue.value; + else + result += ", " + tagValue.value; + break; + } + if (tagValue.tag.endsWith("city")) + result = tagValue.value; + } + } + return result; +} diff --git a/src/Data/ObfPoiSectionInfo.cpp b/src/Data/ObfPoiSectionInfo.cpp index 4045cf32b..2bc1b0316 100644 --- a/src/Data/ObfPoiSectionInfo.cpp +++ b/src/Data/ObfPoiSectionInfo.cpp @@ -8,6 +8,7 @@ OsmAnd::ObfPoiSectionInfo::ObfPoiSectionInfo(const std::shared_ptr OsmAnd::ObfPoiSectionInfo::getCategories() const { return _p->getCategories(); @@ -25,6 +32,19 @@ std::shared_ptr OsmAnd::ObfPoiSectionInfo:: return _p->getSubtypes(); } +QList OsmAnd::ObfPoiSectionInfo::getTagValues(int id) const +{ + auto it = tagGroups.find(id); + if (it != tagGroups.end()) + { + return *it; + } + else + { + return {}; + } +} + OsmAnd::ObfPoiSectionCategories::ObfPoiSectionCategories() { } diff --git a/src/Data/ObfPoiSectionReader_P.cpp b/src/Data/ObfPoiSectionReader_P.cpp index dfc83deb7..b3bd2148e 100644 --- a/src/Data/ObfPoiSectionReader_P.cpp +++ b/src/Data/ObfPoiSectionReader_P.cpp @@ -431,6 +431,7 @@ void OsmAnd::ObfPoiSectionReader_P::readAmenities( scanTiles( reader, + section, dataBoxesOffsetsMap, tilesToSkip, MinZoomLevel, @@ -439,7 +440,8 @@ void OsmAnd::ObfPoiSectionReader_P::readAmenities( tileFilter, zoomFilter, categoriesFilter, - poiAdditionalFilter); + poiAdditionalFilter, + nullptr); ObfReaderUtilities::ensureAllDataWasRead(cis); cis->PopLimit(oldLimit); @@ -514,6 +516,7 @@ void OsmAnd::ObfPoiSectionReader_P::readAmenities( bool OsmAnd::ObfPoiSectionReader_P::scanTiles( const ObfReader_P& reader, + const std::shared_ptr& section, QMap& outDataOffsetsMap, const std::shared_ptr> tilesToSkip, const ZoomLevel parentZoom, @@ -522,7 +525,8 @@ bool OsmAnd::ObfPoiSectionReader_P::scanTiles( const TileAcceptorFunction tileFilter, const ZoomLevel zoomFilter, const QSet* const categoriesFilter, - const QPair* poiAdditionalFilter) + const QPair* poiAdditionalFilter, + const BBoxIndexTree* nameIndexTree) { const auto cis = reader.getCodedInputStream().get(); @@ -563,13 +567,22 @@ bool OsmAnd::ObfPoiSectionReader_P::scanTiles( tileId.y = (parentTileId.y << deltaZoom) + d; bool rejectBox = false; - - //if (!rejectBox && tileFilter) - // rejectBox = !tileFilter(tileId, zoom); - - if (!rejectBox && bbox31) + bool intersectWithNameIndex = false; + const auto tileBBox31 = Utilities::tileBoundingBox31(tileId, zoom); + if (nameIndexTree) + { + QList resCache; + section->bboxIndexCache.query(tileBBox31, resCache); + if (resCache.size() == 0) + { + QList res; + nameIndexTree->query(tileBBox31, res); + intersectWithNameIndex = res.size() > 0; + } + } + + if (!rejectBox && bbox31 && !intersectWithNameIndex) { - const auto tileBBox31 = Utilities::tileBoundingBox31(tileId, zoom); rejectBox = !bbox31->contains(tileBBox31) && !tileBBox31.contains(*bbox31) && @@ -581,6 +594,7 @@ bool OsmAnd::ObfPoiSectionReader_P::scanTiles( cis->Skip(cis->BytesUntilLimit()); return false; } + section->bboxIndexCache.insert(0, tileBBox31); break; } case OBF::OsmAndPoiBox::kCategoriesFieldNumber: @@ -606,6 +620,18 @@ bool OsmAnd::ObfPoiSectionReader_P::scanTiles( } break; } + case OBF::OsmAndPoiBox::kTagGroupsFieldNumber: + { + //PoiRegion.MAP_HAS_TAG_GROUPS = true; + gpb::uint32 tagGroupLength; + cis->ReadVarint32(&tagGroupLength); + const auto old = cis->PushLimit(tagGroupLength); + std::map> ttt; + readTagGroups(reader, &ttt); + //section->tagGroups = ttt; + cis->PopLimit(old); + break; + } case OBF::OsmAndPoiBox::kSubBoxesFieldNumber: { const auto length = ObfReaderUtilities::readBigEndianInt(cis); @@ -614,6 +640,7 @@ bool OsmAnd::ObfPoiSectionReader_P::scanTiles( const auto wasAccepted = scanTiles( reader, + section, outDataOffsetsMap, tilesToSkip, zoom, @@ -622,7 +649,8 @@ bool OsmAnd::ObfPoiSectionReader_P::scanTiles( tileFilter, zoomFilter, categoriesFilter, - poiAdditionalFilter); + poiAdditionalFilter, + nullptr); ObfReaderUtilities::ensureAllDataWasRead(cis); cis->PopLimit(oldLimit); @@ -682,6 +710,71 @@ bool OsmAnd::ObfPoiSectionReader_P::scanTiles( } } +void OsmAnd::ObfPoiSectionReader_P::readTagGroups(const ObfReader_P& reader, std::map> * tagGroups) +{ + const auto cis = reader.getCodedInputStream().get(); + for (;;) + { + const auto tag = cis->ReadTag(); + switch (gpb::internal::WireFormatLite::GetTagFieldNumber(tag)) + { + case 0: + return; + case OBF::OsmAndPoiTagGroups::kGroupsFieldNumber: + { + gpb::uint32 length; + cis->ReadVarint32(&length); + const auto oldLimit = cis->PushLimit(length); + readTagGroup(reader, tagGroups); + cis->PopLimit(oldLimit); + break; + } + default: + ObfReaderUtilities::skipUnknownField(cis, tag); + break; + } + } +} + +void OsmAnd::ObfPoiSectionReader_P::readTagGroup(const ObfReader_P& reader, std::map> * tagGroups) +{ + const auto cis = reader.getCodedInputStream().get(); + QList tagValues; + int id = -1; + for (;;) + { + const auto tag = cis->ReadTag(); + switch (gpb::internal::WireFormatLite::GetTagFieldNumber(tag)) + { + case 0: + { + if (id > 0 && tagValues.size() > 1 && tagValues.size() % 2 == 0) { + std::vector tagValuePairs; + for (int i = 0; i < tagValues.size(); i = i + 2) + { + tagValuePairs.push_back(TagValue(tagValues.at(i), tagValues.at(i + 1))); + } + tagGroups->insert(std::make_pair(id, tagValuePairs)); + } + return; + } + case OBF::OsmAndPoiTagGroup::kIdFieldNumber: + cis->ReadVarint32(reinterpret_cast(&id)); + break; + case OBF::OsmAndPoiTagGroup::kTagValuesFieldNumber: + { + QString value; + ObfReaderUtilities::readQString(cis, value); + tagValues.push_back(value); + break; + } + default: + ObfReaderUtilities::skipUnknownField(cis, tag); + break; + } + } +} + bool OsmAnd::ObfPoiSectionReader_P::scanTileForMatchingCategories( const ObfReader_P& reader, const QSet& categories, @@ -1163,6 +1256,25 @@ void OsmAnd::ObfPoiSectionReader_P::readAmenity( cis->ReadVarint32(&precisionXY); break; } + case OBF::OsmAndPoiBoxDataAtom::kTagGroupsFieldNumber: + { + //PoiRegion.MAP_HAS_TAG_GROUPS = true; + gpb::uint32 sz; + cis->ReadVarint32(&sz); + const auto old = cis->PushLimit(sz); + while (cis->BytesUntilLimit() > 0) + { + uint32_t tagGroupId; + cis->ReadVarint32(reinterpret_cast(&tagGroupId)); + QList list = section->getTagValues(tagGroupId); + if (list.size() > 0) + { + amenity->addTagGroup(tagGroupId, list); + } + } + cis->PopLimit(old); + break; + } default: ObfReaderUtilities::skipUnknownField(cis, t); break; @@ -1186,12 +1298,19 @@ void OsmAnd::ObfPoiSectionReader_P::readAmenitiesByName( { const auto cis = reader.getCodedInputStream().get(); QMap dataBoxesOffsetsSet; + QList nameIndexCoordinates; + BBoxIndexTree* nameIndexTree = nullptr; + QMap dataBoxesOffsetsMap; for (;;) { const auto tag = cis->ReadTag(); switch (gpb::internal::WireFormatLite::GetTagFieldNumber(tag)) { case 0: + if (nameIndexTree) + { + delete nameIndexTree; + } if (!ObfReaderUtilities::reachedDataEnd(cis)) return; @@ -1209,15 +1328,45 @@ void OsmAnd::ObfPoiSectionReader_P::readAmenitiesByName( xy31, bbox31, tileFilter, - strictMatch); + strictMatch, + section, + nameIndexCoordinates); ObfReaderUtilities::ensureAllDataWasRead(cis); cis->PopLimit(oldLimit); break; } case OBF::OsmAndPoiIndex::kBoxesFieldNumber: - ObfReaderUtilities::skipUnknownField(cis, tag); + { + const auto length = ObfReaderUtilities::readBigEndianInt(cis); + const auto oldLimit = cis->PushLimit(length); + if (nameIndexCoordinates.size() > 0) + { + AreaI area(0, 0, INT_MAX, INT_MAX); + nameIndexTree = new BBoxIndexTree(area, 8); + for (int i = 0; i < nameIndexCoordinates.size(); i = i + 2) + { + int x = nameIndexCoordinates.at(i); + int y = nameIndexCoordinates.at(i + 1); + nameIndexTree->insert(0, AreaI(x, y, x, y)); + } + } + scanTiles( + reader, + section, + dataBoxesOffsetsMap, + nullptr, + MinZoomLevel, + TileId::zero(), + bbox31, + tileFilter,//accept all ? + MinZoomLevel, + nullptr, + nullptr, + nameIndexTree); + cis->PopLimit(oldLimit); break; + } case OBF::OsmAndPoiIndex::kPoiDataFieldNumber: { auto offKeys = dataBoxesOffsetsSet.keys(); @@ -1293,7 +1442,9 @@ void OsmAnd::ObfPoiSectionReader_P::scanNameIndex( const PointI* const xy31, const AreaI* const bbox31, const TileAcceptorFunction tileFilter, - const bool strictMatch) + const bool strictMatch, + const std::shared_ptr& section, + QList& nameIndexCoordinates) { const auto cis = reader.getCodedInputStream().get(); @@ -1343,7 +1494,9 @@ void OsmAnd::ObfPoiSectionReader_P::scanNameIndex( outDataOffsets, xy31, bbox31, - tileFilter); + tileFilter, + section, + nameIndexCoordinates); ObfReaderUtilities::ensureAllDataWasRead(cis); cis->PopLimit(oldLimit); @@ -1363,7 +1516,9 @@ void OsmAnd::ObfPoiSectionReader_P::readNameIndexData( QMap& outDataOffsets, const PointI* const xy31, const AreaI* const bbox31, - const TileAcceptorFunction tileFilter) + const TileAcceptorFunction tileFilter, + const std::shared_ptr& section, + QList& nameIndexCoordinates) { const auto cis = reader.getCodedInputStream().get(); @@ -1388,7 +1543,9 @@ void OsmAnd::ObfPoiSectionReader_P::readNameIndexData( outDataOffsets, xy31, bbox31, - tileFilter); + tileFilter, + section, + nameIndexCoordinates); ObfReaderUtilities::ensureAllDataWasRead(cis); cis->PopLimit(oldLimit); @@ -1406,7 +1563,9 @@ void OsmAnd::ObfPoiSectionReader_P::readNameIndexDataAtom( QMap& outDataOffsets, const PointI* const xy31, const AreaI* const bbox31, - const TileAcceptorFunction tileFilter) + const TileAcceptorFunction tileFilter, + const std::shared_ptr& section, + QList& nameIndexCoordinates) { const auto cis = reader.getCodedInputStream().get(); auto tileId = TileId::zero(); @@ -1455,6 +1614,14 @@ void OsmAnd::ObfPoiSectionReader_P::readNameIndexDataAtom( d = qAbs(xy31->x - position31.x) + qAbs(xy31->y - position31.y); outDataOffsets.insert(dataOffset, d); } + + QList bboxResult; + section->bboxIndexCache.query(AreaI(position31.x, position31.y, position31.x, position31.y), bboxResult); + if (bboxResult.size() == 0) + { + nameIndexCoordinates.push_back(position31.x); + nameIndexCoordinates.push_back(position31.y); + } break; } default: diff --git a/src/Data/ObfPoiSectionReader_P.h b/src/Data/ObfPoiSectionReader_P.h index 2c465fad3..2aa557145 100644 --- a/src/Data/ObfPoiSectionReader_P.h +++ b/src/Data/ObfPoiSectionReader_P.h @@ -78,6 +78,7 @@ namespace OsmAnd const std::shared_ptr& queryController); static bool scanTiles( const ObfReader_P& reader, + const std::shared_ptr& section, QMap& outDataOffsetsMap, const std::shared_ptr> tilesToSkip, const ZoomLevel parentZoom, @@ -86,7 +87,8 @@ namespace OsmAnd const TileAcceptorFunction tileFilter, const ZoomLevel zoomFilter, const QSet* const categoriesFilter, - const QPair* poiAdditionalFilter); + const QPair* poiAdditionalFilter, + const BBoxIndexTree* nameIndexTree); static bool scanTileForMatchingCategories( const ObfReader_P& reader, const QSet& categories, @@ -112,19 +114,25 @@ namespace OsmAnd const PointI* const xy31, const AreaI* const bbox31, const TileAcceptorFunction tileFilter, - const bool strictMatch); + const bool strictMatch, + const std::shared_ptr& section, + QList& nameIndexCoordinates); static void readNameIndexData( const ObfReader_P& reader, QMap& outDataOffsets, const PointI* const xy31, const AreaI* const bbox31, - const TileAcceptorFunction tileFilter); + const TileAcceptorFunction tileFilter, + const std::shared_ptr& section, + QList& nameIndexCoordinates); static void readNameIndexDataAtom( const ObfReader_P& reader, QMap& outDataOffsets, const PointI* const xy31, const AreaI* const bbox31, - const TileAcceptorFunction tileFilter); + const TileAcceptorFunction tileFilter, + const std::shared_ptr& section, + QList& nameIndexCoordinates); static bool readAmenitiesDataBox( const ObfReader_P& reader, @@ -150,6 +158,8 @@ namespace OsmAnd const QSet* const categoriesFilter, const QPair* poiAdditionalFilter, const std::shared_ptr& queryController); + static void readTagGroups(const ObfReader_P& reader, std::map> * tagGroups); + static void readTagGroup(const ObfReader_P& reader, std::map> * tagGroups); public: static void loadCategories( const ObfReader_P& reader, From 8abaf8391defd12c119c78c6e39810beb2718795 Mon Sep 17 00:00:00 2001 From: ivanPyrohivskyi Date: Fri, 27 Sep 2024 19:38:18 +0300 Subject: [PATCH 2/6] Debug --- include/OsmAndCore/Data/Amenity.h | 5 +---- include/OsmAndCore/Data/ObfPoiSectionInfo.h | 11 ++------- src/Data/Amenity.cpp | 15 +++++-------- src/Data/ObfPoiSectionInfo.cpp | 10 ++------- src/Data/ObfPoiSectionReader_P.cpp | 25 ++++++++++----------- src/Data/ObfPoiSectionReader_P.h | 4 ++-- 6 files changed, 24 insertions(+), 46 deletions(-) diff --git a/include/OsmAndCore/Data/Amenity.h b/include/OsmAndCore/Data/Amenity.h index f440ea1c4..9d72b5675 100644 --- a/include/OsmAndCore/Data/Amenity.h +++ b/include/OsmAndCore/Data/Amenity.h @@ -21,7 +21,6 @@ namespace OsmAnd { class ObfPoiSectionInfo; struct ObfPoiSectionSubtype; - struct TagValue; class OSMAND_CORE_API Amenity Q_DECL_FINAL { @@ -46,13 +45,12 @@ namespace OsmAnd QString value; }; - private: - QHash> tagGroups; protected: public: Amenity(const std::shared_ptr& obfSection); virtual ~Amenity(); + QHash>> tagGroups; const std::shared_ptr obfSection; PointI position31; @@ -74,7 +72,6 @@ namespace OsmAnd const QList< std::shared_ptr >& input); QString getName(const QString lang, bool transliterate) const; - void addTagGroup(int id, QList tagValues); QString getCityFromTagGroups(QString lang) const; }; } diff --git a/include/OsmAndCore/Data/ObfPoiSectionInfo.h b/include/OsmAndCore/Data/ObfPoiSectionInfo.h index 05f7a286b..e53f79f80 100644 --- a/include/OsmAndCore/Data/ObfPoiSectionInfo.h +++ b/include/OsmAndCore/Data/ObfPoiSectionInfo.h @@ -78,13 +78,6 @@ namespace OsmAnd }; typedef OsmAnd::QuadTree BBoxIndexTree; - - struct TagValue - { - QString tag; - QString value; - TagValue(QString tag, QString value); - }; class ObfPoiSectionInfo_P; class OSMAND_CORE_API ObfPoiSectionInfo : public ObfSectionInfo @@ -103,12 +96,12 @@ namespace OsmAnd uint32_t nameIndexInnerOffset; uint32_t subtypesInnerOffset; uint32_t firstBoxInnerOffset; - mutable QHash> tagGroups; + mutable QHash>> tagGroups; mutable BBoxIndexTree bboxIndexCache; std::shared_ptr getCategories() const; std::shared_ptr getSubtypes() const; - QList getTagValues(int id) const; + QList> getTagValues(int id) const; friend class OsmAnd::ObfPoiSectionReader_P; }; diff --git a/src/Data/Amenity.cpp b/src/Data/Amenity.cpp index 3757c8f80..0561dcebb 100644 --- a/src/Data/Amenity.cpp +++ b/src/Data/Amenity.cpp @@ -242,11 +242,6 @@ QString OsmAnd::Amenity::getName(const QString lang, bool transliterate) const return name; } -void OsmAnd::Amenity::addTagGroup(int id, QList tagValues) -{ - tagGroups.insert(id, tagValues); -} - QString OsmAnd::Amenity::getCityFromTagGroups(QString lang) const { QString result = ""; @@ -254,15 +249,15 @@ QString OsmAnd::Amenity::getCityFromTagGroups(QString lang) const { for (const auto & tagValue : i.value()) { - if (tagValue.tag.endsWith("city:" + lang)) { + if (tagValue.first.endsWith("city:" + lang)) { if (result.isEmpty()) - result = tagValue.value; + result = tagValue.second; else - result += ", " + tagValue.value; + result += ", " + tagValue.second; break; } - if (tagValue.tag.endsWith("city")) - result = tagValue.value; + if (tagValue.first.endsWith("city")) + result = tagValue.second; } } return result; diff --git a/src/Data/ObfPoiSectionInfo.cpp b/src/Data/ObfPoiSectionInfo.cpp index 2bc1b0316..ec548a88a 100644 --- a/src/Data/ObfPoiSectionInfo.cpp +++ b/src/Data/ObfPoiSectionInfo.cpp @@ -16,12 +16,6 @@ OsmAnd::ObfPoiSectionInfo::~ObfPoiSectionInfo() { } -OsmAnd::TagValue::TagValue(QString tag, QString value) - : tag(tag) - , value(value) -{ -} - std::shared_ptr OsmAnd::ObfPoiSectionInfo::getCategories() const { return _p->getCategories(); @@ -32,7 +26,7 @@ std::shared_ptr OsmAnd::ObfPoiSectionInfo:: return _p->getSubtypes(); } -QList OsmAnd::ObfPoiSectionInfo::getTagValues(int id) const +QList> OsmAnd::ObfPoiSectionInfo::getTagValues(int id) const { auto it = tagGroups.find(id); if (it != tagGroups.end()) @@ -41,7 +35,7 @@ QList OsmAnd::ObfPoiSectionInfo::getTagValues(int id) const } else { - return {}; + return QList>(); } } diff --git a/src/Data/ObfPoiSectionReader_P.cpp b/src/Data/ObfPoiSectionReader_P.cpp index b3bd2148e..90f1eee35 100644 --- a/src/Data/ObfPoiSectionReader_P.cpp +++ b/src/Data/ObfPoiSectionReader_P.cpp @@ -581,7 +581,7 @@ bool OsmAnd::ObfPoiSectionReader_P::scanTiles( } } - if (!rejectBox && bbox31 && !intersectWithNameIndex) + if (!rejectBox && bbox31) { rejectBox = !bbox31->contains(tileBBox31) && @@ -589,7 +589,7 @@ bool OsmAnd::ObfPoiSectionReader_P::scanTiles( !bbox31->intersects(tileBBox31); } - if (rejectBox) + if (rejectBox && !intersectWithNameIndex) { cis->Skip(cis->BytesUntilLimit()); return false; @@ -626,9 +626,7 @@ bool OsmAnd::ObfPoiSectionReader_P::scanTiles( gpb::uint32 tagGroupLength; cis->ReadVarint32(&tagGroupLength); const auto old = cis->PushLimit(tagGroupLength); - std::map> ttt; - readTagGroups(reader, &ttt); - //section->tagGroups = ttt; + readTagGroups(reader, section->tagGroups); cis->PopLimit(old); break; } @@ -710,7 +708,7 @@ bool OsmAnd::ObfPoiSectionReader_P::scanTiles( } } -void OsmAnd::ObfPoiSectionReader_P::readTagGroups(const ObfReader_P& reader, std::map> * tagGroups) +void OsmAnd::ObfPoiSectionReader_P::readTagGroups(const ObfReader_P& reader, QHash>> & tagGroups) { const auto cis = reader.getCodedInputStream().get(); for (;;) @@ -736,7 +734,7 @@ void OsmAnd::ObfPoiSectionReader_P::readTagGroups(const ObfReader_P& reader, std } } -void OsmAnd::ObfPoiSectionReader_P::readTagGroup(const ObfReader_P& reader, std::map> * tagGroups) +void OsmAnd::ObfPoiSectionReader_P::readTagGroup(const ObfReader_P& reader, QHash>> & tagGroups) { const auto cis = reader.getCodedInputStream().get(); QList tagValues; @@ -749,12 +747,11 @@ void OsmAnd::ObfPoiSectionReader_P::readTagGroup(const ObfReader_P& reader, std: case 0: { if (id > 0 && tagValues.size() > 1 && tagValues.size() % 2 == 0) { - std::vector tagValuePairs; + auto it = tagGroups.insert(id, {}); for (int i = 0; i < tagValues.size(); i = i + 2) { - tagValuePairs.push_back(TagValue(tagValues.at(i), tagValues.at(i + 1))); + it->push_back(qMakePair(tagValues.at(i), tagValues.at(i + 1))); } - tagGroups->insert(std::make_pair(id, tagValuePairs)); } return; } @@ -989,6 +986,7 @@ void OsmAnd::ObfPoiSectionReader_P::readAmenity( QVector textValueSubtypeIndices; QHash intValues; QHash stringOrDataValues; + QHash>> tagGroupsAmenity; auto categoriesFilterChecked = false; const CollatorStringMatcher matcher(query, StringMatcherMode::CHECK_STARTS_FROM_SPACE); uint32_t precisionXY = 0; @@ -1098,6 +1096,7 @@ void OsmAnd::ObfPoiSectionReader_P::readAmenity( amenity->id = id; amenity->values = detachedOf(intValues).unite(stringOrDataValues); amenity->evaluateTypes(); + amenity->tagGroups = qMove(tagGroupsAmenity); outAmenity = amenity; return; } @@ -1266,10 +1265,10 @@ void OsmAnd::ObfPoiSectionReader_P::readAmenity( { uint32_t tagGroupId; cis->ReadVarint32(reinterpret_cast(&tagGroupId)); - QList list = section->getTagValues(tagGroupId); + auto list = section->getTagValues(tagGroupId); if (list.size() > 0) { - amenity->addTagGroup(tagGroupId, list); + tagGroupsAmenity.insert(tagGroupId, list); } } cis->PopLimit(old); @@ -1348,7 +1347,7 @@ void OsmAnd::ObfPoiSectionReader_P::readAmenitiesByName( { int x = nameIndexCoordinates.at(i); int y = nameIndexCoordinates.at(i + 1); - nameIndexTree->insert(0, AreaI(x, y, x, y)); + nameIndexTree->insert(0, AreaI(y, x, y, x)); } } scanTiles( diff --git a/src/Data/ObfPoiSectionReader_P.h b/src/Data/ObfPoiSectionReader_P.h index 2aa557145..7ac549435 100644 --- a/src/Data/ObfPoiSectionReader_P.h +++ b/src/Data/ObfPoiSectionReader_P.h @@ -158,8 +158,8 @@ namespace OsmAnd const QSet* const categoriesFilter, const QPair* poiAdditionalFilter, const std::shared_ptr& queryController); - static void readTagGroups(const ObfReader_P& reader, std::map> * tagGroups); - static void readTagGroup(const ObfReader_P& reader, std::map> * tagGroups); + static void readTagGroups(const ObfReader_P& reader, QHash>> & tagGroups); + static void readTagGroup(const ObfReader_P& reader, QHash>> & tagGroups); public: static void loadCategories( const ObfReader_P& reader, From 00b88750c9c9a3703b601a6018ebffd7bba363e8 Mon Sep 17 00:00:00 2001 From: ivanPyrohivskyi Date: Fri, 27 Sep 2024 20:35:00 +0300 Subject: [PATCH 3/6] Formatting --- src/Data/ObfPoiSectionReader_P.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Data/ObfPoiSectionReader_P.cpp b/src/Data/ObfPoiSectionReader_P.cpp index 90f1eee35..535fe8d68 100644 --- a/src/Data/ObfPoiSectionReader_P.cpp +++ b/src/Data/ObfPoiSectionReader_P.cpp @@ -622,7 +622,6 @@ bool OsmAnd::ObfPoiSectionReader_P::scanTiles( } case OBF::OsmAndPoiBox::kTagGroupsFieldNumber: { - //PoiRegion.MAP_HAS_TAG_GROUPS = true; gpb::uint32 tagGroupLength; cis->ReadVarint32(&tagGroupLength); const auto old = cis->PushLimit(tagGroupLength); @@ -1257,7 +1256,6 @@ void OsmAnd::ObfPoiSectionReader_P::readAmenity( } case OBF::OsmAndPoiBoxDataAtom::kTagGroupsFieldNumber: { - //PoiRegion.MAP_HAS_TAG_GROUPS = true; gpb::uint32 sz; cis->ReadVarint32(&sz); const auto old = cis->PushLimit(sz); @@ -1358,7 +1356,7 @@ void OsmAnd::ObfPoiSectionReader_P::readAmenitiesByName( MinZoomLevel, TileId::zero(), bbox31, - tileFilter,//accept all ? + tileFilter, MinZoomLevel, nullptr, nullptr, From d6ed2e3594e651ec747ce1efcb2e1ec82483f550 Mon Sep 17 00:00:00 2001 From: ivanPyrohivskyi Date: Mon, 30 Sep 2024 11:55:02 +0300 Subject: [PATCH 4/6] Fix after review --- include/OsmAndCore/Data/Amenity.h | 2 +- include/OsmAndCore/Data/ObfPoiSectionInfo.h | 2 +- src/Data/Amenity.cpp | 6 +++--- src/Data/ObfPoiSectionInfo.cpp | 2 +- src/Data/ObfPoiSectionReader_P.cpp | 21 +++++++++------------ src/Data/ObfPoiSectionReader_P.h | 4 ++-- 6 files changed, 17 insertions(+), 20 deletions(-) diff --git a/include/OsmAndCore/Data/Amenity.h b/include/OsmAndCore/Data/Amenity.h index 9d72b5675..4dfb45bca 100644 --- a/include/OsmAndCore/Data/Amenity.h +++ b/include/OsmAndCore/Data/Amenity.h @@ -72,7 +72,7 @@ namespace OsmAnd const QList< std::shared_ptr >& input); QString getName(const QString lang, bool transliterate) const; - QString getCityFromTagGroups(QString lang) const; + QString getCityFromTagGroups(const QString & lang) const; }; } diff --git a/include/OsmAndCore/Data/ObfPoiSectionInfo.h b/include/OsmAndCore/Data/ObfPoiSectionInfo.h index e53f79f80..6abf72b17 100644 --- a/include/OsmAndCore/Data/ObfPoiSectionInfo.h +++ b/include/OsmAndCore/Data/ObfPoiSectionInfo.h @@ -96,7 +96,7 @@ namespace OsmAnd uint32_t nameIndexInnerOffset; uint32_t subtypesInnerOffset; uint32_t firstBoxInnerOffset; - mutable QHash>> tagGroups; + mutable QHash>> tagGroups; mutable BBoxIndexTree bboxIndexCache; std::shared_ptr getCategories() const; diff --git a/src/Data/Amenity.cpp b/src/Data/Amenity.cpp index 0561dcebb..e10848795 100644 --- a/src/Data/Amenity.cpp +++ b/src/Data/Amenity.cpp @@ -242,21 +242,21 @@ QString OsmAnd::Amenity::getName(const QString lang, bool transliterate) const return name; } -QString OsmAnd::Amenity::getCityFromTagGroups(QString lang) const +QString OsmAnd::Amenity::getCityFromTagGroups(const QString & lang) const { QString result = ""; for (auto i = tagGroups.begin(); i != tagGroups.end(); ++i) { for (const auto & tagValue : i.value()) { - if (tagValue.first.endsWith("city:" + lang)) { + if (tagValue.first.endsWith(QStringLiteral("city:") + lang)) { if (result.isEmpty()) result = tagValue.second; else result += ", " + tagValue.second; break; } - if (tagValue.first.endsWith("city")) + if (tagValue.first.endsWith(QStringLiteral("city"))) result = tagValue.second; } } diff --git a/src/Data/ObfPoiSectionInfo.cpp b/src/Data/ObfPoiSectionInfo.cpp index ec548a88a..e04d5d0a9 100644 --- a/src/Data/ObfPoiSectionInfo.cpp +++ b/src/Data/ObfPoiSectionInfo.cpp @@ -8,7 +8,7 @@ OsmAnd::ObfPoiSectionInfo::ObfPoiSectionInfo(const std::shared_ptr>> & tagGroups) +void OsmAnd::ObfPoiSectionReader_P::readTagGroups(const ObfReader_P& reader, QHash>> & tagGroups) { const auto cis = reader.getCodedInputStream().get(); for (;;) @@ -733,7 +733,7 @@ void OsmAnd::ObfPoiSectionReader_P::readTagGroups(const ObfReader_P& reader, QHa } } -void OsmAnd::ObfPoiSectionReader_P::readTagGroup(const ObfReader_P& reader, QHash>> & tagGroups) +void OsmAnd::ObfPoiSectionReader_P::readTagGroup(const ObfReader_P& reader, QHash>> & tagGroups) { const auto cis = reader.getCodedInputStream().get(); QList tagValues; @@ -1296,7 +1296,6 @@ void OsmAnd::ObfPoiSectionReader_P::readAmenitiesByName( const auto cis = reader.getCodedInputStream().get(); QMap dataBoxesOffsetsSet; QList nameIndexCoordinates; - BBoxIndexTree* nameIndexTree = nullptr; QMap dataBoxesOffsetsMap; for (;;) { @@ -1304,10 +1303,6 @@ void OsmAnd::ObfPoiSectionReader_P::readAmenitiesByName( switch (gpb::internal::WireFormatLite::GetTagFieldNumber(tag)) { case 0: - if (nameIndexTree) - { - delete nameIndexTree; - } if (!ObfReaderUtilities::reachedDataEnd(cis)) return; @@ -1337,16 +1332,18 @@ void OsmAnd::ObfPoiSectionReader_P::readAmenitiesByName( { const auto length = ObfReaderUtilities::readBigEndianInt(cis); const auto oldLimit = cis->PushLimit(length); + BBoxIndexTree nameIndexTree; + bool hasTree = false; if (nameIndexCoordinates.size() > 0) { - AreaI area(0, 0, INT_MAX, INT_MAX); - nameIndexTree = new BBoxIndexTree(area, 8); + nameIndexTree = BBoxIndexTree(AreaI::largestPositive(), 8); for (int i = 0; i < nameIndexCoordinates.size(); i = i + 2) { int x = nameIndexCoordinates.at(i); int y = nameIndexCoordinates.at(i + 1); - nameIndexTree->insert(0, AreaI(y, x, y, x)); + nameIndexTree.insert(0, AreaI(y, x, y, x)); } + hasTree = true; } scanTiles( reader, @@ -1360,7 +1357,7 @@ void OsmAnd::ObfPoiSectionReader_P::readAmenitiesByName( MinZoomLevel, nullptr, nullptr, - nameIndexTree); + hasTree ? &nameIndexTree : nullptr); cis->PopLimit(oldLimit); break; } @@ -1613,7 +1610,7 @@ void OsmAnd::ObfPoiSectionReader_P::readNameIndexDataAtom( } QList bboxResult; - section->bboxIndexCache.query(AreaI(position31.x, position31.y, position31.x, position31.y), bboxResult); + section->bboxIndexCache.query(AreaI(position31.y, position31.x, position31.y, position31.x), bboxResult); if (bboxResult.size() == 0) { nameIndexCoordinates.push_back(position31.x); diff --git a/src/Data/ObfPoiSectionReader_P.h b/src/Data/ObfPoiSectionReader_P.h index 7ac549435..0c1acf172 100644 --- a/src/Data/ObfPoiSectionReader_P.h +++ b/src/Data/ObfPoiSectionReader_P.h @@ -158,8 +158,8 @@ namespace OsmAnd const QSet* const categoriesFilter, const QPair* poiAdditionalFilter, const std::shared_ptr& queryController); - static void readTagGroups(const ObfReader_P& reader, QHash>> & tagGroups); - static void readTagGroup(const ObfReader_P& reader, QHash>> & tagGroups); + static void readTagGroups(const ObfReader_P& reader, QHash>> & tagGroups); + static void readTagGroup(const ObfReader_P& reader, QHash>> & tagGroups); public: static void loadCategories( const ObfReader_P& reader, From 26c764d70b8802a6ee2f105e789eb872c3b3d428 Mon Sep 17 00:00:00 2001 From: ivanPyrohivskyi Date: Mon, 30 Sep 2024 17:59:06 +0300 Subject: [PATCH 5/6] Transfer changes in Android --- include/OsmAndCore/Data/Amenity.h | 2 ++ include/OsmAndCore/Data/ObfPoiSectionInfo.h | 2 +- src/Data/Amenity.cpp | 33 ++++++++++++++++----- src/Data/ObfPoiSectionInfo.cpp | 2 +- src/Data/ObfPoiSectionReader_P.cpp | 2 +- 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/include/OsmAndCore/Data/Amenity.h b/include/OsmAndCore/Data/Amenity.h index 4dfb45bca..58ff60e4a 100644 --- a/include/OsmAndCore/Data/Amenity.h +++ b/include/OsmAndCore/Data/Amenity.h @@ -45,6 +45,8 @@ namespace OsmAnd QString value; }; + private: + bool isCityTypeAccept(QString & type) const; protected: public: Amenity(const std::shared_ptr& obfSection); diff --git a/include/OsmAndCore/Data/ObfPoiSectionInfo.h b/include/OsmAndCore/Data/ObfPoiSectionInfo.h index 6abf72b17..db8af1620 100644 --- a/include/OsmAndCore/Data/ObfPoiSectionInfo.h +++ b/include/OsmAndCore/Data/ObfPoiSectionInfo.h @@ -101,7 +101,7 @@ namespace OsmAnd std::shared_ptr getCategories() const; std::shared_ptr getSubtypes() const; - QList> getTagValues(int id) const; + QList> getTagValues(uint32_t id) const; friend class OsmAnd::ObfPoiSectionReader_P; }; diff --git a/src/Data/Amenity.cpp b/src/Data/Amenity.cpp index e10848795..4a11d4550 100644 --- a/src/Data/Amenity.cpp +++ b/src/Data/Amenity.cpp @@ -247,18 +247,35 @@ QString OsmAnd::Amenity::getCityFromTagGroups(const QString & lang) const QString result = ""; for (auto i = tagGroups.begin(); i != tagGroups.end(); ++i) { + QString translated = ""; + QString nonTranslated = ""; + QString type = ""; for (const auto & tagValue : i.value()) { - if (tagValue.first.endsWith(QStringLiteral("city:") + lang)) { - if (result.isEmpty()) - result = tagValue.second; - else - result += ", " + tagValue.second; - break; + if (tagValue.first == (QStringLiteral("name:") + lang)) + { + translated = tagValue.second; + } + if (tagValue.first == QStringLiteral("name")) + { + nonTranslated = tagValue.second; + } + if (tagValue.first == QStringLiteral("place")) + { + type = tagValue.second; } - if (tagValue.first.endsWith(QStringLiteral("city"))) - result = tagValue.second; + } + QString name = translated.isEmpty() ? nonTranslated : translated; + if (!name.isEmpty() && isCityTypeAccept(type)) { + result = result.isEmpty() ? name : result + ", " + name; } } return result; } + +bool OsmAnd::Amenity::isCityTypeAccept(QString & type) const +{ + if (type.isEmpty()) + return false; + return type != QStringLiteral("district") && type != QStringLiteral("neighbourhood") && type != QStringLiteral("borough"); +} diff --git a/src/Data/ObfPoiSectionInfo.cpp b/src/Data/ObfPoiSectionInfo.cpp index e04d5d0a9..aa1c06fd6 100644 --- a/src/Data/ObfPoiSectionInfo.cpp +++ b/src/Data/ObfPoiSectionInfo.cpp @@ -26,7 +26,7 @@ std::shared_ptr OsmAnd::ObfPoiSectionInfo:: return _p->getSubtypes(); } -QList> OsmAnd::ObfPoiSectionInfo::getTagValues(int id) const +QList> OsmAnd::ObfPoiSectionInfo::getTagValues(uint32_t id) const { auto it = tagGroups.find(id); if (it != tagGroups.end()) diff --git a/src/Data/ObfPoiSectionReader_P.cpp b/src/Data/ObfPoiSectionReader_P.cpp index 57b357110..faad301b2 100644 --- a/src/Data/ObfPoiSectionReader_P.cpp +++ b/src/Data/ObfPoiSectionReader_P.cpp @@ -737,7 +737,7 @@ void OsmAnd::ObfPoiSectionReader_P::readTagGroup(const ObfReader_P& reader, QHas { const auto cis = reader.getCodedInputStream().get(); QList tagValues; - int id = -1; + uint32_t id = 0; for (;;) { const auto tag = cis->ReadTag(); From 3fc00458b38873b566a86310cd97099411c4bdb4 Mon Sep 17 00:00:00 2001 From: ivanPyrohivskyi Date: Mon, 30 Sep 2024 18:45:21 +0300 Subject: [PATCH 6/6] Fix --- include/OsmAndCore/Data/Amenity.h | 2 +- src/Data/Amenity.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/OsmAndCore/Data/Amenity.h b/include/OsmAndCore/Data/Amenity.h index 58ff60e4a..4d63e83dd 100644 --- a/include/OsmAndCore/Data/Amenity.h +++ b/include/OsmAndCore/Data/Amenity.h @@ -46,7 +46,7 @@ namespace OsmAnd }; private: - bool isCityTypeAccept(QString & type) const; + bool isCityTypeAccept(const QString & type) const; protected: public: Amenity(const std::shared_ptr& obfSection); diff --git a/src/Data/Amenity.cpp b/src/Data/Amenity.cpp index 4a11d4550..4001f0132 100644 --- a/src/Data/Amenity.cpp +++ b/src/Data/Amenity.cpp @@ -273,7 +273,7 @@ QString OsmAnd::Amenity::getCityFromTagGroups(const QString & lang) const return result; } -bool OsmAnd::Amenity::isCityTypeAccept(QString & type) const +bool OsmAnd::Amenity::isCityTypeAccept(const QString & type) const { if (type.isEmpty()) return false;