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-11-03 13:18:46 +0300
committerVladimir Byko-Ianko <v.bykoianko@corp.mail.ru>2016-11-10 18:58:21 +0300
commit84fda9c42e33b08bf45dfc8bea10888a79eb27f0 (patch)
tree2abdc2ce2a71f93b16a5963fef80619b0540bbf3 /generator
parent0ef7cf7b74c76af4a5c1948bf7e629d346dd6fed (diff)
git-clang-format
Diffstat (limited to 'generator')
-rw-r--r--generator/feature_generator.hpp2
-rw-r--r--generator/feature_sorter.cpp2
-rw-r--r--generator/generator_tests/restriction_collector_test.cpp65
-rw-r--r--generator/generator_tests/restriction_test.cpp2
-rw-r--r--generator/generator_tool/generator_tool.cpp8
-rw-r--r--generator/osm_source.cpp12
-rw-r--r--generator/osm_translator.hpp19
-rw-r--r--generator/polygonizer.hpp17
-rw-r--r--generator/restriction_collector.cpp39
-rw-r--r--generator/restriction_collector.hpp16
-rw-r--r--generator/restriction_dumper.cpp47
-rw-r--r--generator/restriction_dumper.hpp3
-rw-r--r--generator/restriction_generator.cpp12
-rw-r--r--generator/restriction_generator.hpp6
-rw-r--r--generator/world_map_generator.hpp1
15 files changed, 134 insertions, 117 deletions
diff --git a/generator/feature_generator.hpp b/generator/feature_generator.hpp
index f9e4c6ac71..1a4bcc4ce7 100644
--- a/generator/feature_generator.hpp
+++ b/generator/feature_generator.hpp
@@ -23,7 +23,6 @@ protected:
m2::RectD m_bounds;
uint32_t GetNextFeatureId() const { return m_featureID; }
-
private:
void Write(char const * src, size_t size);
void FlushBuffer();
@@ -41,7 +40,6 @@ public:
virtual ~FeaturesCollector();
string const & GetFilePath() const { return m_datFile.GetName(); }
-
/// \brief Serializes |f|.
/// \returns feature id of serialized feature.
virtual uint32_t operator()(FeatureBuilder1 const & f);
diff --git a/generator/feature_sorter.cpp b/generator/feature_sorter.cpp
index 4837b20352..43a0fc9a98 100644
--- a/generator/feature_sorter.cpp
+++ b/generator/feature_sorter.cpp
@@ -446,7 +446,7 @@ namespace feature
bool IsCountry() const { return m_header.GetType() == feature::DataHeader::country; }
public:
- uint32_t operator() (FeatureBuilder2 & fb)
+ uint32_t operator()(FeatureBuilder2 & fb)
{
GeometryHolder holder(*this, fb, m_header);
diff --git a/generator/generator_tests/restriction_collector_test.cpp b/generator/generator_tests/restriction_collector_test.cpp
index b18f00d3aa..d463805fc2 100644
--- a/generator/generator_tests/restriction_collector_test.cpp
+++ b/generator/generator_tests/restriction_collector_test.cpp
@@ -43,10 +43,9 @@ UNIT_TEST(RestrictionTest_ValidCase)
// Checking the result.
TEST(restrictionCollector.IsValid(), ());
- RestrictionVec const expectedRestrictions =
- {{Restriction::Type::No, {10, 20}},
- {Restriction::Type::No, {20, 30}},
- {Restriction::Type::Only, {50, 70}}};
+ RestrictionVec const expectedRestrictions = {{Restriction::Type::No, {10, 20}},
+ {Restriction::Type::No, {20, 30}},
+ {Restriction::Type::Only, {50, 70}}};
TEST_EQUAL(restrictionCollector.m_restrictions, expectedRestrictions, ());
}
@@ -61,8 +60,8 @@ UNIT_TEST(RestrictionTest_InvalidCase)
TEST(!restrictionCollector.IsValid(), ());
- RestrictionVec const expectedRestrictions =
- {{Restriction::Type::No, {0, Restriction::kInvalidFeatureId}}};
+ RestrictionVec const expectedRestrictions = {
+ {Restriction::Type::No, {0, Restriction::kInvalidFeatureId}}};
TEST_EQUAL(restrictionCollector.m_restrictions, expectedRestrictions, ());
restrictionCollector.RemoveInvalidRestrictions();
@@ -87,29 +86,27 @@ UNIT_TEST(RestrictionTest_ParseRestrictions)
Platform const & platform = Platform();
- TEST(restrictionCollector.ParseRestrictions(my::JoinFoldersToPath(platform.WritableDir(),
- kRestrictionPath)), ());
- RestrictionVec expectedRestrictions =
- {{Restriction::Type::No, 2},
- {Restriction::Type::Only, 2},
- {Restriction::Type::Only, 2},
- {Restriction::Type::No, 2},
- {Restriction::Type::No, 2}};
+ TEST(restrictionCollector.ParseRestrictions(
+ my::JoinFoldersToPath(platform.WritableDir(), kRestrictionPath)),
+ ());
+ RestrictionVec expectedRestrictions = {{Restriction::Type::No, 2},
+ {Restriction::Type::Only, 2},
+ {Restriction::Type::Only, 2},
+ {Restriction::Type::No, 2},
+ {Restriction::Type::No, 2}};
TEST_EQUAL(restrictionCollector.m_restrictions, expectedRestrictions, ());
- vector<pair<uint64_t, RestrictionCollector::Index>> const expectedRestrictionIndex =
- {{1, {0, 0}}, {1, {0, 1}},
- {0, {1, 0}}, {2, {1, 1}},
- {2, {2, 0}}, {3, {2, 1}},
- {38028428, {3, 0}}, {38028428, {3, 1}},
- {4, {4, 0}}, {5, {4, 1}}};
+ vector<pair<uint64_t, RestrictionCollector::Index>> const expectedRestrictionIndex = {
+ {1, {0, 0}}, {1, {0, 1}}, {0, {1, 0}}, {2, {1, 1}}, {2, {2, 0}},
+ {3, {2, 1}}, {38028428, {3, 0}}, {38028428, {3, 1}}, {4, {4, 0}}, {5, {4, 1}}};
TEST_EQUAL(restrictionCollector.m_restrictionIndex, expectedRestrictionIndex, ());
}
UNIT_TEST(RestrictionTest_ParseFeatureId2OsmIdsMapping)
{
string const kFeatureIdToOsmIdsName = "feature_id_to_osm_ids.csv";
- string const kFeatureIdToOsmIdsPath = my::JoinFoldersToPath(kRestrictionTestDir, kFeatureIdToOsmIdsName);
+ string const kFeatureIdToOsmIdsPath =
+ my::JoinFoldersToPath(kRestrictionTestDir, kFeatureIdToOsmIdsName);
string const kFeatureIdToOsmIdsContent = R"(1, 10,
2, 20,
779703, 5423239545,
@@ -121,13 +118,14 @@ UNIT_TEST(RestrictionTest_ParseFeatureId2OsmIdsMapping)
RestrictionCollector restrictionCollector("", "");
Platform const & platform = Platform();
- restrictionCollector.ParseFeatureId2OsmIdsMapping(my::JoinFoldersToPath(platform.WritableDir(),
- kFeatureIdToOsmIdsPath));
+ restrictionCollector.ParseFeatureId2OsmIdsMapping(
+ my::JoinFoldersToPath(platform.WritableDir(), kFeatureIdToOsmIdsPath));
- vector<pair<uint64_t, Restriction::FeatureId>> const expectedOsmIds2FeatureId =
- {{10, 1}, {20, 2}, {5423239545, 779703}, {30, 3}};
+ vector<pair<uint64_t, Restriction::FeatureId>> const expectedOsmIds2FeatureId = {
+ {10, 1}, {20, 2}, {5423239545, 779703}, {30, 3}};
vector<pair<uint64_t, Restriction::FeatureId>> const osmIds2FeatureId(
- restrictionCollector.m_osmIds2FeatureId.cbegin(), restrictionCollector.m_osmIds2FeatureId.cend());
+ restrictionCollector.m_osmIds2FeatureId.cbegin(),
+ restrictionCollector.m_osmIds2FeatureId.cend());
TEST_EQUAL(osmIds2FeatureId, expectedOsmIds2FeatureId, ());
}
@@ -140,7 +138,8 @@ UNIT_TEST(RestrictionTest_RestrictionCollectorWholeClassTest)
Only, 30, 40,)";
string const kFeatureIdToOsmIdsName = "feature_id_to_osm_ids.csv";
- string const kFeatureIdToOsmIdsPath = my::JoinFoldersToPath(kRestrictionTestDir, kFeatureIdToOsmIdsName);
+ string const kFeatureIdToOsmIdsPath =
+ my::JoinFoldersToPath(kRestrictionTestDir, kFeatureIdToOsmIdsName);
string const kFeatureIdToOsmIdsContent = R"(1, 10,
2, 20,
3, 30,
@@ -151,17 +150,17 @@ UNIT_TEST(RestrictionTest_RestrictionCollectorWholeClassTest)
ScopedFile mappingScopedFile(kFeatureIdToOsmIdsPath, kFeatureIdToOsmIdsContent);
Platform const & platform = Platform();
- RestrictionCollector restrictionCollector(my::JoinFoldersToPath(platform.WritableDir(), kRestrictionPath),
- my::JoinFoldersToPath(platform.WritableDir(), kFeatureIdToOsmIdsPath));
+ RestrictionCollector restrictionCollector(
+ my::JoinFoldersToPath(platform.WritableDir(), kRestrictionPath),
+ my::JoinFoldersToPath(platform.WritableDir(), kFeatureIdToOsmIdsPath));
TEST(restrictionCollector.IsValid(), ());
RestrictionVec const & restrictions = restrictionCollector.GetRestrictions();
TEST(is_sorted(restrictions.cbegin(), restrictions.cend()), ());
- RestrictionVec const expectedRestrictions =
- {{Restriction::Type::No, {1, 1}},
- {Restriction::Type::Only, {1, 2}},
- {Restriction::Type::Only, {3, 4}}};
+ RestrictionVec const expectedRestrictions = {{Restriction::Type::No, {1, 1}},
+ {Restriction::Type::Only, {1, 2}},
+ {Restriction::Type::Only, {3, 4}}};
TEST_EQUAL(restrictions, expectedRestrictions, ());
}
} // namespace routing
diff --git a/generator/generator_tests/restriction_test.cpp b/generator/generator_tests/restriction_test.cpp
index 8539203cbd..555adf2289 100644
--- a/generator/generator_tests/restriction_test.cpp
+++ b/generator/generator_tests/restriction_test.cpp
@@ -15,8 +15,8 @@
#include "platform/platform_tests_support/scoped_dir.hpp"
#include "platform/platform_tests_support/scoped_file.hpp"
-#include "platform/platform.hpp"
#include "platform/country_file.hpp"
+#include "platform/platform.hpp"
#include "base/logging.hpp"
#include "base/scope_guard.hpp"
diff --git a/generator/generator_tool/generator_tool.cpp b/generator/generator_tool/generator_tool.cpp
index c4c9e3687b..a6b7ceccc4 100644
--- a/generator/generator_tool/generator_tool.cpp
+++ b/generator/generator_tool/generator_tool.cpp
@@ -84,7 +84,8 @@ DEFINE_string(srtm_path, "",
"Path to srtm directory. If it is set, generates section with altitude information "
"about roads.");
DEFINE_string(restriction_name, "", "Name of file with relation restriction in osm id term.");
-DEFINE_string(feature_id_to_osm_ids_name, "", "Name of to file with mapping from feature id to osm ids.");
+DEFINE_string(feature_id_to_osm_ids_name, "",
+ "Name of to file with mapping from feature id to osm ids.");
DEFINE_bool(generate_outgoing_edge_index, false, "Generates section with outgoing edges");
int main(int argc, char ** argv)
@@ -240,8 +241,9 @@ int main(int argc, char ** argv)
if (FLAGS_generate_outgoing_edge_index)
{
- routing::BuildRoadRestrictions(datFile, genInfo.GetIntermediateFileName(genInfo.m_restrictions, ""),
- genInfo.GetIntermediateFileName(genInfo.m_featureId2OsmIds, ""));
+ routing::BuildRoadRestrictions(
+ datFile, genInfo.GetIntermediateFileName(genInfo.m_restrictions, ""),
+ genInfo.GetIntermediateFileName(genInfo.m_featureId2OsmIds, ""));
}
}
diff --git a/generator/osm_source.cpp b/generator/osm_source.cpp
index 89f0f33c4b..5489bf8328 100644
--- a/generator/osm_source.cpp
+++ b/generator/osm_source.cpp
@@ -136,9 +136,9 @@ public:
void AddRelation(TKey id, RelationElement const & e)
{
string const & relationType = e.GetType();
- if (!(relationType == "multipolygon" || relationType == "route" ||
- relationType == "boundary" || relationType == "associatedStreet" ||
- relationType == "building" || relationType == "restriction"))
+ if (!(relationType == "multipolygon" || relationType == "route" || relationType == "boundary" ||
+ relationType == "associatedStreet" || relationType == "building" ||
+ relationType == "restriction"))
{
return;
}
@@ -298,7 +298,6 @@ class MainFeaturesEmitter : public EmitterBase
uint32_t m_types[TYPES_COUNT];
inline uint32_t Type(TypeIndex i) const { return m_types[i]; }
-
SyncOfstream m_featureId2osmIds;
public:
@@ -347,7 +346,10 @@ public:
LOG(LINFO, ("Saving osm ids to feature ids map to", featureId2OsmIdsFile));
m_featureId2osmIds.Open(featureId2OsmIdsFile);
if (!m_featureId2osmIds.IsOpened())
- LOG(LWARNING, ("Cannot open", featureId2OsmIdsFile, ". Feature id to osm ids to map won't be saved."));
+ {
+ LOG(LWARNING,
+ ("Cannot open", featureId2OsmIdsFile, ". Feature id to osm ids to map won't be saved."));
+ }
}
void operator()(FeatureBuilder1 & fb) override
diff --git a/generator/osm_translator.hpp b/generator/osm_translator.hpp
index c539d5c425..1b34fd7e20 100644
--- a/generator/osm_translator.hpp
+++ b/generator/osm_translator.hpp
@@ -30,7 +30,9 @@ class RelationTagsBase
{
public:
RelationTagsBase(routing::RestrictionDumper & restrictionDumper)
- : m_restrictionDumper(restrictionDumper), m_cache(14) {}
+ : m_restrictionDumper(restrictionDumper), m_cache(14)
+ {
+ }
void Reset(uint64_t fID, OsmElement * p)
{
@@ -87,7 +89,9 @@ class RelationTagsNode : public RelationTagsBase
public:
RelationTagsNode(routing::RestrictionDumper & restrictionDumper)
- : RelationTagsBase(restrictionDumper) {}
+ : RelationTagsBase(restrictionDumper)
+ {
+ }
protected:
void Process(RelationElement const & e) override
@@ -128,7 +132,9 @@ class RelationTagsWay : public RelationTagsBase
{
public:
RelationTagsWay(routing::RestrictionDumper & restrictionDumper)
- : RelationTagsBase(restrictionDumper) {}
+ : RelationTagsBase(restrictionDumper)
+ {
+ }
private:
using TBase = RelationTagsBase;
@@ -512,8 +518,11 @@ public:
public:
OsmToFeatureTranslator(TEmitter & emitter, TCache & holder, uint32_t coastType,
string const & addrFilePath = {}, string const & restrictionsFilePath = {})
- : m_emitter(emitter), m_holder(holder), m_coastType(coastType),
- m_nodeRelations(m_restrictionDumper), m_wayRelations(m_restrictionDumper)
+ : m_emitter(emitter)
+ , m_holder(holder)
+ , m_coastType(coastType)
+ , m_nodeRelations(m_restrictionDumper)
+ , m_wayRelations(m_restrictionDumper)
{
if (!addrFilePath.empty())
m_addrWriter.reset(new FileWriter(addrFilePath));
diff --git a/generator/polygonizer.hpp b/generator/polygonizer.hpp
index 877f7e4247..4e789d8000 100644
--- a/generator/polygonizer.hpp
+++ b/generator/polygonizer.hpp
@@ -110,7 +110,7 @@ namespace feature
}
};
- void operator () (FeatureBuilder1 & fb, SyncOfstream & featureId2osmIds)
+ void operator()(FeatureBuilder1 & fb, SyncOfstream & featureId2osmIds)
{
buffer_vector<borders::CountryPolygons const *, 32> vec;
m_countries.ForEachInRect(fb.GetLimitRect(), InsertCountriesPtr(vec));
@@ -119,17 +119,15 @@ namespace feature
{
case 0:
break;
- case 1:
- EmitFeature(vec[0], fb, featureId2osmIds);
- break;
+ case 1: EmitFeature(vec[0], fb, featureId2osmIds); break;
default:
{
#if PARALLEL_POLYGONIZER
m_ThreadPoolSemaphore.acquire();
m_ThreadPool.start(new PolygonizerTask(this, vec, fb, featureId2osmIds));
#else
- PolygonizerTask task(this, vec, fb, featureId2osmIds);
- task.RunBase();
+ PolygonizerTask task(this, vec, fb, featureId2osmIds);
+ task.RunBase();
#endif
}
}
@@ -192,7 +190,12 @@ namespace feature
PolygonizerTask(Polygonizer * pPolygonizer,
buffer_vector<borders::CountryPolygons const *, 32> const & countries,
FeatureBuilder1 const & fb, SyncOfstream & featureId2osmIds)
- : m_pPolygonizer(pPolygonizer), m_Countries(countries), m_FB(fb), m_featureId2osmIds(featureId2osmIds) {}
+ : m_pPolygonizer(pPolygonizer)
+ , m_Countries(countries)
+ , m_FB(fb)
+ , m_featureId2osmIds(featureId2osmIds)
+ {
+ }
void RunBase()
{
diff --git a/generator/restriction_collector.cpp b/generator/restriction_collector.cpp
index 22add4b1fc..3d1a667868 100644
--- a/generator/restriction_collector.cpp
+++ b/generator/restriction_collector.cpp
@@ -21,13 +21,13 @@ bool ParseLineOfNumbers(istringstream & stream, vector<uint64_t> & numbers)
while (stream)
{
- if (!getline(stream, numberStr, ',' ))
+ if (!getline(stream, numberStr, ','))
return true;
if (numberStr.empty())
return true;
if (!strings::to_uint64(numberStr, number))
- return false;
+ return false;
numbers.push_back(number);
}
@@ -55,9 +55,9 @@ RestrictionCollector::RestrictionCollector(string const & restrictionPath,
bool RestrictionCollector::IsValid() const
{
- return !m_restrictions.empty()
- && find_if(begin(m_restrictions), end(m_restrictions),
- [](Restriction const & r){ return !r.IsValid(); }) == end(m_restrictions);
+ return !m_restrictions.empty() &&
+ find_if(begin(m_restrictions), end(m_restrictions),
+ [](Restriction const & r) { return !r.IsValid(); }) == end(m_restrictions);
}
bool RestrictionCollector::ParseFeatureId2OsmIdsMapping(string const & featureId2OsmIdsPath)
@@ -78,7 +78,7 @@ bool RestrictionCollector::ParseFeatureId2OsmIdsMapping(string const & featureId
return false;
if (ids.size() <= 1)
- return false; // Every line should contain at least feature id and osm id.
+ return false; // Every line should contain at least feature id and osm id.
Restriction::FeatureId const featureId = static_cast<Restriction::FeatureId>(ids.front());
ids.erase(ids.begin());
@@ -100,7 +100,7 @@ bool RestrictionCollector::ParseRestrictions(string const & restrictionPath)
return true;
istringstream lineStream(line);
string typeStr;
- getline(lineStream, typeStr, ',' );
+ getline(lineStream, typeStr, ',');
Restriction::Type type;
if (!FromString(typeStr, type))
return false;
@@ -136,7 +136,7 @@ void RestrictionCollector::ComposeRestrictions()
continue;
}
if (distance(rangeId.first, rangeId.second) != 1)
- continue; // |osmId| mentioned in restrictions was included in more than one feature.
+ continue; // |osmId| mentioned in restrictions was included in more than one feature.
Restriction::FeatureId const & featureId = rangeId.first->second;
// Adding feature id to restriction coresponded to the osm id.
@@ -151,8 +151,8 @@ void RestrictionCollector::ComposeRestrictions()
void RestrictionCollector::RemoveInvalidRestrictions()
{
m_restrictions.erase(remove_if(m_restrictions.begin(), m_restrictions.end(),
- [](Restriction const & r){ return !r.IsValid(); }),
- m_restrictions.end());
+ [](Restriction const & r) { return !r.IsValid(); }),
+ m_restrictions.end());
}
void RestrictionCollector::AddRestriction(Restriction::Type type, vector<uint64_t> const & osmIds)
@@ -163,7 +163,8 @@ void RestrictionCollector::AddRestriction(Restriction::Type type, vector<uint64_
m_restrictionIndex.emplace_back(osmIds[i], Index({restrictionCount, i}));
}
-void RestrictionCollector::AddFeatureId(Restriction::FeatureId featureId, vector<uint64_t> const & osmIds)
+void RestrictionCollector::AddFeatureId(Restriction::FeatureId featureId,
+ vector<uint64_t> const & osmIds)
{
// Note. One |featureId| could correspond to several osm ids.
// but for road feature |featureId| corresponds exactly one osm id.
@@ -175,10 +176,8 @@ string ToString(Restriction::Type const & type)
{
switch (type)
{
- case Restriction::Type::No:
- return kNo;
- case Restriction::Type::Only:
- return kOnly;
+ case Restriction::Type::No: return kNo;
+ case Restriction::Type::Only: return kOnly;
}
return "Unknown";
}
@@ -200,11 +199,7 @@ bool FromString(string str, Restriction::Type & type)
return false;
}
-string DebugPrint(Restriction::Type const & type)
-{
- return ToString(type);
-}
-
+string DebugPrint(Restriction::Type const & type) { return ToString(type); }
string DebugPrint(RestrictionCollector::Index const & index)
{
ostringstream out;
@@ -216,8 +211,8 @@ string DebugPrint(RestrictionCollector::Index const & index)
string DebugPrint(Restriction const & restriction)
{
ostringstream out;
- out << "m_links:[" << ::DebugPrint(restriction.m_links) << "] m_type:"
- << DebugPrint(restriction.m_type) << " ";
+ out << "m_links:[" << ::DebugPrint(restriction.m_links)
+ << "] m_type:" << DebugPrint(restriction.m_type) << " ";
return out.str();
}
} // namespace routing
diff --git a/generator/restriction_collector.hpp b/generator/restriction_collector.hpp
index d30c75c70f..5e02ef65d2 100644
--- a/generator/restriction_collector.hpp
+++ b/generator/restriction_collector.hpp
@@ -25,14 +25,16 @@ public:
struct Index
{
Index(size_t restrictionNumber, size_t linkNumber)
- : m_restrictionNumber(restrictionNumber), m_linkNumber(linkNumber) {}
- size_t m_restrictionNumber = 0; // Restriction number in restriction vector.
- size_t m_linkNumber = 0; // Link number for a restriction. It's equal to zero or one for most cases.
+ : m_restrictionNumber(restrictionNumber), m_linkNumber(linkNumber)
+ {
+ }
+ size_t m_restrictionNumber = 0; // Restriction number in restriction vector.
+ size_t m_linkNumber =
+ 0; // Link number for a restriction. It's equal to zero or one for most cases.
bool operator==(Index const & index) const
{
- return m_restrictionNumber == index.m_restrictionNumber
- && m_linkNumber == index.m_linkNumber;
+ return m_restrictionNumber == index.m_restrictionNumber && m_linkNumber == index.m_linkNumber;
}
};
@@ -48,10 +50,10 @@ public:
/// \returns Sorted vector of restrictions.
RestrictionVec const & GetRestrictions() const { return m_restrictions; }
-
private:
/// \brief Parses comma separated text file with line in following format:
- /// <feature id>, <osm id 1 corresponding feature id>, <osm id 2 corresponding feature id>, and so on
+ /// <feature id>, <osm id 1 corresponding feature id>, <osm id 2 corresponding feature id>, and so
+ /// on
/// For example:
/// 137999, 5170186,
/// 138000, 5170209,
diff --git a/generator/restriction_dumper.cpp b/generator/restriction_dumper.cpp
index da0f09e1b9..2cf878fc41 100644
--- a/generator/restriction_dumper.cpp
+++ b/generator/restriction_dumper.cpp
@@ -1,6 +1,6 @@
+#include "generator/restriction_dumper.hpp"
#include "generator/intermediate_elements.hpp"
#include "generator/osm_id.hpp"
-#include "generator/restriction_dumper.hpp"
#include "generator/restriction_collector.hpp"
#include "indexer/routing.hpp"
@@ -17,20 +17,27 @@ namespace
{
using namespace routing;
-vector<string> const kRestrictionTypesNo = {"no_right_turn", "no_left_turn", "no_u_turn",
- "no_straight_on", "no_entry", "no_exit"};
-vector<string> const kRestrictionTypesOnly = {"only_right_turn", "only_left_turn", "only_straight_on"};
+vector<string> const kRestrictionTypesNo = {"no_right_turn", "no_left_turn", "no_u_turn",
+ "no_straight_on", "no_entry", "no_exit"};
+vector<string> const kRestrictionTypesOnly = {"only_right_turn", "only_left_turn",
+ "only_straight_on"};
/// \brief Converts restriction type form string to RestrictionCollector::Type.
/// \returns Fisrt item is a result of conversion. Second item is true
/// if convertion was successful and false otherwise.
pair<Restriction::Type, bool> TagToType(string const & type)
{
- if (find(kRestrictionTypesNo.cbegin(), kRestrictionTypesNo.cend(), type) != kRestrictionTypesNo.cend())
+ if (find(kRestrictionTypesNo.cbegin(), kRestrictionTypesNo.cend(), type) !=
+ kRestrictionTypesNo.cend())
+ {
return make_pair(Restriction::Type::No, true);
+ }
- if (find(kRestrictionTypesOnly.cbegin(), kRestrictionTypesOnly.cend(), type) != kRestrictionTypesOnly.cend())
+ if (find(kRestrictionTypesOnly.cbegin(), kRestrictionTypesOnly.cend(), type) !=
+ kRestrictionTypesOnly.cend())
+ {
return make_pair(Restriction::Type::Only, true);
+ }
// Unsupported restriction type.
return make_pair(Restriction::Type::No, false);
@@ -48,10 +55,7 @@ void RestrictionDumper::Open(string const & fullPath)
LOG(LINFO, ("Cannot open file", fullPath));
}
-bool RestrictionDumper::IsOpened()
-{
- return m_stream.is_open() && !m_stream.fail();
-}
+bool RestrictionDumper::IsOpened() { return m_stream.is_open() && !m_stream.fail(); }
void RestrictionDumper::Write(RelationElement const & relationElement)
{
@@ -62,11 +66,11 @@ void RestrictionDumper::Write(RelationElement const & relationElement)
// Note. For the time being only line-point-line road restriction is supported.
if (relationElement.nodes.size() != 1 || relationElement.ways.size() != 2)
- return; // Unsupported restriction. For example line-line-line.
+ return; // Unsupported restriction. For example line-line-line.
// Extracting osm ids of lines and points of the restriction.
- auto const findTag = [&relationElement](vector<pair<uint64_t, string>> const & members, string const & tag)
- {
+ auto const findTag = [&relationElement](vector<pair<uint64_t, string>> const & members,
+ string const & tag) {
auto const it = find_if(members.cbegin(), members.cend(),
[&tag](pair<uint64_t, string> const & p) { return p.second == tag; });
return it;
@@ -74,27 +78,26 @@ void RestrictionDumper::Write(RelationElement const & relationElement)
auto const fromIt = findTag(relationElement.ways, "from");
if (fromIt == relationElement.ways.cend())
- return; // No tag |from| in |relationElement.ways|.
+ return; // No tag |from| in |relationElement.ways|.
auto const toIt = findTag(relationElement.ways, "to");
if (toIt == relationElement.ways.cend())
- return; // No tag |to| in |relationElement.ways|.
+ return; // No tag |to| in |relationElement.ways|.
- if (findTag(relationElement.nodes,"via") == relationElement.nodes.cend())
- return; // No tag |via| in |relationElement.nodes|.
+ if (findTag(relationElement.nodes, "via") == relationElement.nodes.cend())
+ return; // No tag |via| in |relationElement.nodes|.
// Extracting type of restriction.
auto const tagIt = relationElement.tags.find("restriction");
if (tagIt == relationElement.tags.end())
- return; // Type of the element is different from "restriction".
+ return; // Type of the element is different from "restriction".
auto const typeResult = TagToType(tagIt->second);
if (typeResult.second == false)
- return; // Unsupported restriction type.
+ return; // Unsupported restriction type.
// Adding restriction.
- m_stream << ToString(typeResult.first) << "," // Restriction type
- << fromIt->first << ", "
- << toIt->first << "," << endl;
+ m_stream << ToString(typeResult.first) << "," // Restriction type
+ << fromIt->first << ", " << toIt->first << "," << endl;
}
} // namespace routing
diff --git a/generator/restriction_dumper.hpp b/generator/restriction_dumper.hpp
index 7bc0c0e6ee..b86a6ababe 100644
--- a/generator/restriction_dumper.hpp
+++ b/generator/restriction_dumper.hpp
@@ -16,7 +16,8 @@ public:
bool IsOpened();
/// \brief Writes |relationElement| to |m_stream| if |relationElement| is a supported restriction.
- /// \note For the time being only line-point-line restritions are processed. The other restrictions
+ /// \note For the time being only line-point-line restritions are processed. The other
+ /// restrictions
/// are ignored.
// @TODO(bykoianko) It's necessary to process all kind of restrictions.
void Write(RelationElement const & relationElement);
diff --git a/generator/restriction_generator.cpp b/generator/restriction_generator.cpp
index ac35ba141b..5f96f72a5e 100644
--- a/generator/restriction_generator.cpp
+++ b/generator/restriction_generator.cpp
@@ -45,7 +45,8 @@ namespace routing
bool BuildRoadRestrictions(string const & mwmPath, string const & restrictionPath,
string const & featureId2OsmIdsPath)
{
- LOG(LINFO, ("BuildRoadRestrictions(", mwmPath, ", ", restrictionPath, ", ", featureId2OsmIdsPath, ");"));
+ LOG(LINFO,
+ ("BuildRoadRestrictions(", mwmPath, ", ", restrictionPath, ", ", featureId2OsmIdsPath, ");"));
RestrictionCollector restrictionCollector(restrictionPath, featureId2OsmIdsPath);
if (!restrictionCollector.IsValid())
{
@@ -56,13 +57,14 @@ bool BuildRoadRestrictions(string const & mwmPath, string const & restrictionPat
RestrictionVec const & restrictions = restrictionCollector.GetRestrictions();
- auto const firstOnlyIt = upper_bound(restrictions.cbegin(), restrictions.cend(),
- Restriction(Restriction::Type::No, 0), my::LessBy(&Restriction::m_type));
+ auto const firstOnlyIt =
+ upper_bound(restrictions.cbegin(), restrictions.cend(), Restriction(Restriction::Type::No, 0),
+ my::LessBy(&Restriction::m_type));
RoutingHeader header;
header.m_noRestrictionCount = distance(restrictions.cbegin(), firstOnlyIt);
header.m_onlyRestrictionCount = restrictions.size() - header.m_noRestrictionCount;
- LOG(LINFO, ("Header info. There are", header.m_noRestrictionCount, "and", header.m_onlyRestrictionCount,
- "only restrictions"));
+ LOG(LINFO, ("Header info. There are", header.m_noRestrictionCount, "and",
+ header.m_onlyRestrictionCount, "only restrictions"));
FilesContainerW cont(mwmPath, FileWriter::OP_WRITE_EXISTING);
FileWriter w = cont.GetWriter(ROUTING_FILE_TAG);
diff --git a/generator/restriction_generator.hpp b/generator/restriction_generator.hpp
index ce7eca560a..9c6f41f5a1 100644
--- a/generator/restriction_generator.hpp
+++ b/generator/restriction_generator.hpp
@@ -12,9 +12,11 @@ namespace routing
/// For example:
/// Only, 335049632, 49356687,
/// No, 157616940, 157616940,
-/// \param featureId2OsmIdsPath comma separated (csv like) file with mapping from feature id to osm ids
+/// \param featureId2OsmIdsPath comma separated (csv like) file with mapping from feature id to osm
+/// ids
/// in following format:
-/// <feature id>, <osm id 1 corresponding feature id>, <osm id 2 corresponding feature id>, and so on
+/// <feature id>, <osm id 1 corresponding feature id>, <osm id 2 corresponding feature id>, and so
+/// on
/// For example:
/// 137999, 5170186,
/// 138000, 5170209,
diff --git a/generator/world_map_generator.hpp b/generator/world_map_generator.hpp
index 0503bb0bf7..593fa074cf 100644
--- a/generator/world_map_generator.hpp
+++ b/generator/world_map_generator.hpp
@@ -313,7 +313,6 @@ class CountryMapGenerator
public:
explicit CountryMapGenerator(feature::GenerateInfo const & info) : m_bucket(info) {}
-
void operator()(FeatureBuilder1 fb, SyncOfstream & featureId2osmIds)
{
if (feature::PreprocessForCountryMap(fb))