From 582262e720015a6bd022c4c8be890da85f52c84c Mon Sep 17 00:00:00 2001 From: vng Date: Thu, 30 Oct 2014 17:30:04 +0300 Subject: [PATCH] Review fixes. --- generator/feature_builder.cpp | 2 +- generator/osm_element.hpp | 2 +- indexer/feature_visibility.cpp | 8 +++++--- routing/vehicle_model.cpp | 17 +++++++++++------ 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/generator/feature_builder.cpp b/generator/feature_builder.cpp index 56b8d3f8ae..de89683db6 100644 --- a/generator/feature_builder.cpp +++ b/generator/feature_builder.cpp @@ -243,7 +243,7 @@ void FeatureBuilder1::RemoveUselessNames() { using namespace feature; - static TypeSetChecker checkBoundary({ "boundary", "administrative" }); + static TypeSetChecker const checkBoundary({ "boundary", "administrative" }); TypesHolder types(GetFeatureBase()); if (types.RemoveIf(bind(&TypeSetChecker::IsEqual, cref(checkBoundary), _1))) diff --git a/generator/osm_element.hpp b/generator/osm_element.hpp index a0782b1c9f..4b60a02987 100644 --- a/generator/osm_element.hpp +++ b/generator/osm_element.hpp @@ -168,7 +168,7 @@ class SecondPassParser : public BaseOSMParser /// 1. "initial relation" process int operator() (uint64_t id) { - auto i = m_typeCache.find(id); + auto const i = m_typeCache.find(id); if (i != m_typeCache.end()) { m_val->AddTypes(i->second.m_p, GetSkipBoundaryType(i->second.m_e)); diff --git a/indexer/feature_visibility.cpp b/indexer/feature_visibility.cpp index 5952e5696a..0abb82d63d 100644 --- a/indexer/feature_visibility.cpp +++ b/indexer/feature_visibility.cpp @@ -242,10 +242,12 @@ namespace if (g == GEOM_LINE || g == GEOM_UNDEFINED) { - if (s1 == t) return true; + if (s1 == t) + return true; ftype::TruncValue(t, 1); - if (s2 == t) return true; + if (s2 == t) + return true; } return false; @@ -272,7 +274,7 @@ bool IsDrawableForIndex(FeatureBase const & f, int level) { Classificator const & c = classif(); - TypesHolder types(f); + TypesHolder const types(f); if (types.GetGeoType() == GEOM_AREA && !types.Has(c.GetCoastType())) if (!scales::IsGoodForLevel(level, f.GetLimitRect())) diff --git a/routing/vehicle_model.cpp b/routing/vehicle_model.cpp index ed8d884428..43b4408e0c 100644 --- a/routing/vehicle_model.cpp +++ b/routing/vehicle_model.cpp @@ -1,14 +1,19 @@ #include "vehicle_model.hpp" + #include "../indexer/classificator.hpp" #include "../indexer/feature.hpp" #include "../indexer/ftypes_matcher.hpp" + #include "../base/macros.hpp" + #include "../std/limits.hpp" +#include "../std/initializer_list.hpp" + namespace routing { -VehicleModel::SpeedForType const s_carLimits[] = { +initializer_list const s_carLimits = { { {"highway", "motorway"}, 90 }, { {"highway", "trunk"}, 85 }, { {"highway", "motorway_link"}, 75 }, @@ -36,15 +41,15 @@ VehicleModel::SpeedForType const s_carLimits[] = { CarModel::CarModel() - : VehicleModel(classif(), vector(s_carLimits, s_carLimits + ARRAY_SIZE(s_carLimits))) + : VehicleModel(classif(), s_carLimits) { } -VehicleModel::VehicleModel(Classificator const & c, vector const & speedLimits) : m_maxSpeed(0) +VehicleModel::VehicleModel(Classificator const & c, vector const & speedLimits) + : m_maxSpeed(0), + m_onewayType(c.GetTypeByPath({ "hwtag", "oneway" })), + m_ferryType(c.GetTypeByPath({ "route", "ferry", "motorcar" })) { - m_onewayType = c.GetTypeByPath({ "hwtag", "oneway" }); - m_ferryType = c.GetTypeByPath({ "route", "ferry", "motorcar" }); - for (size_t i = 0; i < speedLimits.size(); ++i) { m_maxSpeed = max(m_maxSpeed, speedLimits[i].m_speed);