Changeset 3569

Show
Ignore:
Timestamp:
07/23/08 10:34:26 (4 months ago)
Author:
ksprotte
Message:

added new function m2s-connected-p for debugging purposes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/projects/bos/m2/m2.lisp

    r3554 r3569  
    111111                (geo-utm:utm-x-y-to-lon-lat (+ +nw-utm-x+ x) (- +nw-utm-y+ y) +utm-zone+ t))) 
    112112            polygon))) 
     113 
     114(defun m2s-connected-p (m2s) 
     115  "Is this region of m2 objects geographically connected? We do 
     116  not care about associated contracts or anything else." 
     117  (labels ((m2-neighbours (m2) 
     118             (let ((x (m2-x m2)) 
     119                   (y (m2-y m2))) 
     120               (delete-if (lambda (m2) (not (member m2 m2s))) 
     121                          (list (get-m2 (1- x) y) 
     122                                (get-m2 (1+ x) y) 
     123                                (get-m2 x      (1- y)) 
     124                                (get-m2 x      (1+ y))))))) 
     125    (geometry:nodes-connected-p m2s 
     126                                #'m2-neighbours 
     127                                #'eq))) 
    113128 
    114129;;;; SPONSOR