From: attila.lendvai Date: Mon, 20 Feb 2006 19:16:06 +0000 (-0500) Subject: Some small changes in the cl-graphviz part X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=dfe1ca9987337cf9e8ad32aa44d6a55c0d8a7c75;p=cl-graph.git Some small changes in the cl-graphviz part darcs-hash:20060220191606-6b9e8-de313b77691b3be3ff9685a9e5866a8a38fb82f9.gz --- diff --git a/dev/graphviz/graphviz-support-optional.lisp b/dev/graphviz/graphviz-support-optional.lisp index b1b2e07..f281576 100644 --- a/dev/graphviz/graphviz-support-optional.lisp +++ b/dev/graphviz/graphviz-support-optional.lisp @@ -30,7 +30,7 @@ loaded when cl-graphviz is available. (args (list dot :graph-visitor (lambda (dot-graph) - (setf (dot-attribute :bb g) + (setf (dot-attribute-value :bb g) (graphviz:graph-bounding-box dot-graph))) :node-visitor @@ -44,9 +44,9 @@ loaded when cl-graphviz is available. ;; TODO search-for-vertex is sloooow, use a hashtable or ;; introduce an graph-find-element-by-id-mixin, or similar (let ((vertex (find-vertex-by-id g (graphviz:node-name node)))) - (setf (dot-attribute :pos vertex) pos) - (setf (dot-attribute :width vertex) width) - (setf (dot-attribute :height vertex) height)))) + (setf (dot-attribute-value :pos vertex) pos + (dot-attribute-value :width vertex) width + (dot-attribute-value :height vertex) height)))) :edge-visitor (lambda (edge) @@ -65,7 +65,8 @@ loaded when cl-graphviz is available. ;; (graphviz:bezier-points bezier)) (dolist (el (graphviz:bezier-points bezier)) (push el bezier-points)))) - (setf (dot-attribute :pos real-edge) (nreverse bezier-points)))))))) + (setf (dot-attribute-value :pos real-edge) + (nreverse bezier-points)))))))) (when algorithm-provided-p (nconc args (list :algorithm algorithm))) (apply 'graphviz:layout-dot-format args)) diff --git a/dev/graphviz/graphviz-support.lisp b/dev/graphviz/graphviz-support.lisp index e07e661..4b3bbd3 100644 --- a/dev/graphviz/graphviz-support.lisp +++ b/dev/graphviz/graphviz-support.lisp @@ -321,7 +321,7 @@ B--D [] (defclass* dot-edge-mixin (dot-attributes-mixin) () (:export-p t)) -(defclass* dot-graph (graph-container dot-graph-mixin) +(defclass* dot-graph (dot-graph-mixin graph-container) () (:default-initargs :vertex-class 'dot-vertex @@ -329,18 +329,18 @@ B--D [] :undirected-edge-class 'dot-edge) (:export-p t)) -(defclass* dot-vertex (graph-container-vertex dot-vertex-mixin) () +(defclass* dot-vertex (dot-vertex-mixin graph-container-vertex) () (:export-p t)) -(defclass* dot-edge (graph-container-edge dot-edge-mixin) () +(defclass* dot-edge (dot-edge-mixin graph-container-edge) () (:export-p t)) -(defclass* dot-directed-edge (directed-edge-mixin dot-edge) () +(defclass* dot-directed-edge (dot-edge directed-edge-mixin) () (:export-p t)) -(defmethod (setf dot-attribute) :before (value (attr symbol) (thing dot-attributes-mixin)) +(defmethod (setf dot-attribute-value) :before (value (attr symbol) (thing dot-attributes-mixin)) (ensure-valid-dot-attribute attr thing)) -(defmethod (setf dot-attribute) (value (attr symbol) (thing dot-attributes-mixin)) +(defmethod (setf dot-attribute-value) (value (attr symbol) (thing dot-attributes-mixin)) (setf (getf (dot-attributes thing) attr) value)) (defmethod dot-attribute-value ((attr symbol) (thing dot-attributes-mixin)) @@ -392,7 +392,7 @@ B--D [] (princ el str) (setf first nil))) (princ "\"" str))) - ((member spline bounding-box) + ((member spline) (with-output-to-string (str) (princ "\"" str) (let ((first t)) @@ -404,6 +404,18 @@ B--D [] (princ (second el) str) (setf first nil))) (princ "\"" str))) + ((member bounding-box) + (with-output-to-string (str) + (princ "\"" str) + (let ((first t)) + (dolist (el value) + (unless first + (princ ", " str)) + (princ (first el) str) + (princ "," str) + (princ (second el) str) + (setf first nil))) + (princ "\"" str))) ((member integer) (unless (typep value 'integer) (error "Invalid value for ~S: ~S is not an integer" diff --git a/dev/package.lisp b/dev/package.lisp index 5cf6d08..4a00188 100644 --- a/dev/package.lisp +++ b/dev/package.lisp @@ -84,6 +84,8 @@ DISCUSSION #:dot-vertex #:dot-edge #:dot-attributes + #:layout-graph-with-graphviz + #:dot-attribute-value #:connected-graph-p #:find-connected-components @@ -92,10 +94,6 @@ DISCUSSION #:target-vertex #:source-vertex - #:layout-graph-with-graphviz - #:dot-attribute-value - #:dot-attribute - #:add-edge ; graph edge #:delete-edge ; graph edge