Today I made make-line fuction using processing. But we don't need to processing library directly. Because incanter which is R-like statistic tool on JVM implemented by clojure has already processing library.
(ns dgu.alg.visualize-path
(:use [incanter core processing]))
(def x '(0 50 50 149 150 182 108 151 149 213 242 246 322 324 246 0 324 325 244 245 325 323 213 490 489 489 487 364 432 400 0 402 401 402 364 401 444 497 572 602 567 538 528 641 0 0 0 680 680 0 602 0 573 575 680 629 631 538 575 573 364 393 427 461 495 517 364 396 444 490 517 495 461 427 393 0 0 0 0 0 0 0 0 364 416 465 500 538 470 419 364 397 443 497 517 490 444 396 364 410 445 403 0 0 0 0 0 0 0 0 0 0 0 0 0 403 445 494 517 493 456 401 538 567 582 599 582 629 644 660 0 675 691 0 0 0 0 459 497 517 490 538 573 574 680 629 631 680 631 631 680 631 632 0 0 0 171 199 227 0 283 311 339 364 394 0 0 507 285 0 0 142 170 198 227 254 282 311 339 367 0 0 0 0 297 322 330 364 297 322 330 364 340 283 313 340 255 0 229 0 0 0 0 0 0 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 198 198 274 274 274 527 685))
(def y '(0 568 593 556 593 593 593 509 541 476 463 493 463 493 509 0 509 541 556 593 556 593 593 509 540 558 593 556 558 593 0 509 463 493 479 449 449 449 509 549 593 540 593 593 0 0 0 523 579 0 477 0 313 345 329 345 313 370 358 391 436 426 426 426 426 436 401 391 391 391 406 413 413 413 413 0 0 0 0 0 0 0 0 334 325 325 325 334 345 345 367 358 358 358 370 379 379 379 158 138 157 168 0 0 0 0 0 0 0 0 0 0 0 0 0 184 184 184 194 209 209 209 244 238 209 242 279 242 209 242 0 209 242 0 0 0 0 478 463 478 493 426 406 436 375 358 391 423 406 436 476 463 493 0 0 0 138 138 138 0 138 138 138 138 138 0 0 138 593 0 0 36 36 36 36 36 36 36 36 36 0 0 0 0 177 177 177 184 245 245 245 244 279 379 379 379 379 0 379 0 0 0 0 0 0 235 255 264 284 294 314 324 344 353 373 383 403 412 432 442 463 574 525 574 525 478 296 296))
(def loc-of-ap (map #(vector %1 %2) x y))
;0207
(def list-of-traces '((5 22 168 21 27 16 60 66 90 83 191 192 122 21 168 5)
(5 22 19 168 20 16 17 21 41 65 94 87 87 85 83 196 198)
(5 22 168 42 41 43 47 152 50 143 146 58 94 141 140 16 7)
(5 22 168 16 152 52 118 167 47 149 37 138 32 10)
(5 22 168 21 42 41 43 47 54 52 122 100 164 162 161 160 173)
))
;0209
(def list-of-traces '((1 168 21 41 47 151 50 149 151 70 196 198 214) (1 70 87 100 163 162 161 160 158 156 213) (5 168 21 42 139 70 94 87 192 213) (1 9 10 12 60 83 191 189 190 186 184 185 185 184 187 163 192 74 61 74 60 10 196 98 163 161 184 214) (1 5 21 41 43 94 65 139 42 26 168 19 5 4 213)))
(def list-of-traces '((1 5 21 41 43 94 65 139 42 26 168 19 5 4 213)))
;0211
(def list-of-traces '((1 158 160 98 163 100 118 52 56 122 118 167 100 163 161 160 156 214) (1 168 21 41 43 47 54 56 52 83 90 195 214) (1 5 22 19 168 41 43 48 47 148 54 118 100 158 214) (1 5 21 28 41 50 100 163 98 187 192 214) (1 168 21 65 57 163 161 160 158 156 214)))
(def list-of-traces '((1 158 160 98 163 100 118 52 56 122 118 167 100 163 161 160 156 214)))
(defn extraction-from-list-traces [from-to-line]
(for [[f t] from-to-line]
(flatten (list (nth loc-of-ap (int f)) (nth loc-of-ap (int t))))))
(def s (map extraction-from-list-traces (map #(partition 2 1 %) list-of-traces)))
(defn make-path-line [sktch path-line color]
(doseq [[x1 y1 x2 y2] path-line]
(.stroke sktch color)
(.line sktch x1 (- y1 25) x2 (- y2 25))))
(defn make-path-ellipse [sktch path-line gray]
(doseq [[x1 y1 x2 y2] path-line]
; (.fill sktch gray)
(.ellipse sktch x2 (- y2 25) 10 10)))
(def map-image (ref nil))
(def z (zipmap [(color (rand-int 255) (rand-int 255) (rand-int 255))
(color (rand-int 255) (rand-int 255) (rand-int 255)) (color (rand-int 255) (rand-int 255) (rand-int 255)) (color (rand-int 255) (rand-int 255) (rand-int 255)) (color (rand-int 255) (rand-int 255) (rand-int 255))] s))
(defn view-path [s]
(let [z (zipmap [ (color 242 24 75)
(color 27 24 242)
(color 24 252 51)
(color 227 242 24)
(color 0 0 0)] s)
sktch (sketch
(setup []
(doto this
(size 724 641)
(stroke-weight 5)
(framerate 3)
smooth
(dosync (ref-set map-image (load-image this "d:/dev/LCSExt/SPAbackground_photoshop.jpg")))))
(draw []
(doto this
(image @map-image 0 0 724 641)
(fill 0 121 184 5))
(doseq [s z]
(make-path-line this (second s) (first s)))
(doseq [s z]
(make-path-ellipse this (second s) (first s)))))]
(view sktch :size [724 641])))
(view-path s)
(def sktch (sketch
(setup []
(doto this
(size 724 641)
(stroke-weight 2)
(framerate 3)
smooth
(dosync (ref-set map-image (load-image this "d:/dev/LCSExt/SPAbackground_photoshop.jpg")))))
(draw []
(doto this
(image @map-image 0 0)
(fill 0 121 184 5))
(doseq [s z]
(make-path-line this (second s) (first s)))
(doseq [s z]
(make-path-ellipse this (second s) (first s))))))
(view sktch)