mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 04:53:36 +00:00
[map] Removed Framework::m_popularityLoader.
Signed-off-by: Viktor Govako <viktor.govako@gmail.com>
This commit is contained in:
committed by
Konstantin Pastbin
parent
3faf052b32
commit
5ab07ea610
@@ -5,8 +5,6 @@ set(SRC
|
||||
altitude_loader.hpp
|
||||
brands_holder.cpp
|
||||
brands_holder.hpp
|
||||
caching_rank_table_loader.cpp
|
||||
caching_rank_table_loader.hpp
|
||||
categories_holder.cpp
|
||||
categories_holder.hpp
|
||||
categories_holder_loader.cpp
|
||||
@@ -155,7 +153,6 @@ file(COPY ${OTHER_FILES} DESTINATION ${CMAKE_BINARY_DIR})
|
||||
omim_add_library(${PROJECT_NAME} ${SRC})
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
search # search::DummyRankTable in CachingRankTableLoader
|
||||
platform
|
||||
geometry
|
||||
protobuf
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
#include "indexer/caching_rank_table_loader.hpp"
|
||||
|
||||
#include "search/dummy_rank_table.hpp"
|
||||
|
||||
#include "indexer/data_source.hpp"
|
||||
|
||||
CachingRankTableLoader::CachingRankTableLoader(DataSource const & dataSource, std::string const & sectionName)
|
||||
: m_dataSource(dataSource)
|
||||
, m_sectionName(sectionName)
|
||||
{}
|
||||
|
||||
uint8_t CachingRankTableLoader::Get(FeatureID const & featureId) const
|
||||
{
|
||||
auto const handle = m_dataSource.GetMwmHandleById(featureId.m_mwmId);
|
||||
|
||||
if (!handle.IsAlive())
|
||||
return search::RankTable::kNoRank;
|
||||
|
||||
auto it = m_deserializers.find(featureId.m_mwmId);
|
||||
|
||||
if (it == m_deserializers.end())
|
||||
{
|
||||
auto rankTable = search::RankTable::Load(handle.GetValue()->m_cont, m_sectionName);
|
||||
|
||||
if (!rankTable)
|
||||
rankTable = std::make_unique<search::DummyRankTable>();
|
||||
|
||||
auto const result = m_deserializers.emplace(featureId.m_mwmId, std::move(rankTable));
|
||||
it = result.first;
|
||||
}
|
||||
|
||||
return it->second->Get(featureId.m_index);
|
||||
}
|
||||
|
||||
void CachingRankTableLoader::OnMwmDeregistered(platform::LocalCountryFile const & localFile)
|
||||
{
|
||||
for (auto it = m_deserializers.begin(); it != m_deserializers.end(); ++it)
|
||||
{
|
||||
if (it->first.IsDeregistered(localFile))
|
||||
{
|
||||
m_deserializers.erase(it);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "indexer/feature_decl.hpp"
|
||||
#include "indexer/mwm_set.hpp"
|
||||
#include "indexer/rank_table.hpp"
|
||||
|
||||
#include "base/macros.hpp"
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
class DataSource;
|
||||
struct FeatureID;
|
||||
|
||||
// *NOTE* This class IS NOT thread-safe.
|
||||
class CachingRankTableLoader
|
||||
{
|
||||
public:
|
||||
CachingRankTableLoader(DataSource const & dataSource, std::string const & sectionName);
|
||||
|
||||
/// @return 0 if there is no rank for feature.
|
||||
uint8_t Get(FeatureID const & featureId) const;
|
||||
void OnMwmDeregistered(platform::LocalCountryFile const & localFile);
|
||||
|
||||
private:
|
||||
DataSource const & m_dataSource;
|
||||
std::string const m_sectionName;
|
||||
mutable std::map<MwmSet::MwmId, std::unique_ptr<search::RankTable>> m_deserializers;
|
||||
|
||||
DISALLOW_COPY(CachingRankTableLoader);
|
||||
};
|
||||
@@ -276,7 +276,6 @@ Framework::Framework(FrameworkParams const & params, bool loadMaps)
|
||||
, m_trafficManager(bind(&Framework::GetMwmsByRect, this, _1, false /* rough */), kMaxTrafficCacheSizeBytes,
|
||||
m_routingManager.RoutingSession())
|
||||
, m_lastReportedCountry(kInvalidCountryId)
|
||||
, m_popularityLoader(m_featuresFetcher.GetDataSource(), POPULARITY_RANKS_FILE_TAG)
|
||||
, m_descriptionsLoader(std::make_unique<descriptions::Loader>(m_featuresFetcher.GetDataSource()))
|
||||
{
|
||||
// Editor should be initialized from the main thread to set its ThreadChecker.
|
||||
@@ -445,7 +444,6 @@ void Framework::OnMapDeregistered(platform::LocalCountryFile const & localFile)
|
||||
m_transitManager.OnMwmDeregistered(localFile);
|
||||
m_isolinesManager.OnMwmDeregistered(localFile);
|
||||
m_trafficManager.OnMwmDeregistered(localFile);
|
||||
m_popularityLoader.OnMwmDeregistered(localFile);
|
||||
|
||||
m_storage.DeleteCustomCountryVersion(localFile);
|
||||
};
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "editor/new_feature_categories.hpp"
|
||||
#include "editor/osm_editor.hpp"
|
||||
|
||||
#include "indexer/caching_rank_table_loader.hpp"
|
||||
#include "indexer/data_source.hpp"
|
||||
#include "indexer/data_source_helpers.hpp"
|
||||
#include "indexer/map_object.hpp"
|
||||
@@ -484,8 +483,6 @@ private:
|
||||
|
||||
TrackRecordingUpdateHandler m_trackRecordingUpdateHandler;
|
||||
|
||||
CachingRankTableLoader m_popularityLoader;
|
||||
|
||||
std::unique_ptr<descriptions::Loader> m_descriptionsLoader;
|
||||
|
||||
public:
|
||||
|
||||
@@ -46,8 +46,6 @@
|
||||
394E1E0B22BBB5EB00E4BC75 /* utils.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 394E1E0922BBB5EB00E4BC75 /* utils.hpp */; };
|
||||
39F376C0207D32450058E8E0 /* cities_boundaries_serdes_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 39F376BE207D32410058E8E0 /* cities_boundaries_serdes_tests.cpp */; };
|
||||
39F376C3207D32510058E8E0 /* scale_index_reading_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 39F376C1207D324E0058E8E0 /* scale_index_reading_tests.cpp */; };
|
||||
3D12E3D72111B4BE0015A9A9 /* caching_rank_table_loader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D12E3D52111B4BD0015A9A9 /* caching_rank_table_loader.cpp */; };
|
||||
3D12E3D82111B4BE0015A9A9 /* caching_rank_table_loader.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 3D12E3D62111B4BD0015A9A9 /* caching_rank_table_loader.hpp */; };
|
||||
3D489BC61D3D220F0052AA38 /* editable_map_object_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D489BA71D3D1F8A0052AA38 /* editable_map_object_test.cpp */; };
|
||||
3D489BC71D3D22150052AA38 /* features_vector_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D489BA81D3D1F8A0052AA38 /* features_vector_test.cpp */; };
|
||||
3D489BC81D3D22190052AA38 /* string_slice_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D489BA91D3D1F8A0052AA38 /* string_slice_tests.cpp */; };
|
||||
@@ -271,8 +269,6 @@
|
||||
394E1E0922BBB5EB00E4BC75 /* utils.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = utils.hpp; sourceTree = "<group>"; };
|
||||
39F376BE207D32410058E8E0 /* cities_boundaries_serdes_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cities_boundaries_serdes_tests.cpp; sourceTree = "<group>"; };
|
||||
39F376C1207D324E0058E8E0 /* scale_index_reading_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = scale_index_reading_tests.cpp; sourceTree = "<group>"; };
|
||||
3D12E3D52111B4BD0015A9A9 /* caching_rank_table_loader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = caching_rank_table_loader.cpp; sourceTree = "<group>"; };
|
||||
3D12E3D62111B4BD0015A9A9 /* caching_rank_table_loader.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = caching_rank_table_loader.hpp; sourceTree = "<group>"; };
|
||||
3D452AF71EE6D9F5009EAB9B /* wheelchair_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wheelchair_tests.cpp; sourceTree = "<group>"; };
|
||||
3D452AF81EE6D9F5009EAB9B /* feature_names_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = feature_names_test.cpp; sourceTree = "<group>"; };
|
||||
3D452AF91EE6D9F5009EAB9B /* centers_table_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = centers_table_test.cpp; sourceTree = "<group>"; };
|
||||
@@ -609,8 +605,6 @@
|
||||
34664CEF1D49FEC1003D7096 /* altitude_loader.hpp */,
|
||||
4088CE1F21AE993F00E2702A /* brands_holder.cpp */,
|
||||
4088CE1E21AE993F00E2702A /* brands_holder.hpp */,
|
||||
3D12E3D52111B4BD0015A9A9 /* caching_rank_table_loader.cpp */,
|
||||
3D12E3D62111B4BD0015A9A9 /* caching_rank_table_loader.hpp */,
|
||||
56C74C121C749E4700B71B9F /* categories_holder_loader.cpp */,
|
||||
56C74C131C749E4700B71B9F /* categories_holder.cpp */,
|
||||
56C74C141C749E4700B71B9F /* categories_holder.hpp */,
|
||||
@@ -788,7 +782,6 @@
|
||||
347F337D1C454242009758CC /* succinct_trie_builder.hpp in Headers */,
|
||||
675341381A3F540F00A0A8C3 /* mwm_set.hpp in Headers */,
|
||||
456E1B181F90E5B7009C32E1 /* cities_boundaries_serdes.hpp in Headers */,
|
||||
3D12E3D82111B4BE0015A9A9 /* caching_rank_table_loader.hpp in Headers */,
|
||||
670EE56D1B60033A001E8064 /* unique_index.hpp in Headers */,
|
||||
675340FF1A3F540F00A0A8C3 /* cell_coverer.hpp in Headers */,
|
||||
56C74C251C749E4700B71B9F /* search_string_utils.hpp in Headers */,
|
||||
@@ -1001,7 +994,6 @@
|
||||
6753410D1A3F540F00A0A8C3 /* drawing_rules.cpp in Sources */,
|
||||
675341301A3F540F00A0A8C3 /* data_source.cpp in Sources */,
|
||||
34664CF61D49FEC1003D7096 /* centers_table.cpp in Sources */,
|
||||
3D12E3D72111B4BE0015A9A9 /* caching_rank_table_loader.cpp in Sources */,
|
||||
6753414D1A3F540F00A0A8C3 /* types_mapping.cpp in Sources */,
|
||||
34583BC71C88552100F94664 /* cuisines.cpp in Sources */,
|
||||
675341121A3F540F00A0A8C3 /* feature_algo.cpp in Sources */,
|
||||
|
||||
Reference in New Issue
Block a user