地理地图图像组代码 310
**** Hidden Message ***** 看起来像像素信息,如果你能打开调试器,比如说jpg应该看到类似的十六进制代码。 看起来像像素信息,如果你能打开调试器,比如说jpg应该会看到类似的十六进制代码
看看dcl中的矢量图像,它们需要类似样式的数据。 由于BIGAL,但是我希望多一点 实际上它不是RGB,而是RGBA,所以将这个巨大的字符串分成4字节的块,然后将每个十六进制字节转换成十进制
谢谢Vovka。我已经看到你的回答 我看了一下这个,它似乎可以进行rgb转换。
;; Base to Decimal-Lee Mac
;; Converts an number in an arbitrary base to decimal.
;; n - string representing number to convert
;; b - base of input string
;; Returns: Decimal representation of supplied number
(defun LM:base->dec ( n b / l )
(if (= 1 (setq l (strlen n)))
(- (ascii n) (if (dec (substr n 1 (1- l)) b)) (LM:base->dec (substr n l) b))
)
)
(setq str "F0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFE5DCCAFFFFFFFFFFFFFFFFFFFFFFFFFFE5DCCAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEAFFF0EEEA")
(defun c:test ()
(setq x 1)
(setq lst2 '())
(repeat (/ (strlen str) 8)
(setq lst '())
(repeat 4
(setq hex (strcat (substr str x 1)(substr str (setq x (+ x 1)) 1) ))
(setq num (LM:base->dec hex 16))
(setq lst (cons num lst))
(setq x (+ x 1))
)
(setq lst2 (cons (reverse lst) lst2))
)
(princ lst2)
(princ)
)
Bigal,
您的代码在理论上是可行的,但是由于有这么多310代码,字符串长度变得惊人。我相信有几十万根绳子。如果有人想提高自己,我会把我现在的代码贴在下面。(我的“Hex2RGBA”功能最需要改进)
d2010,
我相信Geomap图像在2014年才发布,所以我不认为我可以发布旧版本。任何可以使用GEO (GEOGRAPHICLOCATION)命令并显示“地理位置”上下文功能区的人都可以创建地理地图图像。
当前代码:
(defun LM:base->dec ( n b / l )
(if (= 1 (setq l (strlen n)))
(- (ascii n) (if (
(+ (* b (LM:base->dec (substr n 1 (1- l)) b)) (LM:base->dec (substr n l) b))
)
)
;; hex - string, of hexadecimal values (no spaces) to convert to RGBA.
;; returns - list, of RGBA values as ((R G B A) (R G B A) ...) or nil if errors detected.
(defun Hex2RGBA (hex / pos len errMsg rgba return)
;; Prep
(setq pos -1 len (strlen hex))
;; Initial Check(s)
(setq errMsg
(cond
((not (zerop (rem len 8))) "\nHex2RGBA error; Invalid hex string length.")
);cond
);setq
(if errMsg
(prompt errMsg)
;else
(repeat (/ len 8)
(setq rgba '())
(setq return
(cons
(reverse
(repeat 4
(setq rgba
(cons
(LM:base->dec
(substr hex (setq pos (+ 2 pos)) 2)
16
);LM
rgba
);cons
);setq
);repeat
);reverse
return
);cons
);setq
);repeat
);if
(reverse return)
);defun
(defun Get310s (e / )
(mapcar
'cdr
(vl-remove-if
'(lambda (x) (/= 310 (car x)))
(entget e)
);vl-remove-if
);mapcar
);defun
(defun c:GEOCOPY ( / gmap gc310 hex rgba)
(prompt "\nSelect Geomap Image: ")
(if (and (setq gmap (car (nentsel "\nSelect Geomap Image: ")))
(eq "GEOMAPIMAGE" (cdr (assoc 0 (entget gmap)))))
(progn
(setq gc310 (Get310s gmap))
(setq hex (apply 'strcat gc310))
(setq rgba (hex2rgba hex))
;; Do stuff with RGBA
(prompt "\nGEOCOPY Complete.")
);progn
);if
(princ)
);defun
最佳,
~DD 使用地图车可能会加快读取4个字节的部分,但不要问我怎么做。
您可能会碰到lisp字符串长度?? 不是创建一个很长的字符串,而是分别转换每个gc 310部分。
页:
[1]
2