diff options
author | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2016-07-22 10:56:39 +0300 |
---|---|---|
committer | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2016-07-23 21:40:49 +0300 |
commit | 9879d1808a7da38006d9067089215dec75d7aa6c (patch) | |
tree | 2c4d7da2ad1a4d0f2a5ee717df778fff85f81831 /generator | |
parent | 5d4ee21e4a716530886f6478080a832dca877b75 (diff) |
Review fixes.
Diffstat (limited to 'generator')
-rw-r--r-- | generator/altitude_generator.cpp | 23 | ||||
-rw-r--r-- | generator/generator_tests/altitude_test.cpp | 6 |
2 files changed, 15 insertions, 14 deletions
diff --git a/generator/altitude_generator.cpp b/generator/altitude_generator.cpp index 4459173f1b..cf77e5b239 100644 --- a/generator/altitude_generator.cpp +++ b/generator/altitude_generator.cpp @@ -27,22 +27,22 @@ #include "defines.hpp" -#include "3party/succinct/elias_fano.hpp" -#include "3party/succinct/mapper.hpp" -#include "3party/succinct/rs_bit_vector.hpp" - #include "std/algorithm.hpp" #include "std/type_traits.hpp" #include "std/utility.hpp" #include "std/vector.hpp" +#include "3party/succinct/elias_fano.hpp" +#include "3party/succinct/mapper.hpp" +#include "3party/succinct/rs_bit_vector.hpp" + using namespace feature; namespace { using namespace routing; -TAltitudeSectionVersion constexpr kAltitudeSectionVersion = 1; +AltitudeHeader::TAltitudeSectionVersion constexpr kAltitudeSectionVersion = 1; class SrtmGetter : public IAltitudeGetter { @@ -151,7 +151,7 @@ uint32_t GetFileSize(string const & filePath) uint64_t size; if (!my::GetFileSize(filePath, size)) { - LOG(LERROR, (filePath, "size = 0")); + LOG(LERROR, (filePath, "Unable to get file size")); return 0; } @@ -182,8 +182,6 @@ void BuildRoadAltitudes(string const & baseDir, string const & countryName, IAlt Processor processor(altitudeGetter); feature::ForEachFromDat(mwmPath, processor); - processor.SortFeatureAltitudes(); - Processor::TFeatureAltitudes const & featureAltitudes = processor.GetFeatureAltitudes(); if (!processor.HasAltitudeInfo()) { @@ -191,6 +189,9 @@ void BuildRoadAltitudes(string const & baseDir, string const & countryName, IAlt return; } + processor.SortFeatureAltitudes(); + Processor::TFeatureAltitudes const & featureAltitudes = processor.GetFeatureAltitudes(); + // Writing compressed bit vector with features which have altitude information. succinct::rs_bit_vector altitudeAvailability(processor.GetAltitudeAvailability()); string const altitudeAvailabilityPath = my::JoinFoldersToPath(baseDir, "altitude_availability.bitvector"); @@ -216,7 +217,7 @@ void BuildRoadAltitudes(string const & baseDir, string const & countryName, IAlt // Writing feature altitude offsets. CHECK(is_sorted(offsets.begin(), offsets.end()), ()); CHECK(adjacent_find(offsets.begin(), offsets.end()) == offsets.end(), ()); - LOG(LINFO, ("Max altitude info offset =", offsets.back(), "offsets.size() =", offsets.size())); + LOG(LINFO, ("Max altitude info offset =", offsets.back(), "number of offsets = =", offsets.size())); succinct::elias_fano::elias_fano_builder builder(offsets.back(), offsets.size()); for (uint32_t offset : offsets) builder.push_back(offset); @@ -243,14 +244,14 @@ void BuildRoadAltitudes(string const & baseDir, string const & countryName, IAlt altitudeInfoOffset + sizeof(TAltitudeSectionOffset) /* for altitude info size */); header.Serialize(w); - // Coping parts of altitude sections to mwm. + // Copying parts of altitude sections to mwm. MoveFileToAltitudeSection(altitudeAvailabilityPath, altitudeAvailabilitySize, w); MoveFileToAltitudeSection(featuresTablePath, featuresTableSize, w); MoveFileToAltitudeSection(altitudeInfoPath, altitudeInfoSize, w); } catch (RootException const & e) { - LOG(LERROR, ("An exception happend while creating", ALTITUDES_FILE_TAG, "section. ", e.what())); + LOG(LERROR, ("An exception happened while creating", ALTITUDES_FILE_TAG, "section. ", e.what())); } } diff --git a/generator/generator_tests/altitude_test.cpp b/generator/generator_tests/altitude_test.cpp index 094d65780a..97d69e14b5 100644 --- a/generator/generator_tests/altitude_test.cpp +++ b/generator/generator_tests/altitude_test.cpp @@ -134,7 +134,7 @@ void BuildMwmWithoutAltitude(vector<TRounded3DGeom> const & roadFeatures, LocalC builder.Add(TestStreet(ConvertTo2DGeom<m2::PointD>(geom3D), string(), string())); } -void ReadAndTestAltitudeInfo(MwmValue const * mwmValue, string const & mwmPath, MockAltitudeGetter & altitudeGetter) +void ReadAndTestAltitudeInfo(MwmValue const & mwmValue, string const & mwmPath, MockAltitudeGetter & altitudeGetter) { AltitudeLoader const loader(mwmValue); @@ -142,7 +142,7 @@ void ReadAndTestAltitudeInfo(MwmValue const * mwmValue, string const & mwmPath, { f.ParseGeometry(FeatureType::BEST_GEOMETRY); size_t const pointsCount = f.GetPointsCount(); - TAltitudes const altitudes = loader.GetAltitude(id, pointsCount); + TAltitudes const altitudes = loader.GetAltitudes(id, pointsCount); if (!routing::IsRoad(feature::TypesHolder(f))) { @@ -191,7 +191,7 @@ void TestAltitudeSection(vector<TRounded3DGeom> const & roadFeatures) CHECK(mwmHandle.IsAlive(), ()); string const mwmPath = my::JoinFoldersToPath(testDirFullPath, kTestMwm + DATA_FILE_EXTENSION); - ReadAndTestAltitudeInfo(mwmHandle.GetValue<MwmValue>(), mwmPath, altitudeGetter); + ReadAndTestAltitudeInfo(*mwmHandle.GetValue<MwmValue>(), mwmPath, altitudeGetter); } } // namespace |