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:
authorДобрый Ээх <bukharaev@gmail.com>2016-11-15 13:25:38 +0300
committerДобрый Ээх <bukharaev@gmail.com>2016-11-24 17:53:04 +0300
commit950801a350eca43b5202e4c436726cde52f1a5ed (patch)
treea6d53186354328651780783eb5ff9ff451f7d955 /routing/road_index.cpp
parentbe1213029222d42a7a230f6c165f668a1d0ffd8b (diff)
Pull request #4672 review fixes
Diffstat (limited to 'routing/road_index.cpp')
-rw-r--r--routing/road_index.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/routing/road_index.cpp b/routing/road_index.cpp
new file mode 100644
index 0000000000..acc1a9d8e8
--- /dev/null
+++ b/routing/road_index.cpp
@@ -0,0 +1,31 @@
+#include "routing/road_index.hpp"
+
+#include "base/exception.hpp"
+
+#include "std/utility.hpp"
+
+namespace routing
+{
+void RoadIndex::Import(vector<Joint> const & joints)
+{
+ for (Joint::Id jointId = 0; jointId < joints.size(); ++jointId)
+ {
+ Joint const & joint = joints[jointId];
+ for (uint32_t i = 0; i < joint.GetSize(); ++i)
+ {
+ RoadPoint const & entry = joint.GetEntry(i);
+ RoadJointIds & roadJoints = m_roads[entry.GetFeatureId()];
+ roadJoints.AddJoint(entry.GetPointId(), jointId);
+ }
+ }
+}
+
+pair<Joint::Id, uint32_t> RoadIndex::FindNeighbor(RoadPoint rp, bool forward) const
+{
+ auto const it = m_roads.find(rp.GetFeatureId());
+ if (it == m_roads.cend())
+ MYTHROW(RootException, ("RoadIndex doesn't contains feature", rp.GetFeatureId()));
+
+ return it->second.FindNeighbor(rp.GetPointId(), forward);
+}
+} // namespace routing