-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmgredit.lisp
28 lines (25 loc) · 1.2 KB
/
mgredit.lisp
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ;;;
;;; ~*~ mgredit.lisp ~*~ ;;;
;;; ;;;
;; A graph editor using TK gui (cl-simple-tk) ;;;
;;; ;;;
;;; Author: Andrej Vodopivec <[email protected]> ;;;
;;; Licence: GPL version 2 or later ;;;
;;; ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(in-package :maxima)
(defun $graph_input ()
(let ((g ($empty_graph 0)) (mpos))
(multiple-value-bind (vrt edg pos) (tk-gredit:editor)
(dolist (v vrt)
(add-vertex (parse-integer v) g)
(let ((vpos (gethash v pos)))
(push `((mlist simp)
,(parse-integer v)
((mlist simp) ,(car vpos) ,(- 600 (cadr vpos))))
mpos)))
(dolist (e edg)
(add-edge (mapcar #'parse-integer e) g)))
($set_positions (cons '(mlist simp) mpos) g)
g))