Navigation: rerouting off the route (30 m for 3 fixes, HDOP ≤ 5, every 15 s at most) from the position to the points not reached yet; lanes as SVG arrows, the ones to take bold; dashboard background see-through with a slider; the GNSS simulation starts at a random place in the offline countries, the map jumping there
This commit is contained in:
1 parent
fbccb2acc9
commit
5f4c7c6ee8
9 files changed
+176
-35
No files matched your search
@@ -1259,7 +1259,8 @@ module Maptool
|
||||
end
|
||||
|
||||
# The GNSS simulation: POST {"start": [lon, lat]} drives randomly from
|
||||
# there, DELETE stops it, GET says whether it's on (and why it stopped).
|
||||
# there, POST {} from a random place in the offline countries, DELETE
|
||||
# stops it, GET says whether it's on (and why it stopped).
|
||||
get "/api/sim/gnss" do
|
||||
require_login!
|
||||
json running: GNSS_SIM.running?, error: GNSS_SIM.error
|
||||
@@ -1268,10 +1269,16 @@ module Maptool
|
||||
post "/api/sim/gnss" do
|
||||
require_login!
|
||||
lon, lat = JSON.parse(request.body.read)["start"]
|
||||
halt 400, json(error: "start must be [lon, lat]") unless lon.is_a?(Numeric) && lat.is_a?(Numeric)
|
||||
if lon.nil?
|
||||
codes = (PmtilesBuilder.offline_meta(DATA_DIR) || {}).fetch("sources", []).map { |source| source["code"] }
|
||||
bboxes = codes.filter_map { |code| PmtilesBuilder.country_bbox(code) }
|
||||
halt 422, json(error: "no offline countries to start in") if bboxes.empty?
|
||||
elsif !lon.is_a?(Numeric) || !lat.is_a?(Numeric)
|
||||
halt 400, json(error: "start must be [lon, lat]")
|
||||
end
|
||||
|
||||
CAN_STORE.override_prefix = "gnss."
|
||||
GNSS_SIM.start(lon, lat) do |fix|
|
||||
GNSS_SIM.start(lon, lat, bboxes: bboxes) do |fix|
|
||||
CAN_STORE.put(fix.transform_keys { |key| "gnss.#{key}" })
|
||||
App.gnss_update(fix)
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user