forked from wboag/SPlanner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvis.rkt
45 lines (40 loc) · 1.42 KB
/
vis.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#lang racket
(require pict)
(require pict/tree-layout)
;(require "test-srts.rkt")
(require "util.rkt")
(require "course.rkt")
(require "al-doerr.rkt")
(define TXTSIZE 15)
(define TXT 15)
(define (vis-prereq str len)
(let* [(circ (colorize (disk (* len TXTSIZE) #:draw-border? #f) "orange"))
(txt (text str null TXT 0))]
(cc-superimpose circ txt)))
(define (vis-level-from-top lst len)
(define (vis-tree req)
(cons (vis-prereq (string-append
(number->string (list-index req lst))
": "
(course-number req)
)
len)
(list (if (null? (course->prereqs-list req)) '()
(map vis-tree (course->prereq-courses req))))))
(define (combine req)
(apply tree-layout #:pict (car req)
(if (null? (cadr req))
(list #f)
(map combine (cadr req)))))
(combine (vis-tree (last lst))))
;(define (vis-most-coherent sorts)
; (let* [(srt (argmin coherence sorts))
; (maxlen (apply max (map (lambda (lst)
; (string-length
; (car lst))) srt)))
; (top-req (last srt))]
; (vis-level-from-top top-req maxlen)))
;(define reqs (vis-most-coherent sorts))
;(define vis-tree (naive-layered reqs #:y-spacing 50))
;(show-pict vis-tree)
(provide (all-defined-out))