Changeset 2853
- Timestamp:
- 04/02/08 15:40:19 (9 months ago)
- Files:
-
- trunk/projects/bos/web/contract-tree.lisp (modified) (5 diffs)
- trunk/projects/bos/web/image-tree.lisp (modified) (1 diff)
- trunk/projects/bos/web/webserver.lisp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/projects/bos/web/contract-tree.lisp
r2852 r2853 5 5 (let ((step (float (/ (max height width) image-size)))) 6 6 (cl-gd:with-default-image (image) 7 (cl-gd:fill-image 0 0 :color (cl-gd:find-color 255 255 255)) 7 (setf (cl-gd:save-alpha-p) t) 8 (setf (cl-gd:alpha-blending-p) nil) 9 (cl-gd:fill-image 0 0 :color (cl-gd:find-color 255 255 255 :alpha 127)) 8 10 (cl-gd:do-rows (y) 9 11 (cl-gd:do-pixels-in-row (x) … … 12 14 (contract (and m2 (m2-contract m2)))) 13 15 (when (and contract (contract-paidp contract)) 14 ;; FIXME bos.m2::colorize-pixel not needed here 15 (setf (cl-gd:raw-pixel) (apply #'bos.m2::colorize-pixel (cl-gd:raw-pixel) (contract-color contract))))))))))) 16 (setf (cl-gd:raw-pixel) (apply #'cl-gd:find-color (contract-color contract))))))))))) 16 17 17 18 … … 30 31 (children :initarg :children :reader children) 31 32 (pixelize :initarg :pixelize :reader pixelize) 32 (root :initarg :root :accessor root)) 33 (root :initarg :root :accessor root) 34 (depth :initarg :depth :accessor depth)) 33 35 (:metaclass indexed-class) 34 36 (:class-indices (ids :index-type contract-tree-node-index … … 118 120 (>= (/ output-images-size (max width height)) 119 121 max-pixel-per-meter))) 120 (rec (class geo-location pixelize )122 (rec (class geo-location pixelize &optional (depth 0)) 121 123 (let ((children (unless (leaf-node-p geo-location) 122 (mapcar #'(lambda (gl) (rec (cdr class) gl (cdr pixelize) ))124 (mapcar #'(lambda (gl) (rec (cdr class) gl (cdr pixelize) (1+ depth))) 123 125 (children-geo-locations geo-location))))) 124 126 (make-instance (car class) 125 127 :geo-location geo-location 126 128 :children children 127 :pixelize (car pixelize))))) 129 :pixelize (car pixelize) 130 :depth depth)))) 128 131 (let ((tree (rec (stick-on-last '(contract-tree contract-tree-node)) 129 132 (ensure-square geo-location) … … 184 187 (emit-image-to-browser image :png :date (timestamp object))))) 185 188 189 (defclass contract-tree-kml-handler (contract-tree-handler) 190 () 191 (:documentation "Generates a kml representation of the queried 192 contract-tree-node. If the node has children, corresponding network 193 links are created.")) 194 195 (defmethod handle-object ((handler contract-tree-kml-handler) (obj contract-tree-node)) 196 (with-xml-response (:content-type "text/xml" #+nil"application/vnd.google-earth.kml+xml" 197 :root-element "kml") 198 (let ((lod '(:min 256 :max 1024)) 199 (rect (make-rectangle2 (geo-location obj)))) 200 (with-element "Document" 201 (kml-region rect lod) 202 (kml-overlay (format nil "~a:~a/contract-tree-image/~d" *website-url* *port* (id obj)) 203 rect (+ 100 (depth obj))) 204 (dolist (child (children obj)) 205 (kml-network-link (format nil "~a:~a/contract-tree-kml/~d" *website-url* *port* (id child)) 206 (make-rectangle2 (geo-location child)) 207 '(:min 256 :max 1024))))))) 208 trunk/projects/bos/web/image-tree.lisp
r2847 r2853 466 466 :dest-width output-images-size 467 467 :dest-height output-images-size) 468 #+nil 468 469 (cl-gd:with-default-color ((cl-gd:allocate-color 255 0 0 :image image)) 469 470 ;; (cl-gd:draw-string 10 10 (format nil "~D,~D (~D x ~D)" image-x image-y image-width image-height) trunk/projects/bos/web/webserver.lisp
r2851 r2853 204 204 ("/image-tree-kml" image-tree-kml-handler) 205 205 ("/image-tree" image-tree-handler) 206 ("/contract-tree-kml" contract-tree-kml-handler) 206 207 ("/contract-tree-image" contract-tree-image-handler) 207 208 ("/contract-tree" contract-tree-handler)
