[mcclim-devel] Drawing graphs & scaling

Thibault Langlois tl at di.fc.ul.pt
Tue Mar 22 15:49:42 UTC 2005


Hello,

I would like to be able to scale a graph:

(defmethod plot ((object tree) stream)
  (with-scaling (stream 0.7)
    (draw-graph (list (root-node object))
                #'draw-node-colors
                :stream stream)))

where draw-graph is directly inspired from an example 
in allegro CLIM manual:

(defun draw-graph (root-nodes draw-node-function &rest keys)
  (apply #'format-graph-from-roots
         root-nodes
         #'(lambda (node s)
             (multiple-value-bind ()
                 (with-output-as-presentation (s node 'node)
                   (funcall draw-node-function node s))))
         #'(lambda (n)
             (if (visible-p n)
                 (children n)))
         keys))
and draw-node-colors draws a node using draw-rectangle*. 

The problem is that when the scaling factor is not 1 the nodes are not
correctly placed (although they are correctly scaled) with respect to arcs.
 
Any ideas ?

Thanks.

Thibault





More information about the mcclim-devel mailing list