edu.davidson.display
Class SContour

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--edu.davidson.graph.Graph2D
                    |
                    +--edu.davidson.display.SGraph
                          |
                          +--edu.davidson.display.SContour
All Implemented Interfaces:
javax.accessibility.Accessible, java.lang.Cloneable, java.awt.image.ImageObserver, java.awt.MenuContainer, java.lang.Runnable, SDataListener, java.io.Serializable

public class SContour
extends SGraph

This class extends the graphics class Graph2D to incorporate contouring.

See Also:
Serialized Form

Field Summary
 boolean noContours
          Boolean value if true Contours will not be calculated
 
Fields inherited from class edu.davidson.graph.Graph2D
borderBottom, borderLeft, borderRight, borderTop, clearAll, datarect, drawgrid, drawzero, frame, framecolor, gridcolor, lastText, loadingData, paintAll, square, zerocolor
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
SContour()
          Instantaite the class
 
Method Summary
 void attachContours()
          Attach contours so that they will be plotted.
 void calculateCurve(double aLevel)
           
 void createSampleData()
           
 void deleteAllSeries()
          Delete all series from the graph.
 void deleteContours()
          Delete all the Contours
 void detachContours()
          Detach contours so that they will not be plotted.
 int[] getDim()
          return the dimensions of the grid
 double[] getGrid()
          Return the grid
 int getLabelPrecision()
          Get the label precision.
 int getLabelSignificance()
          Get the number of significant figures for labels.
 int getLabelStyle()
          Get the label style, either TextLine.SCIENTIFIC or TextLine.ALGEBRAIC.
 double[] getLevels()
          Return the contour levels.
 double[] getRange()
          Return the range of the grid
 void jbInit()
           
 void paintFirst(java.awt.Graphics g, java.awt.Rectangle r)
           
 void paintLast(java.awt.Graphics g, java.awt.Rectangle rect)
          A hook into the Graph2D.paint method.
 void setAutoLevels(boolean b)
          If true contour levels are calculated automatically.
 void setContourColor(java.awt.Color c)
          Set the contour's color.
 void setDrawLabels(boolean b)
          If true contour levels are not labeled.
 void setGrid(double[][] newGrid)
          Set the grid to be contoured.
 void setGrid(double[][] newGrid, double _xmin, double _xmax, double _ymin, double _ymax)
           
 void setGrid(double[] grid, int nx, int ny)
          Set the grid to be contoured.
 void setLabelColor(java.awt.Color c)
          Set the Color to be used with all the labels.
 void setLabelFont(java.awt.Font f)
          Set the font to be used with All the labels
 void setLabelledContourColor(java.awt.Color c)
          Set the labelled contour's color.
 void setLabelLevels(int i)
          Set the contour levels that are to have labels.
 void setLabelPrecision(int p)
          Set the label precision.
 void setLabels(edu.davidson.graph.TextLine[] labels, int nl)
          Manually set the Contour labels.
 void setLabelSignificance(int s)
          Set the label significant figures.
 void setLabelStyle(int s)
          Set the label style, either TextLine.SCIENTIFIC or TextLine.ALGEBRAIC.
 void setLevels(double[] levels, int nl)
          Manually set the contour levels.
 void setLimitsToGrid(boolean b)
          If true the limits of the plot will be the grid limits.
 void setLogLevels(boolean b)
          If true contour levels are calculated on a log scale.
 void setNLevels(int l)
          Set the number of contour levels.
 void setNoContours(boolean nc)
          Do not draw contours
 void setRange(double xmin, double xmax, double ymin, double ymax)
          Set the range of the grid
 
Methods inherited from class edu.davidson.display.SGraph
addCursor, addData, addData, addData, addDataSet, addDatum, addDatum, addFunction, addFunction, addThing, adjustScale, clearAllData, clearAllThings, clearSeries, clearSeriesData, clone, createSeries, deleteAllFunctions, deleteAllNonSeriesData, deleteFunction, deleteSeries, deleteSeries, drawCoords, drawCoords, getBorders, getFunction, getFunctionString, getID, getIDFromSID, getLabelX, getLabelY, getMaxX, getMaxY, getMinX, getMinY, getOwner, getThing, getTitle, isAutoRefresh, isAutoscaleX, isAutoscaleY, isDrawGrid, isDrawZero, isEnableMouse, isSampleData, paintFunctions, paintOffScreen, paintOffScreen, pixFromX, pixFromY, plotRegression, repaint, run, setAddRepeatedDatum, setAutoRefresh, setAutoReplaceData, setAutoscaleX, setAutoscaleY, setBorders, setDrawGrid, setDrawZero, setEnableMouse, setFormat, setFunctionRange, setFunctionString, setFunctionVariable, setGutters, setLabelX, setLabelX, setLabelY, setLabelY, setLastPointMarker, setMarkerSize, setMarkerSize, setMinMaxX, setMinMaxY, setObjectColor, setOwner, setParentSApplet, setSampleData, setSeriesColor, setSeriesLegend, setSeriesLegend, setSeriesLegendColor, setSeriesStyle, setSeriesStyle, setShowAxes, setSquare, setTitle, sGraph_mouseEntered, sGraph_mouseExited, sGraph_mouseMoved, xFromPix, yFromPix
 
Methods inherited from class edu.davidson.graph.Graph2D
attachAxis, attachDataSet, createAxis, detachAxes, detachAxis, detachDataSet, detachDataSets, finishedloading, getDataBackground, getMarkers, getXmax, getXmin, getYmax, getYmin, isShowAxis, loadDataSet, loadFile, loadmessage, paint, paint, paintBeforeData, setDataBackground, setGraphBackground, setMarkers, setShowAxis, startedloading, update
 
Methods inherited from class java.awt.Canvas
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

noContours

public boolean noContours
Boolean value if true Contours will not be calculated
Constructor Detail

SContour

public SContour()
Instantaite the class
Method Detail

setRange

public void setRange(double xmin,
                     double xmax,
                     double ymin,
                     double ymax)
Set the range of the grid
Parameters:
xmin - Minimum X value
xmax - Maximum X value
ymin - Minimum Y value
ymax - Maximum Y value

setNoContours

public void setNoContours(boolean nc)
Do not draw contours
Parameters:
no - contours

getRange

public double[] getRange()
Return the range of the grid
Returns:
An array contining xmin,xmax,ymin,ymax.

getDim

public int[] getDim()
return the dimensions of the grid
Returns:
An array containing the number of columns, number of rows.

getGrid

public double[] getGrid()
Return the grid
Returns:
An array of size nx by ny contining the data grid.

setLevels

public void setLevels(double[] levels,
                      int nl)
Manually set the contour levels.
Parameters:
levels - An array containing the contour levels
nl - The number of contour levels in the arrray

setLabels

public void setLabels(edu.davidson.graph.TextLine[] labels,
                      int nl)
Manually set the Contour labels.
Parameters:
labels - An array containing the labels.
nl - Number of labels in the Array.

setLabelFont

public void setLabelFont(java.awt.Font f)
Set the font to be used with All the labels
Parameters:
f - Font

setLabelColor

public void setLabelColor(java.awt.Color c)
Set the Color to be used with all the labels.
Parameters:
c - Color

setGrid

public void setGrid(double[] grid,
                    int nx,
                    int ny)
Set the grid to be contoured.
Parameters:
grid - Array of values
nx - Number of columns
ny - Number of rows

setGrid

public void setGrid(double[][] newGrid)
Set the grid to be contoured.
Parameters:
grid - Array of double[][]

setGrid

public void setGrid(double[][] newGrid,
                    double _xmin,
                    double _xmax,
                    double _ymin,
                    double _ymax)

deleteContours

public void deleteContours()
Delete all the Contours

detachContours

public void detachContours()
Detach contours so that they will not be plotted.

attachContours

public void attachContours()
Attach contours so that they will be plotted.

setContourColor

public void setContourColor(java.awt.Color c)
Set the contour's color.
Parameters:
c - Color

setLabelledContourColor

public void setLabelledContourColor(java.awt.Color c)
Set the labelled contour's color.
Parameters:
c - Color

getLevels

public double[] getLevels()
Return the contour levels.
Returns:
An array containing the contour levels

setLimitsToGrid

public void setLimitsToGrid(boolean b)
If true the limits of the plot will be the grid limits. If false the limits of the plot will be the contours.
Parameters:
b - boolean

setLabelLevels

public void setLabelLevels(int i)
Set the contour levels that are to have labels.
    if 0 no labels are drawn
    if 1 every level gets a label
    If 2 every 2nd level gets a label
    etc.
 

setLogLevels

public void setLogLevels(boolean b)
If true contour levels are calculated on a log scale.
Parameters:
b - boolean

setNLevels

public void setNLevels(int l)
Set the number of contour levels.

setAutoLevels

public void setAutoLevels(boolean b)
If true contour levels are calculated automatically.
Parameters:
b - boolean

setDrawLabels

public void setDrawLabels(boolean b)
If true contour levels are not labeled.
Parameters:
b - boolean

setLabelStyle

public void setLabelStyle(int s)
Set the label style, either TextLine.SCIENTIFIC or TextLine.ALGEBRAIC.
Parameters:
s - Style

getLabelStyle

public int getLabelStyle()
Get the label style, either TextLine.SCIENTIFIC or TextLine.ALGEBRAIC.
Returns:
style

setLabelPrecision

public void setLabelPrecision(int p)
Set the label precision.
Parameters:
s - Precision

getLabelPrecision

public int getLabelPrecision()
Get the label precision.
Returns:
precision

setLabelSignificance

public void setLabelSignificance(int s)
Set the label significant figures.
Parameters:
s - number of significant figures

getLabelSignificance

public int getLabelSignificance()
Get the number of significant figures for labels.
Returns:
number of significant figures

paintFirst

public void paintFirst(java.awt.Graphics g,
                       java.awt.Rectangle r)
Overrides:
paintFirst in class edu.davidson.graph.Graph2D

paintLast

public void paintLast(java.awt.Graphics g,
                      java.awt.Rectangle rect)
Description copied from class: SGraph
A hook into the Graph2D.paint method. This is called before the data is drawn but after the axis in Graph2D. It is used to paint analytic functions in SGraph. The rectangle passed is the dimension of the data window.
Overrides:
paintLast in class SGraph

calculateCurve

public void calculateCurve(double aLevel)

deleteAllSeries

public void deleteAllSeries()
Description copied from class: SGraph
Delete all series from the graph.
Overrides:
deleteAllSeries in class SGraph

createSampleData

public void createSampleData()

jbInit

public void jbInit()
            throws java.lang.Exception

Copyright Wolfgang Christian

Visit the Davidson CollegeSTools Documentation Page