gov.noaa.pmel.sgt
Class Graph

java.lang.Object
  |
  +--gov.noaa.pmel.sgt.Graph
All Implemented Interfaces:
java.util.EventListener, java.beans.PropertyChangeListener
Direct Known Subclasses:
CartesianGraph

public abstract class Graph
extends java.lang.Object
implements java.beans.PropertyChangeListener

Abstract base class for all graphics drawn on a Layer. The Graph class defines the interfaces for the user to physical coordinate, user to device, and physical to user coordinate systems.

The following demonstrates how a CartesianGraph may be used.

   // Create a CartesianGraph and transforms.

    CartesianGraph graph;
    LinearTransform xt, yt;
    Range2D xPhysRange, xUserRange;
    Range2D yPhysRange, yUserRange;
    Point2D.Double origin;

    graph = new CartesianGraph("Point Graph");
    layer.setGraph(graph);
    xt = new LinearTransform(xPhysRange, xUserRange);
    yt = new LinearTransform(yPhysRange, yUserRange);
    graph.setXTransform(xt);
    graph.setYTransform(yt);
    origin = new Point2D.Double(xUserRange.start,
                                yUserRange.start);

     // Create the bottom axis, set its range in user units
     // and its origin. Add the axis to the graph.

    PlainAxis xbot;

    xbot = new PlainAxis("Botton Axis");
    xbot.setRangeU(xUserRange);
    xbot.setLocationU(origin);
    graph.addXAxis(xbot);

     // Create the left axis, set its range in user units
     // and its origin. Add the axis to the graph.

    PlainAxis yleft;

    yleft = new PlainAxis("Left Axis");
    yleft.setRangeU(yUserRange);
    yleft.setLocationU(origin);
    graph.addYAxis(yleft);

     // Create a PointAttribute for the display of the
     // Collection of points. The points will be marked
     // with a red triangle and labelled at the NE corner
     // in blue.

    PointAttribute pattr;

    pattr = new PointAttribute(10, Color.red);

     // Associate the attribute and the point Collection
     // with the graph.

    graph.setData(col, pattr);
 

Since:
1.0
Version:
$Revision: 1.12 $, $Date: 2003/08/22 23:02:32 $
Author:
Donald Denbo
See Also:
Layer, LinearTransform, PlainAxis, SGLabel, CartesianGraph

Constructor Summary
Graph()
          Default constructor.
Graph(java.lang.String id)
          Constructor for Graph class.
 
Method Summary
static Range2D computeRange(double min, double max, int num)
          Compute a "nice" range from the minimum, maximum, and number of intervals.
static Range2D computeRange(Range2D range, int num)
          Compute a "nice" range from a range and number of intervals.
static SoTRange computeRange(SoTRange range, int num)
          Compute a "nice" range from a range and number of intervals.
abstract  Graph copy()
          Copy the Graph object and all attached classes.
abstract  SGTData getDataAt(java.awt.Point pt)
          Find data at a Point
 java.lang.String getId()
          Get the Graph identifier
 Layer getLayer()
          Get the associated Layer.
 AbstractPane getPane()
          Return parent pane.
 void modified(java.lang.String mess)
          Used internally by sgt.
 java.lang.String toString()
          Get a String representation of the Graph.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.beans.PropertyChangeListener
propertyChange
 

Constructor Detail

Graph

public Graph()
Default constructor.


Graph

public Graph(java.lang.String id)
Constructor for Graph class.

Parameters:
id - identifier
Method Detail

copy

public abstract Graph copy()
Copy the Graph object and all attached classes.


getId

public java.lang.String getId()
Get the Graph identifier

Returns:
ident

getLayer

public Layer getLayer()
Get the associated Layer.

Returns:
Layer object

getPane

public AbstractPane getPane()
Return parent pane.

Since:
2.0

modified

public void modified(java.lang.String mess)
Used internally by sgt.

Since:
2.0

computeRange

public static Range2D computeRange(Range2D range,
                                   int num)
Compute a "nice" range from a range and number of intervals.

Parameters:
range - min and max values
num - number of intervals
Returns:
"nice" range

computeRange

public static SoTRange computeRange(SoTRange range,
                                    int num)
Compute a "nice" range from a range and number of intervals.

Parameters:
range - min and max values
num - number of intervals
Returns:
"nice" range
Since:
2.0

computeRange

public static Range2D computeRange(double min,
                                   double max,
                                   int num)
Compute a "nice" range from the minimum, maximum, and number of intervals.

Parameters:
min - minimum value
max - maximum value
num - number of intervals
Returns:
"nice" range

toString

public java.lang.String toString()
Get a String representation of the Graph.

Overrides:
toString in class java.lang.Object
Returns:
String representation

getDataAt

public abstract SGTData getDataAt(java.awt.Point pt)
Find data at a Point

Since:
3.0


Send comments about the Scientific Graphics toolkit to Donald.W.Denbo@noaa.gov. For more information about Java Development in the EPIC Group see the EPIC Software Page
Generated on October 9 2003