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-01 17:20:01 +0300
committerVladimir Byko-Ianko <v.bykoianko@corp.mail.ru>2016-11-10 18:58:20 +0300
commite98617e13f14e4e542c735f3e172459d3014aae4 (patch)
tree28b43e0be42ebadaccf4975258beab665c18f288 /generator
parent02d98d9e0ce2704e717032ce4fbd2b5df6b58c85 (diff)
Moving restriction functionality to routing namespace.
Diffstat (limited to 'generator')
-rw-r--r--generator/generator_tests/restrictions_tests.cpp3
-rw-r--r--generator/osm_translator.hpp10
-rw-r--r--generator/restriction_dumper.cpp5
-rw-r--r--generator/restriction_dumper.hpp3
-rw-r--r--generator/restrictions.cpp6
-rw-r--r--generator/restrictions.hpp3
6 files changed, 24 insertions, 6 deletions
diff --git a/generator/generator_tests/restrictions_tests.cpp b/generator/generator_tests/restrictions_tests.cpp
index 6ab48027c7..c9708fe35a 100644
--- a/generator/generator_tests/restrictions_tests.cpp
+++ b/generator/generator_tests/restrictions_tests.cpp
@@ -16,6 +16,8 @@
using namespace platform;
using namespace platform::tests_support;
+namespace routing
+{
string const kRestrictionTestDir = "test-restrictions";
UNIT_TEST(RestrictionTest_ValidCase)
@@ -156,3 +158,4 @@ UNIT_TEST(RestrictionTest_RestrictionCollectorWholeClassTest)
{RestrictionCollector::Type::Only, {3, 4}}};
TEST_EQUAL(restrictionCollector.GetRestriction(), expectedRestrictions, ());
}
+} // namespace routing
diff --git a/generator/osm_translator.hpp b/generator/osm_translator.hpp
index ebfc7face9..c539d5c425 100644
--- a/generator/osm_translator.hpp
+++ b/generator/osm_translator.hpp
@@ -29,7 +29,7 @@ namespace
class RelationTagsBase
{
public:
- RelationTagsBase(RestrictionDumper & restrictionDumper)
+ RelationTagsBase(routing::RestrictionDumper & restrictionDumper)
: m_restrictionDumper(restrictionDumper), m_cache(14) {}
void Reset(uint64_t fID, OsmElement * p)
@@ -75,7 +75,7 @@ protected:
protected:
uint64_t m_featureID;
OsmElement * m_current;
- RestrictionDumper & m_restrictionDumper;
+ routing::RestrictionDumper & m_restrictionDumper;
private:
my::Cache<uint64_t, RelationElement> m_cache;
@@ -86,7 +86,7 @@ class RelationTagsNode : public RelationTagsBase
using TBase = RelationTagsBase;
public:
- RelationTagsNode(RestrictionDumper & restrictionDumper)
+ RelationTagsNode(routing::RestrictionDumper & restrictionDumper)
: RelationTagsBase(restrictionDumper) {}
protected:
@@ -127,7 +127,7 @@ protected:
class RelationTagsWay : public RelationTagsBase
{
public:
- RelationTagsWay(RestrictionDumper & restrictionDumper)
+ RelationTagsWay(routing::RestrictionDumper & restrictionDumper)
: RelationTagsBase(restrictionDumper) {}
private:
@@ -207,7 +207,7 @@ class OsmToFeatureTranslator
uint32_t m_coastType;
unique_ptr<FileWriter> m_addrWriter;
- RestrictionDumper m_restrictionDumper;
+ routing::RestrictionDumper m_restrictionDumper;
RelationTagsNode m_nodeRelations;
RelationTagsWay m_wayRelations;
diff --git a/generator/restriction_dumper.cpp b/generator/restriction_dumper.cpp
index 3068c5739c..a7b266154b 100644
--- a/generator/restriction_dumper.cpp
+++ b/generator/restriction_dumper.cpp
@@ -12,6 +12,8 @@
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"};
@@ -32,6 +34,8 @@ pair<RestrictionCollector::Type, bool> TagToType(string const & type)
}
} // namespace
+namespace routing
+{
void RestrictionDumper::Open(string const & fullPath)
{
LOG(LINFO, ("Saving road restrictions in osm id terms to", fullPath));
@@ -90,3 +94,4 @@ void RestrictionDumper::Write(RelationElement const & relationElement)
<< fromIt->first << ", "
<< toIt->first << "," << endl;
}
+} // namespace routing
diff --git a/generator/restriction_dumper.hpp b/generator/restriction_dumper.hpp
index ded3dd731a..7bc0c0e6ee 100644
--- a/generator/restriction_dumper.hpp
+++ b/generator/restriction_dumper.hpp
@@ -5,6 +5,8 @@
class RelationElement;
+namespace routing
+{
class RestrictionDumper
{
ofstream m_stream;
@@ -19,3 +21,4 @@ public:
// @TODO(bykoianko) It's necessary to process all kind of restrictions.
void Write(RelationElement const & relationElement);
};
+} // namespace routing
diff --git a/generator/restrictions.cpp b/generator/restrictions.cpp
index fd79c41779..c7e14ff517 100644
--- a/generator/restrictions.cpp
+++ b/generator/restrictions.cpp
@@ -35,6 +35,8 @@ bool ParseLineOfNumbers(istringstream & stream, vector<uint64_t> & numbers)
}
} // namespace
+namespace routing
+{
RestrictionCollector::FeatureId const RestrictionCollector::kInvalidFeatureId =
numeric_limits<RestrictionCollector::FeatureId>::max();
@@ -245,6 +247,8 @@ string DebugPrint(RestrictionCollector::Index const & index)
string DebugPrint(RestrictionCollector::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/restrictions.hpp b/generator/restrictions.hpp
index 73dfa4f433..4c3aaa0bdf 100644
--- a/generator/restrictions.hpp
+++ b/generator/restrictions.hpp
@@ -9,6 +9,8 @@
class RelationElement;
+namespace routing
+{
/// This class collects all relations with type restriction and save feature ids of
/// their road feature in text file for using later.
class RestrictionCollector
@@ -125,3 +127,4 @@ bool FromString(string str, RestrictionCollector::Type & type);
string DebugPrint(RestrictionCollector::Type const & type);
string DebugPrint(RestrictionCollector::Index const & index);
string DebugPrint(RestrictionCollector::Restriction const & restriction);
+} // namespace routing