mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 04:53:36 +00:00
Added ftype::Trunc.
Signed-off-by: Viktor Govako <viktor.govako@gmail.com>
This commit is contained in:
committed by
Konstantin Pastbin
parent
4e9efa63ff
commit
11ee2b121b
@@ -95,10 +95,9 @@ string GetWheelchairType(FeatureType & f)
|
||||
{
|
||||
static const uint32_t wheelchair = classif().GetTypeByPath({"wheelchair"});
|
||||
string result;
|
||||
f.ForEachType([&result](uint32_t type) {
|
||||
uint32_t truncated = type;
|
||||
ftype::TruncValue(truncated, 1);
|
||||
if (truncated == wheelchair)
|
||||
f.ForEachType([&result](uint32_t type)
|
||||
{
|
||||
if (ftype::Trunc(type, 1) == wheelchair)
|
||||
{
|
||||
string fullName = classif().GetReadableObjectName(type);
|
||||
auto pos = fullName.find("-");
|
||||
|
||||
@@ -24,6 +24,11 @@ namespace ftype
|
||||
uint8_t GetValue(uint32_t type, uint8_t level);
|
||||
void PopValue(uint32_t & type);
|
||||
void TruncValue(uint32_t & type, uint8_t level);
|
||||
inline uint32_t Trunc(uint32_t type, uint8_t level)
|
||||
{
|
||||
TruncValue(type, level);
|
||||
return type;
|
||||
}
|
||||
uint8_t GetLevel(uint32_t type);
|
||||
}
|
||||
|
||||
|
||||
@@ -417,9 +417,7 @@ void FeatureParams::SetRwSubwayType(char const * cityName)
|
||||
|
||||
for (size_t i = 0; i < m_types.size(); ++i)
|
||||
{
|
||||
uint32_t t = m_types[i];
|
||||
ftype::TruncValue(t, 2);
|
||||
if (t == src)
|
||||
if (ftype::Trunc(m_types[i], 2) == src)
|
||||
{
|
||||
m_types[i] = dest;
|
||||
break;
|
||||
@@ -492,9 +490,7 @@ uint32_t FeatureParams::FindType(uint32_t comp, uint8_t level) const
|
||||
{
|
||||
for (uint32_t const type : m_types)
|
||||
{
|
||||
uint32_t t = type;
|
||||
ftype::TruncValue(t, level);
|
||||
if (t == comp)
|
||||
if (ftype::Trunc(type, level) == comp)
|
||||
return type;
|
||||
}
|
||||
return ftype::GetEmptyValue();
|
||||
|
||||
@@ -23,10 +23,7 @@ public:
|
||||
{
|
||||
for (auto level = ftype::GetLevel(t); level; --level)
|
||||
{
|
||||
auto truncatedType = t;
|
||||
ftype::TruncValue(truncatedType, level);
|
||||
auto const it = m_mapping.find(truncatedType);
|
||||
|
||||
auto const it = m_mapping.find(ftype::Trunc(t, level));
|
||||
if (it != m_mapping.cend())
|
||||
return it;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user