Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

graph
Class Markers  view Markers download Markers.java

java.lang.Object
  extended bygraph.Markers

public class Markers
extends java.lang.Object

This class installs, manipulates and draws markers. Markers are stroked using the line drawing method of the class Graph. This means that any stroked figure can become a marker.

Version:
$Revision: 2.4 $, $Date: 2001/05/29 09:36:38 $

Field Summary
protected  int last
          index of the last marker loaded
protected  int max
          maximum number of markers allowed
protected  java.util.Vector[] vert
          An array of vectors.
 
Constructor Summary
Markers()
          The class contructor
Markers(java.net.URL file)
          Instantiate the Marker class and load marker definitions from the parsed URL.
 
Method Summary
 void AddMarker(int n, boolean[] draw, int[] x, int[] y)
          Add the definition of a new marker.
 void AddMarker(int m, int n, boolean[] draw, int[] x, int[] y)
          Add the definition of a new marker.
 void ClearMarkers()
          Clear All markers.
 void DeleteMarker(int n)
          Delete the marker with the given index.
 void draw(java.awt.Graphics g, int m, double scale, int x, int y)
          draw the marker
 void LoadMarkers(java.net.URL file)
          This method reads the marker file and loads the marker definitions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

last

protected int last
index of the last marker loaded


max

protected int max
maximum number of markers allowed


vert

protected java.util.Vector[] vert
An array of vectors. Each element in the array contains the vertex vectors for a marker. Marker 1 is at element vert[0].

Constructor Detail

Markers

public Markers()
The class contructor


Markers

public Markers(java.net.URL file)
        throws java.io.IOException
Instantiate the Marker class and load marker definitions from the parsed URL. The format of the file is easily worked out from the default marker file marker.txt.

Method Detail

AddMarker

public void AddMarker(int m,
                      int n,
                      boolean[] draw,
                      int[] x,
                      int[] y)
Add the definition of a new marker. The arrays contain the vertex points of the marker. The boolean array is used to define a relative draw or move to the vertex. The first vertex should always be a move (The boolean array is "true" for a relative draw.


AddMarker

public void AddMarker(int n,
                      boolean[] draw,
                      int[] x,
                      int[] y)
Add the definition of a new marker. The new marker is appended onto the marker list. The center of the marker is assumed to be at (0,0).


DeleteMarker

public void DeleteMarker(int n)
Delete the marker with the given index. the first marker has index 1.


ClearMarkers

public void ClearMarkers()
Clear All markers.


LoadMarkers

public void LoadMarkers(java.net.URL file)
                 throws java.io.IOException
This method reads the marker file and loads the marker definitions. The format of the file is simple. The following are the keywords.
start
starts a new marker definition.
end
ends a marker definition.
m x y
move to position x,y
l x y
line to position x,y
All line drawing is relative to the previous position. The center of the marker is assumed to be at (0,0). As always blank lines are ignored and comments begin with a # character.


draw

public void draw(java.awt.Graphics g,
                 int m,
                 double scale,
                 int x,
                 int y)
draw the marker