Review fixes.

This commit is contained in:
Vladimir Byko-Ianko 2016-06-29 10:09:02 +03:00
parent 504eca3c8d
commit 72938d3d53
3 changed files with 12 additions and 15 deletions

View file

@ -9,12 +9,14 @@
#include "indexer/feature_processor.hpp"
#include "coding/file_container.hpp"
#include "coding/file_name_utils.hpp"
#include "coding/varint.hpp"
#include "coding/internal/file_data.hpp"
#include "base/assert.hpp"
#include "base/logging.hpp"
#include "base/stl_helpers.hpp"
#include "base/string_utils.hpp"
#include "defines.hpp"
@ -32,16 +34,15 @@ class Processor
{
public:
using TFeatureAltitude = pair<uint32_t, Altitudes>;
using TFeatureAltitudeVec = vector<TFeatureAltitude>;
using TFeatureAltitudes = vector<TFeatureAltitude>;
Processor(string const & srtmPath) : m_srtmManager(srtmPath) {}
TFeatureAltitudeVec const & GetFeatureAltitudes() const { return m_featureAltitudes; }
TFeatureAltitudes const & GetFeatureAltitudes() const { return m_featureAltitudes; }
void operator()(FeatureType const & f, uint32_t const & id)
{
feature::TypesHolder const & fh = feature::TypesHolder(f);
if (!routing::IsRoad(fh))
if (!routing::IsRoad(feature::TypesHolder(f)))
return;
f.ParseGeometry(FeatureType::BEST_GEOMETRY);
@ -56,16 +57,12 @@ public:
void SortFeatureAltitudes()
{
sort(m_featureAltitudes.begin(), m_featureAltitudes.end(),
[](Processor::TFeatureAltitude const & f1, Processor::TFeatureAltitude const & f2)
{
return f1.first < f2.first;
});
sort(m_featureAltitudes.begin(), m_featureAltitudes.end(), my::LessBy(&Processor::TFeatureAltitude::first));
}
private:
generator::SrtmTileManager m_srtmManager;
TFeatureAltitudeVec m_featureAltitudes;
TFeatureAltitudes m_featureAltitudes;
};
} // namespace
@ -74,7 +71,7 @@ namespace routing
void BuildRoadAltitudes(string const & srtmPath, string const & baseDir, string const & countryName)
{
LOG(LINFO, ("srtmPath =", srtmPath, "baseDir =", baseDir, "countryName =", countryName));
string const mwmPath = baseDir + countryName + DATA_FILE_EXTENSION;
string const mwmPath = my::JoinFoldersToPath(baseDir, countryName + DATA_FILE_EXTENSION);
// Writing section with altitude information.
{
@ -84,7 +81,7 @@ void BuildRoadAltitudes(string const & srtmPath, string const & baseDir, string
Processor processor(srtmPath);
feature::ForEachFromDat(mwmPath, processor);
processor.SortFeatureAltitudes();
Processor::TFeatureAltitudeVec const & featureAltitudes = processor.GetFeatureAltitudes();
Processor::TFeatureAltitudes const & featureAltitudes = processor.GetFeatureAltitudes();
for (auto const & a : featureAltitudes)
{

View file

@ -181,7 +181,7 @@ public:
m_uniqueRoadPoints.insert(RoughPoint(f.GetPoint(i)));
// Preparing feature altitude and length.
TAltitudeVec pointAltitudes(numPoints);
TAltitudes pointAltitudes(numPoints);
vector<double> pointDists(numPoints);
double distFromStartMeters = 0;
for (uint32_t i = 0; i < numPoints; ++i)

View file

@ -8,8 +8,8 @@
namespace feature
{
using TAltitude = int16_t;
using TAltitudeVec = vector<feature::TAltitude>;
static TAltitude constexpr kInvalidAltitude = numeric_limits<TAltitude>::lowest();
using TAltitudes = vector<feature::TAltitude>;
TAltitude constexpr kInvalidAltitude = numeric_limits<TAltitude>::min();
struct Altitudes
{