Changeset 2666
- Timestamp:
- 03/06/08 07:17:06 (10 months ago)
- Files:
-
- trunk/projects/bos/m2/allocation.lisp (modified) (1 diff)
- trunk/projects/bos/web/allocation-area-handlers.lisp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/projects/bos/m2/allocation.lisp
r2386 r2666 114 114 ;; Kanten duerfen nicht auf einen Punkt zusammenfallen. 115 115 (assert (not (and (zerop (- (car a) (car b))) 116 (zerop (- (cdr a) (cdr b))))))) 116 (zerop (- (cdr a) (cdr b))))) 117 nil 118 "~a and ~a (mxm coordinates) are too close to each other ~ 119 to be considered independent polygon vertices." a b)) 117 120 (coerce vertices 'vector)) 118 121 ;; Punkte muessen im Vergabegebiet liegen trunk/projects/bos/web/allocation-area-handlers.lisp
r2660 r2666 65 65 (:p 66 66 ((:form :method "post") 67 (submit-button "delete" "delete" :confirm "Really delete the allocation area?"))) 67 (submit-button "delete" "delete" :confirm "Really delete the allocation area?") 68 (if active-p 69 (submit-button "deactivate" "deactivate" :confirm "Really deactivate the allocation area?") 70 (submit-button "activate" "activate" :confirm "Really activate the allocation area?")))) 68 71 (:h2 "Allocation Graphics") 69 72 ((:table :cellspacing "0" :cellpadding "0" :border "0") … … 80 83 (with-bos-cms-page (:title "Allocation area has been deleted") 81 84 (:h2 "The allocation area has been deleted"))) 85 86 (defmethod handle-object-form ((handler allocation-area-handler) (action (eql :activate)) allocation-area req) 87 (bos.m2::activate-allocation-area allocation-area) 88 (with-bos-cms-page (req :title "Allocation area has been activated") 89 (:h2 "The allocation area has been activated"))) 90 91 (defmethod handle-object-form ((handler allocation-area-handler) (action (eql :deactivate)) allocation-area req) 92 (bos.m2::deactivate-allocation-area allocation-area) 93 (with-bos-cms-page (req :title "Allocation area has been deactivated") 94 (:h2 "The allocation area has been deactivated"))) 82 95 83 96 (defclass allocation-area-gfx-handler (editor-only-handler object-handler) … … 226 239 227 240 (defun parse-point (line) 228 (destructuring-bind (x y) (read-from-string (format nil "(~A)" line)) 229 (cons (scale-coordinate 'x +nw-utm-x+ x) 230 (- +width+ (scale-coordinate 'y (- +nw-utm-y+ +width+) y))))) 241 (let ((line (string-right-trim '(#\Return) line))) 242 (unless (ppcre:scan line "^\\s*$") 243 (destructuring-bind (x y) (read-from-string (format nil "(~A)" line)) 244 (cons (scale-coordinate 'x +nw-utm-x+ x) 245 (- +width+ (scale-coordinate 'y (- +nw-utm-y+ +width+) y))))))) 231 246 232 247 (defun polygon-from-text-file (filename) 233 248 (coerce (with-open-file (input-file filename) 234 249 (loop 250 with last-point 235 251 for line-number from 1 236 252 for line = (read-line input-file nil) 237 253 while line 238 collect (handler-case 239 (parse-point line) 240 (error (e) 241 (error "~A in line ~A" e line-number))))) 254 for point = (handler-case 255 (parse-point line) 256 (error (e) 257 (error "Problem with text file in line ~A '~A': ~A in " line-number line e))) 258 when (and point (not (equal point last-point))) 259 collect (setq last-point point))) 242 260 'vector)) 243 261
