Drive as the Design canvas' Grid: the page as 16 × 10 cells from a screen profile (public/drive/road.json, {area, widget, …} per cell, to be edited in the app later), the map 13 × 8 with nothing over it; the manoeuvre, speed, limit, altitude, time, sun, status (online, rec), next stop with km / ETA to it and to the end, the route's elevation of the next 10 km, a compass; keys Trip, Points, Layers, Search, Menu, − + 3D Follow, Terrain, day/dusk/night. A menu opens in the right 7 × 8 as cells of its own and the map narrows to 9 × 8 (drive_menus.js): Trip and Search as GridTrip / GridSearch (a stop a row, ✓ ↑ ↓ ✕ a cell each; results with their pins on the map); Points as GridPoints (the library nearest the car — /api/search with no words and a center lists every saved feature nearest first — along the route ahead, shown, or one folder at a time; an eye per row, + a point as a stop); Layers as GridLayers (the On the map panel's own switches and Online | Offline, presets Road / Off-road / Overnight, + Keep); Terrain as GridTerrain (roll / pitch dials with the max held, climb and side slope ahead from the DEM, the next 2 km, Level here = can.json's levelling action in two taps), on by itself on an unpaved surface (/api/road now gives Valhalla's surface) or past 10° for 10 s, back after 2 km of paved road, automatic / by hand in the Menu. The dashboard polls for the grid without its overlay; the old drive bar and floating buttons gone
This commit is contained in:
1 parent
285af64a65
commit
f73badd107
14 files changed
+1253
-277
No files matched your search
@@ -316,17 +316,18 @@ module Maptool
|
||||
end
|
||||
|
||||
# The road at the end of a short trace ([[lon, lat], ...] oldest first,
|
||||
# the last few fixes) for driving without a route: its name, class and
|
||||
# speed limit. Map-matched, so the road actually driven, not just the
|
||||
# the last few fixes) for driving without a route: its name, class,
|
||||
# speed limit and surface (Valhalla's: paved_smooth … impassable — the
|
||||
# driving grid's Terrain view switches itself on past "paved_rough"). Map-matched, so the road actually driven, not just the
|
||||
# nearest one (a bridge over the motorway).
|
||||
def self.road(valhalla_url, points)
|
||||
raise RouteError, "at least two points are needed" if points.size < 2
|
||||
|
||||
data = valhalla(valhalla_url, "/trace_attributes",
|
||||
shape: points.map { |lon, lat| { lon: Float(lon), lat: Float(lat) } }, costing: "auto", shape_match: "map_snap",
|
||||
filters: { attributes: %w[edge.names edge.road_class edge.speed_limit], action: "include" })
|
||||
filters: { attributes: %w[edge.names edge.road_class edge.speed_limit edge.surface], action: "include" })
|
||||
edge = data["edges"]&.last or raise RouteError, "no road here"
|
||||
{ name: edge["names"]&.first, road_class: edge["road_class"], speed_limit: speed_limit(edge["speed_limit"]) }
|
||||
{ name: edge["names"]&.first, road_class: edge["road_class"], speed_limit: speed_limit(edge["speed_limit"]), surface: edge["surface"] }.compact
|
||||
rescue ArgumentError, TypeError
|
||||
raise RouteError, "invalid coordinates"
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user