Developer's Guidebook

 by Mark Grundland for Godfried Toussaint
Computational Geometry Lab

School of Computer Science at McGill University
Version 1.2.0
November 1998


The Basic Steps

The Technical Details



The JeoEdit package, consisting of the JeoEditPoints applet and the JeoEditPolygon applet, is a set of Java visual editors for computational geometry. Their mission is to help the computational geometry community to realize its algorithms and theorems on the internet, by providing a flexible and easy interface for drawing a set of points or a polygon as well as the means to communicate this geometric information to any applet. These editors focus on user interaction while your applet can concentrate on algorithmic calculation. All you really have to do is to take the geometric data and run with it.

This guide will tell you how to enable your Java applet to communicate with the JeoEdit editors. It assumes that you know what you are doing - you should know the basics of Java beforehand. To learn more about JeoEditPoints, check out the JeoEditPoints applet and read its operating manual. Similarly to learn more about JeoEditPolygon, check out the JeoEditPolygon applet and read its operating manual. Finally, if you're at the School of Computer Science at McGill University, you may be interested in my hints on how to get Java to work on campus.

There are two ways in which the JeoEdit package can be integrated with your applet. First, the editors are specifically designed to be embeddable. Many of their visual as well as functional characteristics are configurable and either the whole editor or only its drawing canvas can be embedded in another applet as a self-contained module. However, since currently the editors are not JavaBeans, such a solution would call for the writing of some custom code - contact me if this is required. The second way relies on interapplet communication and it is a much simpler scenario for all concerned. The user creates and edits the geometric objects, points in JeoEditPoints or a polygon in JeoEditPolygon. The editor then acts as a server, sending the geometric information, a list of points or a list of polygon vertices, to all the client applets that reside on the same web page as the editor. In order to receive this information, a client applet must be a subclass of the JeoEditUser class and implement the receive method. The rest of this guide will show you how this can be done.

The Basic Steps

Here are three basic steps for developing an applet which can communicate with a JeoEdit editor:

  1. Download all components that you will need to deploy the editor on your web site from either Windows archives and, or UNIX archives JeoEditPointsArchive.tar or JeoEditPolygonArchive.tar. Each archive is approximately 300K.
  2. Create a web page to house your applet as well as the editor. Place all the editor's components in the same directory as the web page. For an example, look at the JeoEditPoints page or the JeoEditPolygon page.
  3. Create your applet. Make its main Applet class a subclass of the JeoEditUser class, which takes care of all the details involved with interapplet communication, and implement the receive abstract method of JeoEditUser class to process the geometric data sent by the editor. Examine to see how it works. For an example of a client applet, look at or

The advantage of using the JeoEdit editors is that they provide a flexible and powerful self-contained interface for the user to manipulate the geometric structures that drive your applet, leaving you free to create the applet of your dreams without having to worry about how that interface works. However interapplet communication is not so easy to debug, since many development environments allow you to debug only one applet at a time. They usually don't support debugging an applet while it is running in a web browser or debugging multiple applets that are running concurrently and communicating with each other. The best you can do is to create a set of text files containing the various test cases for your applet (the output of PointPrinterDemo or PolygonPrinterDemo may prove helpful in constructing these files). Then to debug your applet, read in your test files in place of the data that user would generate with a JeoEdit editor. This way, not only your applet is easier to test, but your tests are more repeatable.

The Technical Details:


<APPLET CODE="RunJeoEditPoints.class"
ALT="JeoEditPoints is loading...">

Similarly, to deploy JeoEditPolygon on a web page use the HTML tag:

<APPLET CODE="RunJeoEditPolygon.class"
ALT="JeoEditPolygon is loading...">



public boolean action(Event act, Object data){
if (super.action(act, data)) {
return true;
< process action event >

If the client applet's subclass of JeoEditUser needs to override the getParameter(String) method then it should use the following code:

public String getParameter(String p){
if (p.equals(JeoEditUser.usesJeoEdit)) {
return super.getParameter(p);
< process parameter request >

Also the client applet's subclass of JeoEditUser should never override the run() method.





public abstract void receive (double x[], double y[], long timestamp, int workspace, int datatype, String editor, int reserved1, int reserved2)

double x[]: 0.0 <= x[i] <= 1.0
the x coordinates of the geometric data

double y[]: 0.0 <= y[i] <= 1.0
the y coordinates of the geometric data

long timestamp: in milliseconds
the time when the geometric data was sent

int workspace: 1 <= workspace <= 5
the editor's workspace where the geometric object resides

int datatype: JeoEditUser constants
is polygonDataID if the data specifies the vertices of a polygon
is pointsDataID if the data specifies a point set

String editor: unique name of the editor sending the data

int reserved1: reserved for future use

int reserved2: reserved for future use

Wishing you lots of happy-go-lucky code...

Mark Grundland

JeoEdit Package: Copyright © 1998 Mark Grundland & Godfried Toussaint.
All rights reserved.