Compass Widget

Compass

This page contains a compass widget parcel for VisualWorks 5i Smalltalk. Visualworks is long gone but you might be able to get this up and running on something like Pharo with more effort than I am prepared to exert. The compass widget is made available under the terms of the GNU LGPL.

Download

Compass Widget 1.0

Installation

Either copy the .pcl and .pst files to the parcels subdirectory of your VisualWorks installation directory or keep them locally; the search path for parcels usually includes the current working directory.

Load the compass widget into an image using the Tools > Load Parcel Named ... menu option. The CoolImage parcel will also be loaded.

Usage

Palette Loading the compass widget parcel will add the compass widget to the UI painter palette. This widget can be placed in the same way as any other widget.

Rose A background "rose" showing the cardinal points of the compass is used by default. To change the rose, define a method which returns an image on your UI. Add the method name to the Rose property using the properties tool for the widget; this method is a resource and can appear on either the class or instance side of the UI.

Needle A simple needle showing the compass direction is used by default. To change the needle shape, define a method on your UI that returns a Geometric -- usually a Polyline -- that gives the shape of the needle. Add the method name to the Needle property using the properties tool for the widget; this method is a resource and can appear on either the class or instance side of the UI.

The compass widget models the direction in radians, with East being 0 radians and the value increasing in the clockwise direction. This convention is arguably wrong -- North is conventionally 0 and degrees or mills are usually used -- but is convenient from a programmer's point of view.