[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/osm 13a8a02765 2/2: Filter download queue
From: |
ELPA Syncer |
Subject: |
[elpa] externals/osm 13a8a02765 2/2: Filter download queue |
Date: |
Mon, 7 Mar 2022 14:57:38 -0500 (EST) |
branch: externals/osm
commit 13a8a02765fb8fec5b31609e261b8a2ca707b7d4
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Filter download queue
---
osm.el | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/osm.el b/osm.el
index 78feb77e04..bfe58c5fbb 100644
--- a/osm.el
+++ b/osm.el
@@ -746,11 +746,19 @@ c53 0 96 43 96 96S309 256 256 256z'/>
(defun osm--process-queue ()
"Process the download queue."
(setq osm--queue
- (sort osm--queue
- (pcase-lambda (`(,x1 ,y1 . ,_z1) `(,x2 ,y2 . ,_z2))
- (setq x1 (- x1 (/ osm--x 256)) y1 (- y1 (/ osm--y 256))
- x2 (- x2 (/ osm--x 256)) y2 (- y2 (/ osm--y 256)))
- (< (+ (* x1 x1) (* y1 y1)) (+ (* x2 x2) (* y2 y2))))))
+ (sort
+ (cl-loop for job in osm--queue
+ for (x y . zoom) = job
+ for i = (- x (/ (- osm--x osm--wx) 256))
+ for j = (- y (/ (- osm--y osm--wy) 256))
+ if (and (= zoom osm--zoom)
+ (>= i 0) (< i osm--nx)
+ (>= j 0) (< j osm--ny))
+ collect job)
+ (pcase-lambda (`(,x1 ,y1 . ,_z1) `(,x2 ,y2 . ,_z2))
+ (setq x1 (- x1 (/ osm--x 256)) y1 (- y1 (/ osm--y 256))
+ x2 (- x2 (/ osm--x 256)) y2 (- y2 (/ osm--y 256)))
+ (< (+ (* x1 x1) (* y1 y1)) (+ (* x2 x2) (* y2 y2))))))
(osm--download))
(defun osm--purge-tiles ()