Compare commits

..

15 Commits

Author SHA1 Message Date
0f64758e77 off-white background colour 2025-06-02 23:43:29 +01:00
66d1a585fb improve text placement 2025-06-02 23:43:14 +01:00
2906360c2e render road names (badly) 2025-06-02 21:53:26 +01:00
052cd4b578 parse way name as well as points 2025-06-02 21:35:55 +01:00
35f0f3c71e pass zoom level to canvas 2025-06-02 21:15:56 +01:00
05401941b4 draw roads fatter and with edging 2025-06-02 21:15:18 +01:00
8ee10214c8 async tile fetcher
we use cqueues, which is the async framework that lua-http is built
on. we integrate it into the glib event loop rather hackily by calling
the cqueues event stepper ever 20ms from a glib timeout function

overpass has very low rate limits so we handle a 429 response by
sleeping for a random length of time and retrying. This is, also,
a bit of a hack
2025-06-01 20:50:26 +01:00
195e028e22 clobber map-surface when bounds change 2025-05-30 23:34:17 +01:00
acbe27e6e2 draw map once only and copy it to screen in on_draw
This massively reduces cpu usage, however it doesn't yet work
if we've moved far enough that we'd need to fetch new tiles.
2025-05-30 21:24:28 +01:00
2a86a2bfde use register-widget more, fewer arrow widget repaints 2025-05-29 21:13:19 +01:00
f64bfeb7fd invalidate map only when app-state changes 2025-05-29 21:09:24 +01:00
cb0314d1d6 invalidate the map display each time we repaint it
really we should only need to do this when the app-state changes
2025-05-29 21:03:02 +01:00
6e61113366 replace in-memory cache with a persistent json cache
we just store the raw response from overpass
2025-05-29 18:43:48 +01:00
86682a2ad6 fetch enough tiles to cover the display 2025-05-29 18:13:47 +01:00
995880e5a3 wip 2025-05-29 12:48:21 +01:00
2 changed files with 5 additions and 19 deletions

View File

@ -31,8 +31,8 @@ let
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "lgi-devs"; owner = "lgi-devs";
repo = "lgi"; repo = "lgi";
rev = "a412921fad445bcfc05a21148722a92ecb93ad06"; rev = "e06ad94c8a1c84e3cdb80cee293450a280dfcbc7";
hash = "sha256-kZBpH5gcaCNU134Wn6JXAkFELzmiphc1PeCtmN9cagc="; hash = "sha256-VYr/DV1FAyzPe6p6Quc1nmsHup23IAMfz532rL167Q4=";
}; };
}; };
rxi-json = callPackage ../rxi-json { lua = lua5_3; }; rxi-json = callPackage ../rxi-json { lua = lua5_3; };

View File

@ -143,7 +143,6 @@ label.readout {
cairo.Content.COLOR cairo.Content.COLOR
(* tile-size (+ 4 num-tiles-x)) (* tile-size (+ 4 num-tiles-x))
(* tile-size (+ 4 num-tiles-y))) (* tile-size (+ 4 num-tiles-y)))
seen-road-names {}
g (cairo.Context.create map-surface)] g (cairo.Context.create map-surface)]
(g:set_source_rgb 0.7 0.8 0.8) (g:set_source_rgb 0.7 0.8 0.8)
@ -158,24 +157,11 @@ label.readout {
(cairo-roads-path g lines bounds) (cairo-roads-path g lines bounds)
(g:set_source_rgb 0.2 0.2 0.2) (g:set_source_rgb 0.2 0.2 0.2)
(g:set_font_size (+ road-width 1)) (g:set_font_size (- road-width 3))
(each [_ line (pairs lines)] (each [_ line (pairs lines)]
(case line.name (case line.name
n (let [(x y angle) (label-coords line bounds) n (let [(x y angle) (label-coords line bounds)]
ext (g:text_extents n) (when (and x y)
w ext.width
h ext.height]
(when (and x y (not (. seen-road-names n)))
(tset seen-road-names n true)
(g:save)
(g:set_line_width h)
(g:set_source_rgb 1 1 1)
(g:move_to (- x 1) (- y 1))
(g:rotate angle)
(g:rel_line_to (+ w 1) 0)
(g:stroke)
(g:restore)
(g:save) (g:save)
(g:move_to x y) (g:move_to x y)
(g:rotate angle) (g:rotate angle)