mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-04 20:03:45 +00:00
Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run: git remote add om-historic [om-historic.git repo url] git fetch --tags om-historic git replace squashed-history historic-commits
This commit is contained in:
41
openlr/road_info_getter.cpp
Normal file
41
openlr/road_info_getter.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
#include "openlr/road_info_getter.hpp"
|
||||
|
||||
#include "indexer/classificator.hpp"
|
||||
#include "indexer/feature.hpp"
|
||||
#include "indexer/data_source.hpp"
|
||||
|
||||
#include "base/assert.hpp"
|
||||
|
||||
namespace openlr
|
||||
{
|
||||
// RoadInfoGetter::RoadInfo ------------------------------------------------------------------------
|
||||
RoadInfoGetter::RoadInfo::RoadInfo(FeatureType & ft)
|
||||
: m_hwClass(ftypes::GetHighwayClass(feature::TypesHolder(ft)))
|
||||
, m_link(ftypes::IsLinkChecker::Instance()(ft))
|
||||
, m_oneWay(ftypes::IsOneWayChecker::Instance()(ft))
|
||||
, m_isRoundabout(ftypes::IsRoundAboutChecker::Instance()(ft))
|
||||
{
|
||||
}
|
||||
|
||||
// RoadInfoGetter ----------------------------------------------------------------------------------
|
||||
RoadInfoGetter::RoadInfoGetter(DataSource const & dataSource)
|
||||
: m_dataSource(dataSource)
|
||||
{
|
||||
}
|
||||
|
||||
RoadInfoGetter::RoadInfo RoadInfoGetter::Get(FeatureID const & fid)
|
||||
{
|
||||
auto it = m_cache.find(fid);
|
||||
if (it != end(m_cache))
|
||||
return it->second;
|
||||
|
||||
FeaturesLoaderGuard g(m_dataSource, fid.m_mwmId);
|
||||
auto ft = g.GetOriginalFeatureByIndex(fid.m_index);
|
||||
CHECK(ft, ());
|
||||
|
||||
RoadInfo info(*ft);
|
||||
it = m_cache.emplace(fid, info).first;
|
||||
|
||||
return it->second;
|
||||
}
|
||||
} // namespace openlr
|
||||
Reference in New Issue
Block a user