我希望OP感谢你的专业知识。 埃尔登,
对此不太确定,他擅离职守了
ymg公司 这是一个从坐标到瓷砖名称的函数。
它需要post#10中的assoc list digl
(defun coordtotile (p / l e n)
(setq l (list (fix (/ (car p) 100000)) (fix (/ (cadr p) 100000)))
e (fix (/ (- (car p)(* (car l)100000)) 1000))
n (fix (/ (- (cadr p) (* (cadr l) 100000)) 1000))
)
(strcat (cdr (assoc l digl)) (itoa e) (itoa n))
)
还有一个将点转换为平铺名称的例程。
这一个不需要assoc列表。
(defun floor (x) (if (minusp (rem x 1)) (- (fix x) 1) (fix x)))
;; Translated to Autolisp froma C# routine by Alex@UEA ;
;; http://www.codeproject.com/Articles/13577/GPS-Deriving-British-Ordnance-Survey-Grid-Referenc ;
(defun pt->ngr (p / eing ex ning nx tm)
(setq ex (/ (car p)500000)
nx (/ (cadr p) 500000)
tm (+ (- (floor ex) (* 5 (floor nx))) 17)
nx (* 5 (- nx (floor nx)))
ex (+ (- 20 (* 5 (floor nx)) (floor (* 5 (- ex (floor ex))))))
ex (if (> ex 7) (1+ ex) ex)
tm (if (> tm 7) (1+ tm) tm)
eing (rtos (car p) 2 0)
ning (rtos (cadr p) 2 0)
eing (substr eing 2 (- (strlen eing) 4))
ning (substr ning 2 (- (strlen ning) 4))
)
(strcat (chr (+ tm 65)) (chr (+ ex 65)) eing ning)
)
页:
1
[2]