@@ -99,6 +99,7 @@ PathAlgorithm::PathAlgorithm()
99
99
edgelabel_index_ (0 ),
100
100
adjacencylist_(nullptr ),
101
101
edgestatus_(nullptr ),
102
+ walking_distance_(0 ),
102
103
best_destination_{kInvalidLabel , Cost (std::numeric_limits<float >::max (), 0 .0f )} {
103
104
edgelabels_.reserve (kInitialEdgeLabelCount );
104
105
}
@@ -155,7 +156,7 @@ void PathAlgorithm::Init(const PointLL& origll, const PointLL& destll,
155
156
hierarchy_limits_ = costing->GetHierarchyLimits ();
156
157
}
157
158
158
- // Calculate best path.
159
+ // Calculate best path. This method is single mode, no time dependency.
159
160
std::vector<PathInfo> PathAlgorithm::GetBestPath (const PathLocation& origin,
160
161
const PathLocation& destination, GraphReader& graphreader,
161
162
const std::shared_ptr<DynamicCost>& costing) {
@@ -165,7 +166,6 @@ std::vector<PathInfo> PathAlgorithm::GetBestPath(const PathLocation& origin,
165
166
costing->GetFilter ());
166
167
167
168
// Check for trivial path
168
- // TODO -currently mode is the same along entire path.
169
169
mode_ = costing->travelmode ();
170
170
auto trivial_id = trivial (origin, dest);
171
171
if (trivial_id.Is_Valid ()) {
@@ -291,10 +291,6 @@ std::vector<PathInfo> PathAlgorithm::GetBestPath(const PathLocation& origin,
291
291
costing->EdgeCost (directededge, nodeinfo->density ()) +
292
292
costing->TransitionCost (directededge, nodeinfo, pred);
293
293
294
- // Update walking distance
295
- walking_distance_ = (mode_ == TravelMode::kPedestrian ) ?
296
- pred.walking_distance () + directededge->length () : 0 ;
297
-
298
294
// Check if edge is temporarily labeled and this path has less cost. If
299
295
// less cost the predecessor is updated and the sort cost is decremented
300
296
// by the difference in real cost (A* heuristic doesn't change)
@@ -315,7 +311,7 @@ std::vector<PathInfo> PathAlgorithm::GetBestPath(const PathLocation& origin,
315
311
// Add edge label, add to the adjacency list and set edge status
316
312
edgelabels_.emplace_back (predindex, edgeid, directededge,
317
313
newcost, sortcost, dist, directededge->restrictions (),
318
- directededge->opp_local_idx (), mode_, walking_distance_ );
314
+ directededge->opp_local_idx (), mode_);
319
315
adjacencylist_->Add (edgelabel_index_, sortcost);
320
316
edgestatus_->Set (edgeid, kTemporary , edgelabel_index_);
321
317
edgelabel_index_++;
@@ -628,8 +624,7 @@ void PathAlgorithm::CheckIfLowerCostPath(const uint32_t idx,
628
624
if (dc > 0 ) {
629
625
float oldsortcost = edgelabels_[idx].sortcost ();
630
626
float newsortcost = oldsortcost - dc;
631
- edgelabels_[idx].Update (predindex, newcost, newsortcost,
632
- walking_distance_);
627
+ edgelabels_[idx].Update (predindex, newcost, newsortcost);
633
628
adjacencylist_->DecreaseCost (idx, newsortcost, oldsortcost);
634
629
}
635
630
}
@@ -651,7 +646,7 @@ void PathAlgorithm::HandleTransitionEdge(const uint32_t level,
651
646
// predecessor information. Transition edges have no length.
652
647
edgelabels_.emplace_back (predindex, edgeid,
653
648
edge, pred.cost (), pred.sortcost (), pred.distance (),
654
- pred.restrictions (), pred.opp_local_idx (), mode_, 0 );
649
+ pred.restrictions (), pred.opp_local_idx (), mode_);
655
650
656
651
// Add to the adjacency list and set edge status
657
652
adjacencylist_->Add (edgelabel_index_, pred.sortcost ());
@@ -703,7 +698,7 @@ void PathAlgorithm::SetOrigin(GraphReader& graphreader,
703
698
// to invalid to indicate the origin of the path.
704
699
edgelabels_.emplace_back (kInvalidLabel , edgeid,
705
700
directededge, cost, sortcost, dist, 0 ,
706
- directededge->opp_local_idx (), mode_, 0 );
701
+ directededge->opp_local_idx (), mode_);
707
702
adjacencylist_->Add (edgelabel_index_, sortcost);
708
703
edgestatus_->Set (edgeid, kTemporary , edgelabel_index_);
709
704
edgelabel_index_++;
0 commit comments