From ab200cb7e83615ecaec381eb8512694216bb643c Mon Sep 17 00:00:00 2001 From: Johannes Nonnenmacher Date: Fri, 17 Nov 2023 16:23:35 +0100 Subject: [PATCH] add try catch and make it static --- src/baldr/graphtile.cc | 4 ++-- valhalla/baldr/graphtile.h | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/baldr/graphtile.cc b/src/baldr/graphtile.cc index 2721fe4ee5..20c7ffb670 100644 --- a/src/baldr/graphtile.cc +++ b/src/baldr/graphtile.cc @@ -368,11 +368,11 @@ void GraphTile::Initialize(const GraphId& graphid) { } else { lane_connectivity_size_ = header_->end_offset() - header_->lane_connectivity_offset(); } - + /* try { live_speed_fading_sec_ = config().get("baldr.live_speed_fading_sec", 3600); } catch (const ConfigUninitializedException& e) { live_speed_fading_sec_ = 3600; } - + */ // For reference - how to use the end offset to set size of an object (that // is not fixed size and count). // example_size_ = header_->end_offset() - header_->example_offset(); diff --git a/valhalla/baldr/graphtile.h b/valhalla/baldr/graphtile.h index 572c34e6cf..9437e2fccb 100644 --- a/valhalla/baldr/graphtile.h +++ b/valhalla/baldr/graphtile.h @@ -653,7 +653,9 @@ class GraphTile { // TODO(danpat): for short-ish durations along the route, we should fade live // speeds into any historic/predictive/average value we'd normally use - double live_speed_fade = 1. / live_speed_fading_sec_; + try { + static double live_speed_fade = 1. / config().get("baldr.live_speed_fading_sec", 3600); + } catch (const ConfigUninitializedException& e) { static double live_speed_fade = 1. / 3600; } // This parameter describes the weight of live-traffic on a specific edge. In the beginning of the // route live-traffic gives more information about current congestion situation. But the further @@ -886,8 +888,10 @@ class GraphTile { // Predicted speeds PredictedSpeeds predictedspeeds_; + /* // Time (in seconds) over which live speed will be faded into other traffic speed sources float live_speed_fading_sec_; + */ // Map of stop one stops in this tile. std::unordered_map stop_one_stops;