Compare commits

..

17 Commits

Author SHA1 Message Date
e728052bb6 print each road name once only 2025-06-03 22:18:05 +01:00
7195dbb2d5 make road names bigger and print white behind them 2025-06-03 22:18:05 +01:00
84a80d7c79 upgrade lgi 2025-06-03 22:18:05 +01:00
7934d5ba13 off-white background colour 2025-06-03 22:18:05 +01:00
ccb47e3a3d improve text placement 2025-06-03 22:18:05 +01:00
37767e007a render road names (badly) 2025-06-03 22:18:05 +01:00
76228bc045 parse way name as well as points 2025-06-03 22:18:05 +01:00
39f687d6f5 pass zoom level to canvas 2025-06-03 22:18:05 +01:00
f8a4788ed6 draw roads fatter and with edging 2025-06-03 22:18:05 +01:00
7c18f4442b 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-03 22:18:05 +01:00
dfbf6ac919 clobber map-surface when bounds change 2025-06-03 22:18:05 +01:00
1c065d77e4 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-06-03 22:18:05 +01:00
455c3f50c6 use register-widget more, fewer arrow widget repaints 2025-06-03 22:18:05 +01:00
0d60cc11cc invalidate map only when app-state changes 2025-06-03 22:18:05 +01:00
8357aab222 invalidate the map display each time we repaint it
really we should only need to do this when the app-state changes
2025-06-03 22:18:05 +01:00
d5e82d3427 replace in-memory cache with a persistent json cache
we just store the raw response from overpass
2025-06-03 22:18:05 +01:00
ab4e4857f3 fetch enough tiles to cover the display 2025-06-03 22:18:01 +01:00
2 changed files with 19 additions and 5 deletions

View File

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

View File

@ -143,6 +143,7 @@ label.readout {
cairo.Content.COLOR
(* tile-size (+ 4 num-tiles-x))
(* tile-size (+ 4 num-tiles-y)))
seen-road-names {}
g (cairo.Context.create map-surface)]
(g:set_source_rgb 0.7 0.8 0.8)
@ -157,11 +158,24 @@ label.readout {
(cairo-roads-path g lines bounds)
(g:set_source_rgb 0.2 0.2 0.2)
(g:set_font_size (- road-width 3))
(g:set_font_size (+ road-width 1))
(each [_ line (pairs lines)]
(case line.name
n (let [(x y angle) (label-coords line bounds)]
(when (and x y)
n (let [(x y angle) (label-coords line bounds)
ext (g:text_extents n)
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:move_to x y)
(g:rotate angle)