home *** CD-ROM | disk | FTP | other *** search
- ; book pp.304-306
-
- (require "data/tutorial")
-
- (setf w (plot-lines (kernel-dens precipitation :width 1)))
-
- (send w :add-slot 'kernel-width 1)
- (send w :add-slot 'kernel-type 'b)
- (defmeth w :kernel-width (&optional width)
- (when width
- (setf (slot-value 'kernel-width) width)
- (send self :set-lines))
- (slot-value 'kernel-width))
- (defmeth w :kernel-type (&optional type)
- (when type
- (setf (slot-value 'kernel-type) type)
- (send self :set-lines))
- (slot-value 'kernel-type))
-
- (defmeth w :set-lines ()
- (let ((width (send self :kernel-width))
- (type (send self :kernel-type)))
- (send self :clear-lines :draw nil)
- (send self :add-lines
- (kernel-dens precipitation
- :width width :type type))))
- (setf slider (interval-slider-dialog '(.25 1.5)
- :action #'(lambda (s) (send w :kernel-width s))))
- (send w :add-subordinate slider)
- (send slider :value 1)
-
- (defmeth w :choose-kernel ()
- (let* ((types '("Bisquare" "Gaussian" "Triangle" "Uniform"))
- (i (choose-item-dialog "Kernel Type" types)))
- (if i (send w :kernel-type (select '(b g t u) i)))))
- (setf kernel-item (send menu-item-proto :new "Kernel Type"
- :action #'(lambda () (send w :choose-kernel))))
- (send (send w :menu) :append-items kernel-item)
-