add on-completion callback to tile fetcher, invalidate map-surface
This commit is contained in:
parent
a0898ff056
commit
39a2e49422
@ -91,6 +91,8 @@ label.readout {
|
||||
|
||||
(local cq (cqueues.new))
|
||||
|
||||
(var map-surface nil)
|
||||
|
||||
(fn cairo-the-map [window]
|
||||
(let [{ : lat : lon : zoom } app-state
|
||||
{ : num-tiles-x : num-tiles-y &as bounds } (map-bounds lat lon zoom)
|
||||
@ -98,7 +100,9 @@ label.readout {
|
||||
|
||||
(for [x bounds.min.x bounds.max.x]
|
||||
(for [y bounds.min.y bounds.max.y]
|
||||
(merge lines (tiles.polylines cq x y zoom))))
|
||||
(merge lines (tiles.polylines cq x y zoom
|
||||
#(set map-surface nil)
|
||||
))))
|
||||
|
||||
(let [map-surface
|
||||
(window:create_similar_surface
|
||||
@ -126,7 +130,6 @@ label.readout {
|
||||
(g:stroke)
|
||||
map-surface)))
|
||||
|
||||
(var map-surface nil)
|
||||
|
||||
(fn on-osm-draw [widget g]
|
||||
(when (not map-surface)
|
||||
|
@ -104,7 +104,7 @@
|
||||
;; we'd like to have a way for completed background fetch to signal
|
||||
;; so that the map can be redrawn
|
||||
|
||||
(fn polylines [cq x y zoom]
|
||||
(fn polylines [cq x y zoom cb]
|
||||
(let [k (.. x "_" y "_" zoom)
|
||||
pathname (.. "/tmp/tiles/" k ".json")]
|
||||
(if (file-exists? pathname)
|
||||
@ -124,6 +124,7 @@
|
||||
(cqueues.sleep (math.random 2 6))))
|
||||
(print "got " k)
|
||||
(f:write json)
|
||||
(cb)
|
||||
true)))
|
||||
[] ; return no lines for now
|
||||
))))
|
||||
|
Loading…
Reference in New Issue
Block a user