Class graph.Contour
All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class graph.Contour
java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----graph.Graph2D
                           |
                           +----graph.G2Dint
                                   |
                                   +----graph.Contour
  -  public class Contour
  -  extends G2Dint
This class extends the interactive graphics class G2Dint to incorporate
contouring.
  -  Version:
  
-  1.11, 1996/08/12 23:37:08.
  
-  Author:
  
-  Leigh Brookshaw
   
  -   autoLabels autoLabels
-    If true the labels will be calculated for each
  contour level.
  
-   autoLevels autoLevels
-    If set the class calculates the contour levels based on
  the data minimum and maximum.
  
-   contourColor contourColor
-   Color to draw non labelled contour line
  
-   curves curves
-    Vector array containing the Contour curves.
  
-   drawlabels drawlabels
-    If false labels are not drawn
  
-   grid grid
-    The data grid, a 2D array stored in linear form.
  
-   gridLimits gridLimits
-  
  
-   labelcolor labelcolor
-    Color to use in drawing Labels
  
-   labelfont labelfont
-    Font to use in drawing Labels
  
-   labelledColor labelledColor
-   Color to draw labelled contour line
  
-   labelLevels labelLevels
-    Which levels will get labels.
  
-   labelPrecision labelPrecision
-    Precision to use in drawing Labels.
  
-   labels labels
-    The label for each contour level
  
-   labelSignificant labelSignificant
-    Number of Significant figures to use in drawing Labels.
  
-   labelStyle labelStyle
-    Style to use in drawing Labels.
  
-   levels levels
-  
  
-   logLevels logLevels
-  
  
-   noContours noContours
-  Boolean value if true Contours will not be calculated
  
-   nx nx
-    Dimension of the contour grid in the X direction
  
-   ny ny
-    Dimension of the contour grid in the Y direction
  
-   xmax xmax
-    The X maximum limit of the data grid
  
-   xmin xmin
-    The X minimum limit of the data grid
  
-   ymax ymax
-    The Y maximum limit of the data grid
  
-   ymin ymin
-    The Y minimum limit of the data grid
  
-   zmax zmax
-    The maximum value of the grid values
  
-   zmin zmin
-    The minimum value of the grid values
   
  -   Contour() Contour()
-  Instantaite the class
   
  -   attachContours() attachContours()
-  Attach contours so that they will be plotted.
  
-   calculateCurves() calculateCurves()
-  
  
-   deleteContours() deleteContours()
-  Delete all the Contours
  
-   detachContours() detachContours()
-  Detach contours so that they will not be plotted.
  
-   getDim() getDim()
-   return the dimensions of the grid
  
-   getGrid() getGrid()
-   Return the grid
  
-   getLabelPrecision() getLabelPrecision()
-  Get the label precision.
  
-   getLabelSignificance() getLabelSignificance()
-  Get the number of significant figures for labels.
  
-   getLabelStyle() getLabelStyle()
-  Get the label style, either TextLine.SCIENTIFIC or
TextLine.ALGEBRAIC.
  
-   getLevels() getLevels()
-  Return the contour levels.
  
-   getRange() getRange()
-   Return the range of the grid
  
-   keyDown(Event, int) keyDown(Event, int)
-    Add extra events to the G2Dint event handler.
  
-   loadGrid(URL) loadGrid(URL)
-   Load the grid to contour from a URL.
  
-   paintFirst(Graphics, Rectangle) paintFirst(Graphics, Rectangle)
-   A hook into the Graph2D.paint method.
  
-   paintLast(Graphics, Rectangle) paintLast(Graphics, Rectangle)
-   A hook into the Graph2D.paint method.
  
-   setAutoLevels(boolean) setAutoLevels(boolean)
-  If true contour levels are calculated automatically.
  
-   setContourColor(Color) setContourColor(Color)
-  Set the contour's color.
  
-   setDrawLabels(boolean) setDrawLabels(boolean)
-  If true contour levels are not labeled.
  
-   setGrid(double[], int, int) setGrid(double[], int, int)
-   Set the grid to be contoured.
  
-   setLabelColor(Color) setLabelColor(Color)
-  Set the Color to be used with all the labels.
  
-   setLabelFont(Font) setLabelFont(Font)
-  Set the font to be used with All the labels
  
-   setLabelledContourColor(Color) setLabelledContourColor(Color)
-  Set the labelled contour's color.
  
-   setLabelLevels(int) setLabelLevels(int)
-   Set the contour levels that are to have labels.
  
-   setLabelPrecision(int) setLabelPrecision(int)
-  Set the label precision.
  
-   setLabels(TextLine[], int) setLabels(TextLine[], int)
-  Manually set the Contour labels.
  
-   setLabelSignificance(int) setLabelSignificance(int)
-  Set the label significant figures.
  
-   setLabelStyle(int) setLabelStyle(int)
-  Set the label style, either TextLine.SCIENTIFIC or
TextLine.ALGEBRAIC.
  
-   setLevels(double[], int) setLevels(double[], int)
-  Manually set the contour levels.
  
-   setLimitsToGrid(boolean) setLimitsToGrid(boolean)
-  If true the limits of the plot will be the grid limits.
  
-   setLogLevels(boolean) setLogLevels(boolean)
-  If true contour levels are calculated on a log scale.
  
-   setNLevels(int) setNLevels(int)
-  Set the number of contour levels.
  
-   setRange(double, double, double, double) setRange(double, double, double, double)
-   Set the range of the grid
   
 nx
nx
  protected int nx
  -  Dimension of the contour grid in the X direction
 ny
ny
  protected int ny
  -  Dimension of the contour grid in the Y direction
 curves
curves
  protected Vector curves[]
  -  Vector array containing the Contour curves.
  Each index in the array contains curves at a given
  contour level
 autoLevels
autoLevels
  protected boolean autoLevels
  -  If set the class calculates the contour levels based on
  the data minimum and maximum. Default value true.
 logLevels
logLevels
  protected boolean logLevels
 gridLimits
gridLimits
  protected boolean gridLimits
 levels
levels
  protected double levels[]
 labels
labels
  protected TextLine labels[]
  -  The label for each contour level
 labelfont
labelfont
  protected Font labelfont
  -  Font to use in drawing Labels
 labelcolor
labelcolor
  protected Color labelcolor
  -  Color to use in drawing Labels
 labelStyle
labelStyle
  protected int labelStyle
  -  Style to use in drawing Labels. TextLine.SCIENTIFIC or
  TextLine.ALGEBRAIC.
 labelPrecision
labelPrecision
  protected int labelPrecision
  -  Precision to use in drawing Labels.
 labelSignificant
labelSignificant
  protected int labelSignificant
  -  Number of Significant figures to use in drawing Labels.
 labelLevels
labelLevels
  protected int labelLevels
  -  Which levels will get labels. If it is equal to 1 every level
  gets a label, equal to 2 every second level etc. If it is equal to 0
  no labels are displayed.
 drawlabels
drawlabels
  protected boolean drawlabels
  -  If false labels are not drawn
 autoLabels
autoLabels
  protected boolean autoLabels
  -  If true the labels will be calculated for each
  contour level. These might not look all that hot.
 contourColor
contourColor
  protected Color contourColor
  -  Color to draw non labelled contour line
 labelledColor
labelledColor
  protected Color labelledColor
  -  Color to draw labelled contour line
 grid
grid
  protected double grid[]
  -  The data grid, a 2D array stored in linear form.
  It is assumed that [0,0] is the bottom left corner
  and the data is ordered by row.
 xmin
xmin
  protected double xmin
  -  The X minimum limit of the data grid
 xmax
xmax
  protected double xmax
  -  The X maximum limit of the data grid
 ymin
ymin
  protected double ymin
  -  The Y minimum limit of the data grid
 ymax
ymax
  protected double ymax
  -  The Y maximum limit of the data grid
 zmin
zmin
  protected double zmin
  -  The minimum value of the grid values
 zmax
zmax
  protected double zmax
  -  The maximum value of the grid values
 noContours
noContours
  public boolean noContours
  -  Boolean value if true Contours will not be calculated
   
 Contour
Contour
  public Contour()
  -  Instantaite the class
   
 loadGrid
loadGrid
  public boolean loadGrid(URL file)
  -  Load the grid to contour from a URL. There are 2 formats for the data
 optionally the limits of the grid can be parsed.
 
 The expected format of the data 
          1st Number:   nx
          2nd Number:   ny
          nx*ny numbers following
 Optionally
          1st Number:   nx
          2nd Number:   ny
          3rd Number:   xmin
          4th Number:   xmax
          5th Number:   ymin
          6th Number:   ymax
          nx*ny numbers following
 
 If xmin, xmax, ymin, ymax are not specified they are assumed
 to be [1.0,nx,1.0,ny]
    -  Parameters:
    
-  file - URL of the file to load
    
-  Returns:
    
-  true of the load was successful.
  
 
 setRange
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
  
 
 getRange
getRange
  public double[] getRange()
  -  Return the range of the grid
  
    -  Returns:
    
-  An array contining xmin,xmax,ymin,ymax.
  
 
 getDim
getDim
  public int[] getDim()
  -  return the dimensions of the grid
  
    -  Returns:
    
-  An array containing the number of columns, number of rows.
  
 
 getGrid
getGrid
  public double[] getGrid()
  -  Return the grid
  
    -  Returns:
    
-  An array of size nx by ny contining the data grid.
  
 
 setLevels
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
setLabels
  public void setLabels(TextLine labels[],
                        int nl)
  -  Manually set the Contour labels.
  
    -  Parameters:
    
-  labels - An array containing the labels.
    -  nl - Number of labels in the Array.
  
 
 setLabelFont
setLabelFont
  public void setLabelFont(Font f)
  -  Set the font to be used with All the labels
  
    -  Parameters:
    
-  f - Font
  
 
 setLabelColor
setLabelColor
  public void setLabelColor(Color c)
  -  Set the Color to be used with all the labels.
  
    -  Parameters:
    
-  c - Color
  
 
 setGrid
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
  
 
 deleteContours
deleteContours
  public void deleteContours()
  -  Delete all the Contours
 detachContours
detachContours
  public void detachContours()
  -  Detach contours so that they will not be plotted.
 attachContours
attachContours
  public void attachContours()
  -  Attach contours so that they will be plotted.
 setContourColor
setContourColor
  public void setContourColor(Color c)
  -  Set the contour's color.
  
    -  Parameters:
    
-  c - Color
  
 
 setLabelledContourColor
setLabelledContourColor
  public void setLabelledContourColor(Color c)
  -  Set the labelled contour's color.
  
    -  Parameters:
    
-  c - Color
  
 
 getLevels
getLevels
  public double[] getLevels()
  -  Return the contour levels.
  
    -  Returns:
    
-  An array containing the contour levels
  
 
 setLimitsToGrid
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
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
setLogLevels
  public void setLogLevels(boolean b)
  -  If true contour levels are calculated on a log scale.
  
    -  Parameters:
    
-  b - boolean
  
 
 setNLevels
setNLevels
  public void setNLevels(int l)
  -  Set the number of contour levels.
 setAutoLevels
setAutoLevels
  public void setAutoLevels(boolean b)
  -  If true contour levels are calculated automatically.
  
    -  Parameters:
    
-  b - boolean
  
 
 setDrawLabels
setDrawLabels
  public void setDrawLabels(boolean b)
  -  If true contour levels are not labeled.
  
    -  Parameters:
    
-  b - boolean
  
 
 setLabelStyle
setLabelStyle
  public void setLabelStyle(int s)
  -  Set the label style, either TextLine.SCIENTIFIC or
TextLine.ALGEBRAIC.
  
    -  Parameters:
    
-  s - Style
  
 
 getLabelStyle
getLabelStyle
  public int getLabelStyle()
  -  Get the label style, either TextLine.SCIENTIFIC or
TextLine.ALGEBRAIC.
  
    -  Returns:
    
-  style
  
 
 setLabelPrecision
setLabelPrecision
  public void setLabelPrecision(int p)
  -  Set the label precision.
  
    -  Parameters:
    
-  s - Precision
  
 
 getLabelPrecision
getLabelPrecision
  public int getLabelPrecision()
  -  Get the label precision.
  
    -  Returns:
    
-  precision
  
 
 setLabelSignificance
setLabelSignificance
  public void setLabelSignificance(int s)
  -  Set the label significant figures.
  
    -  Parameters:
    
-  s - number of significant figures
  
 
 getLabelSignificance
getLabelSignificance
  public int getLabelSignificance()
  -  Get the number of significant figures for labels.
  
    -  Returns:
    
-  number of significant figures
  
 
 keyDown
keyDown
  public boolean keyDown(Event e,
                         int key)
  -  Add extra events to the G2Dint event handler.
  If 'l' is pressed repaint without the labels
  If 'L' is pressed repaint with the labels.
  
    -  Overrides:
    
-  keyDown in class G2Dint
  
 
 paintFirst
paintFirst
  public void paintFirst(Graphics g,
                         Rectangle r)
  -  A hook into the Graph2D.paint method.
  
    -  Overrides:
    
-  paintFirst in class Graph2D
  
 
 paintLast
paintLast
  public void paintLast(Graphics g,
                        Rectangle rect)
  -  A hook into the Graph2D.paint method.
  
    -  Overrides:
    
-  paintLast in class Graph2D
  
 
 calculateCurves
calculateCurves
  protected void calculateCurves()
All Packages  Class Hierarchy  This Package  Previous  Next  Index