mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-07 13:03:54 +00:00
[map] Removed Framework::m_popularityLoader.
Signed-off-by: Viktor Govako <viktor.govako@gmail.com>
This commit is contained in:
@@ -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
|
||||
@@ -153,7 +151,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);
|
||||
};
|
||||
@@ -284,7 +284,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.
|
||||
@@ -453,7 +452,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"
|
||||
@@ -485,8 +484,6 @@ private:
|
||||
|
||||
TrackRecordingUpdateHandler m_trackRecordingUpdateHandler;
|
||||
|
||||
CachingRankTableLoader m_popularityLoader;
|
||||
|
||||
std::unique_ptr<descriptions::Loader> m_descriptionsLoader;
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user