Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Byko-Ianko <v.bykoianko@corp.mail.ru>2016-07-19 17:22:26 +0300
committerVladimir Byko-Ianko <v.bykoianko@corp.mail.ru>2016-07-23 10:25:11 +0300
commit18067c6270fa7edbc6b391468971d3aaa3a7df95 (patch)
tree76c4bf51fa916127d282b0f6be89c402ee3654f7
parent3fa7071a1b57145da7559144f2316ad3be555d39 (diff)
Review fixes.
-rw-r--r--defines.hpp2
-rw-r--r--generator/altitude_generator.cpp16
-rw-r--r--generator/generator_tool/generator_tool.cpp50
-rw-r--r--generator/srtm_parser.hpp2
-rw-r--r--indexer/altitude_loader.cpp4
-rw-r--r--indexer/altitude_loader.hpp2
-rw-r--r--indexer/feature_altitude.hpp2
-rw-r--r--indexer/feature_loader_base.cpp2
-rw-r--r--routing/nearest_edge_finder.cpp10
-rw-r--r--routing/routing_helpers.hpp2
10 files changed, 45 insertions, 47 deletions
diff --git a/defines.hpp b/defines.hpp
index 7c00528376..f9b26ff584 100644
--- a/defines.hpp
+++ b/defines.hpp
@@ -25,7 +25,7 @@
#define VERSION_FILE_TAG "version"
#define METADATA_FILE_TAG "meta"
#define METADATA_INDEX_FILE_TAG "metaidx"
-#define ALTITUDE_FILE_TAG "altitude"
+#define ALTITUDES_FILE_TAG "altitudes"
#define FEATURE_OFFSETS_FILE_TAG "offs"
#define RANKS_FILE_TAG "ranks"
#define REGION_INFO_FILE_TAG "rgninfo"
diff --git a/generator/altitude_generator.cpp b/generator/altitude_generator.cpp
index df807e3936..8200e1a8c3 100644
--- a/generator/altitude_generator.cpp
+++ b/generator/altitude_generator.cpp
@@ -73,14 +73,14 @@ public:
break;
TAltitudes altitudes;
- bool allPointsValidAltFlag = true;
+ bool valid = true;
TAltitude minFeatureAltitude = kInvalidAltitude;
for (size_t i = 0; i < pointsCount; ++i)
{
TAltitude const a = m_srtmManager.GetHeight(MercatorBounds::ToLatLon(f.GetPoint(i)));
if (a == kInvalidAltitude)
{
- allPointsValidAltFlag = false;
+ valid = false;
break;
}
@@ -91,7 +91,7 @@ public:
altitudes.push_back(a);
}
- if (!allPointsValidAltFlag)
+ if (!valid)
break;
hasAltitude = true;
@@ -107,7 +107,7 @@ public:
m_altitudeAvailability.push_back(hasAltitude);
}
- bool HasAltitudeInfo()
+ bool HasAltitudeInfo() const
{
return !m_featureAltitudes.empty();
}
@@ -129,11 +129,11 @@ uint32_t GetFileSize(string const & filePath)
uint64_t size;
if (!my::GetFileSize(filePath, size))
{
- LOG(LWARNING, ("altitudeAvailability", filePath, "size = 0"));
+ LOG(LERROR, (filePath, "size = 0"));
return 0;
}
- LOG(LINFO, ("altitudeAvailability ", filePath, "size =", size, "bytes"));
+ LOG(LINFO, (filePath, "size =", size, "bytes"));
return size;
}
@@ -221,7 +221,7 @@ void BuildRoadAltitudes(string const & srtmPath, string const & baseDir, string
uint32_t const featuresTableSize = GetFileSize(featuresTablePath);
FilesContainerW cont(mwmPath, FileWriter::OP_WRITE_EXISTING);
- FileWriter w = cont.GetWriter(ALTITUDE_FILE_TAG);
+ FileWriter w = cont.GetWriter(ALTITUDES_FILE_TAG);
// Writing section with altitude information.
// Writing altitude section header.
@@ -241,7 +241,7 @@ void BuildRoadAltitudes(string const & srtmPath, string const & baseDir, string
}
catch (RootException const & e)
{
- LOG(LERROR, ("An exception happend while creating", ALTITUDE_FILE_TAG, "section. ", e.what()));
+ LOG(LERROR, ("An exception happend while creating", ALTITUDES_FILE_TAG, "section. ", e.what()));
}
}
} // namespace routing
diff --git a/generator/generator_tool/generator_tool.cpp b/generator/generator_tool/generator_tool.cpp
index ffd5e7d370..27b4d41767 100644
--- a/generator/generator_tool/generator_tool.cpp
+++ b/generator/generator_tool/generator_tool.cpp
@@ -34,25 +34,25 @@
DEFINE_bool(generate_classif, false, "Generate classificator.");
-DEFINE_bool(preprocess, false, "1st pass - create nodes/ways/relations data");
-DEFINE_bool(make_coasts, false, "create intermediate file with coasts data");
-DEFINE_bool(emit_coasts, false, "push coasts features from intermediate file to out files/countries");
-
-DEFINE_bool(generate_features, false, "2nd pass - generate intermediate features");
-DEFINE_bool(generate_geometry, false, "3rd pass - split and simplify geometry and triangles for features");
-DEFINE_bool(generate_index, false, "4rd pass - generate index");
-DEFINE_bool(generate_search_index, false, "5th pass - generate search index");
-DEFINE_bool(calc_statistics, false, "Calculate feature statistics for specified mwm bucket files");
-DEFINE_bool(type_statistics, false, "Calculate statistics by type for specified mwm bucket files");
-DEFINE_bool(preload_cache, false, "Preload all ways and relations cache");
-DEFINE_string(node_storage, "map", "Type of storage for intermediate points representation. Available: raw, map, mem");
+DEFINE_bool(preprocess, false, "1st pass - create nodes/ways/relations data.");
+DEFINE_bool(make_coasts, false, "Create intermediate file with coasts data.");
+DEFINE_bool(emit_coasts, false, "Push coasts features from intermediate file to out files/countries.");
+
+DEFINE_bool(generate_features, false, "2nd pass - generate intermediate features.");
+DEFINE_bool(generate_geometry, false, "3rd pass - split and simplify geometry and triangles for features.");
+DEFINE_bool(generate_index, false, "4rd pass - generate index.");
+DEFINE_bool(generate_search_index, false, "5th pass - generate search index.");
+DEFINE_bool(calc_statistics, false, "Calculate feature statistics for specified mwm bucket files.");
+DEFINE_bool(type_statistics, false, "Calculate statistics by type for specified mwm bucket files.");
+DEFINE_bool(preload_cache, false, "Preload all ways and relations cache.");
+DEFINE_string(node_storage, "map", "Type of storage for intermediate points representation. Available: raw, map, mem.");
DEFINE_string(data_path, "", "Working directory, 'path_to_exe/../../data' if empty.");
DEFINE_string(output, "", "File name for process (without 'mwm' ext).");
DEFINE_string(intermediate_data_path, "", "Path to stored nodes, ways, relations.");
-DEFINE_bool(generate_world, false, "Generate separate world file");
-DEFINE_bool(split_by_polygons, false, "Use countries borders to split planet by regions and countries");
-DEFINE_bool(dump_types, false, "Prints all types combinations and their total count");
-DEFINE_bool(dump_prefixes, false, "Prints statistics on feature's' name prefixes");
+DEFINE_bool(generate_world, false, "Generate separate world file.");
+DEFINE_bool(split_by_polygons, false, "Use countries borders to split planet by regions and countries.");
+DEFINE_bool(dump_types, false, "Prints all types combinations and their total count.");
+DEFINE_bool(dump_prefixes, false, "Prints statistics on feature's' name prefixes.");
DEFINE_bool(dump_search_tokens, false, "Print statistics on search tokens.");
DEFINE_string(dump_feature_names, "", "Print all feature names by 2-letter locale.");
DEFINE_bool(unpack_mwm, false, "Unpack each section of mwm into a separate file with name filePath.sectionName.");
@@ -62,18 +62,18 @@ DEFINE_bool(check_mwm, false, "Check map file to be correct.");
DEFINE_string(delete_section, "", "Delete specified section (defines.hpp) from container.");
DEFINE_bool(fail_on_coasts, false, "Stop and exit with '255' code if some coastlines are not merged.");
DEFINE_bool(generate_addresses_file, false, "Generate .addr file (for '--output' option) with full addresses list.");
-DEFINE_string(osrm_file_name, "", "Input osrm file to generate routing info");
-DEFINE_bool(make_routing, false, "Make routing info based on osrm file");
-DEFINE_bool(make_cross_section, false, "Make cross section in routing file for cross mwm routing");
-DEFINE_string(osm_file_name, "", "Input osm area file");
-DEFINE_string(osm_file_type, "xml", "Input osm area file type [xml, o5m]");
+DEFINE_string(osrm_file_name, "", "Input osrm file to generate routing info.");
+DEFINE_bool(make_routing, false, "Make routing info based on osrm file.");
+DEFINE_bool(make_cross_section, false, "Make cross section in routing file for cross mwm routing.");
+DEFINE_string(osm_file_name, "", "Input osm area file.");
+DEFINE_string(osm_file_type, "xml", "Input osm area file type [xml, o5m].");
DEFINE_string(user_resource_path, "", "User defined resource path for classificator.txt and etc.");
-DEFINE_string(booking_data, "", "Path to booking data in .tsv format");
-DEFINE_string(booking_reference_path, "", "Path to mwm dataset for match booking addresses");
-DEFINE_uint64(planet_version, my::SecondsSinceEpoch(), "Version as seconds since epoch, by default - now");
+DEFINE_string(booking_data, "", "Path to booking data in .tsv format.");
+DEFINE_string(booking_reference_path, "", "Path to mwm dataset for match booking addresses.");
+DEFINE_uint64(planet_version, my::SecondsSinceEpoch(), "Version as seconds since epoch, by default - now.");
DEFINE_string(
srtm_path, "",
- "Path to srtm directory. If When set generates section with altitude information about roads.");
+ "Path to srtm directory. If it is set, generates section with altitude information about roads.");
int main(int argc, char ** argv)
{
diff --git a/generator/srtm_parser.hpp b/generator/srtm_parser.hpp
index ff1fdce283..541cc32876 100644
--- a/generator/srtm_parser.hpp
+++ b/generator/srtm_parser.hpp
@@ -22,7 +22,7 @@ public:
inline bool IsValid() const { return m_valid; }
- // Returns height in meters at |coord|, or kInvalidAltitude if is not initialized.
+ // Returns height in meters at |coord| or kInvalidAltitude.
feature::TAltitude GetHeight(ms::LatLon const & coord);
static string GetBase(ms::LatLon coord);
diff --git a/indexer/altitude_loader.cpp b/indexer/altitude_loader.cpp
index 21c25ac9b0..5d539f5110 100644
--- a/indexer/altitude_loader.cpp
+++ b/indexer/altitude_loader.cpp
@@ -30,7 +30,7 @@ void ReadBuffer(ReaderSource<FilesContainerR::TReader> & rs, vector<char> & buf)
namespace feature
{
AltitudeLoader::AltitudeLoader(MwmValue const * mwmValue)
- : reader(mwmValue->m_cont.GetReader(ALTITUDE_FILE_TAG)), m_altitudeInfoOffset(0), m_minAltitude(kInvalidAltitude)
+ : reader(mwmValue->m_cont.GetReader(ALTITUDES_FILE_TAG)), m_altitudeInfoOffset(0), m_minAltitude(kInvalidAltitude)
{
if (!mwmValue || mwmValue->GetHeader().GetFormat() < version::Format::v8 )
return;
@@ -54,7 +54,7 @@ AltitudeLoader::AltitudeLoader(MwmValue const * mwmValue)
{
m_altitudeInfoOffset = 0;
m_minAltitude = kInvalidAltitude;
- LOG(LINFO, ("MWM does not contain", ALTITUDE_FILE_TAG, "section.", e.Msg()));
+ LOG(LINFO, ("MWM does not contain", ALTITUDES_FILE_TAG, "section.", e.Msg()));
}
}
diff --git a/indexer/altitude_loader.hpp b/indexer/altitude_loader.hpp
index d7a27785de..1b11a9792c 100644
--- a/indexer/altitude_loader.hpp
+++ b/indexer/altitude_loader.hpp
@@ -15,7 +15,7 @@ using TAltitudeSectionOffset = uint32_t;
class AltitudeLoader
{
public:
- AltitudeLoader(MwmValue const * mwmValue);
+ explicit AltitudeLoader(MwmValue const * mwmValue);
TAltitudes GetAltitude(uint32_t featureId, size_t pointCount) const;
diff --git a/indexer/feature_altitude.hpp b/indexer/feature_altitude.hpp
index 84582fac7c..64ec8161cf 100644
--- a/indexer/feature_altitude.hpp
+++ b/indexer/feature_altitude.hpp
@@ -15,7 +15,7 @@ class Altitude
{
public:
Altitude() = default;
- Altitude(TAltitudes const & altitudes) : m_pointAlt(altitudes) {}
+ explicit Altitude(TAltitudes const & altitudes) : m_pointAlt(altitudes) {}
template <class TSink>
void Serialize(TAltitude minAltitude, TSink & sink) const
diff --git a/indexer/feature_loader_base.cpp b/indexer/feature_loader_base.cpp
index 8d13bfca02..4c2b4d5caf 100644
--- a/indexer/feature_loader_base.cpp
+++ b/indexer/feature_loader_base.cpp
@@ -46,7 +46,7 @@ SharedLoadInfo::TReader SharedLoadInfo::GetMetadataIndexReader() const
SharedLoadInfo::TReader SharedLoadInfo::GetAltitudeReader() const
{
- return m_cont.GetReader(ALTITUDE_FILE_TAG);
+ return m_cont.GetReader(ALTITUDES_FILE_TAG);
}
SharedLoadInfo::TReader SharedLoadInfo::GetGeometryReader(int ind) const
diff --git a/routing/nearest_edge_finder.cpp b/routing/nearest_edge_finder.cpp
index 181eda1cf9..7c8f2ff867 100644
--- a/routing/nearest_edge_finder.cpp
+++ b/routing/nearest_edge_finder.cpp
@@ -42,12 +42,10 @@ void NearestEdgeFinder::AddInformationSource(FeatureID const & featureId, IRoadG
// to segment [res.m_segStart.GetPoint(), res.m_segEnd.GetPoint()].
// It's necessary to calculate exact value of res.m_projPoint.GetAltitude() by this
// information.
- bool const isAltidudeValid = res.m_segStart.GetAltitude() != feature::kInvalidAltitude &&
- res.m_segEnd.GetAltitude() != feature::kInvalidAltitude;
- feature::TAltitude const projPointAlt =
- isAltidudeValid ? static_cast<feature::TAltitude>(
- (res.m_segStart.GetAltitude() + res.m_segEnd.GetAltitude()) / 2)
- : feature::kInvalidAltitude;
+ bool const isAltitude = res.m_segStart.GetAltitude() != feature::kInvalidAltitude &&
+ res.m_segEnd.GetAltitude() != feature::kInvalidAltitude;
+ feature::TAltitude const projPointAlt = isAltitude ? static_cast<feature::TAltitude>(
+ (res.m_segStart.GetAltitude() + res.m_segEnd.GetAltitude()) / 2) : feature::kInvalidAltitude;
res.m_projPoint = Junction(pt, projPointAlt);
}
}
diff --git a/routing/routing_helpers.hpp b/routing/routing_helpers.hpp
index c602fbd453..ef6c9d5e40 100644
--- a/routing/routing_helpers.hpp
+++ b/routing/routing_helpers.hpp
@@ -6,7 +6,7 @@
namespace routing
{
-/// \returns true if a feature with |types| can be used for any kind of routing.
+/// \returns true when there exists a routing mode where the feature with |types| can be used.
template <class TList>
bool IsRoad(TList const & types)
{