visad
Class Contour2D

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by java.applet.Applet
                  extended by visad.Contour2D
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class Contour2D
extends java.applet.Applet
implements java.awt.event.MouseListener

Contour2D is a class equipped with a 2-D contouring function.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Nested classes/interfaces inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  int cols
           
protected  Contour2D con
           
protected  int[] num1
           
protected  int[] num2
           
protected  int[] num3
           
protected  int[] num4
           
protected  int rows
           
protected  int scale
           
protected  boolean showgrid
           
protected  float[][] vx1
           
protected  float[][] vx2
           
protected  float[][] vx3
           
protected  float[][] vx4
           
protected  float[][] vy1
           
protected  float[][] vy2
           
protected  float[][] vy3
           
protected  float[][] vy4
           
protected  int whichlabels
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Contour2D()
           
 
Method Summary
static void contour(float[] g, int nr, int nc, float[] values, float lowlimit, float highlimit, float base, boolean dash, float[][] vx1, float[][] vy1, int maxv1, int[] numv1, float[][] vx2, float[][] vy2, int maxv2, int[] numv2, float[][] vx3, float[][] vy3, int maxv3, int[] numv3, float[][] vx4, float[][] vy4, int maxv4, int[] numv4, byte[][] auxValues, byte[][] auxLevels1, byte[][] auxLevels2, byte[][] auxLevels3, boolean[] swap, boolean fill, float[][] tri, byte[][] tri_color, float[][][] grd_normals, float[][] tri_normals, byte[][] interval_colors)
          Compute contour lines for a 2-D array.
static void contour(float[] g, int nr, int nc, float interval, float lowlimit, float highlimit, float base, float[][] vx1, float[][] vy1, int maxv1, int[] numv1, float[][] vx2, float[][] vy2, int maxv2, int[] numv2, float[][] vx3, float[][] vy3, int maxv3, int[] numv3, float[][] vx4, float[][] vy4, int maxv4, int[] numv4, byte[][] auxValues, byte[][] auxLevels1, byte[][] auxLevels2, byte[][] auxLevels3, boolean[] swap, boolean fill, float[][] tri, byte[][] tri_color, float[][][] grd_normals, float[][] tri_normals, byte[][] interval_colors)
          Compute contour lines for a 2-D array.
static void fillGridBox(float[] corners, int numc, float[] vx, float[] vy, float xx, float yy, float xd, float yd, int nc, int nr, short ctrLow, float[][] tri, int[] t_idx, byte[][] tri_color, int numv, byte[] o_flags, float[] values, byte[][] color_bin, float[][][] grd_normals, int[] n_idx, float[][] tri_normals_a)
           
static void fillGridBox(float[] g, short[][] n_lines, float[] vx, float[] vy, float xd, float xdd, float yd, float ydd, int nr, int nrm, int nc, int ncm, short[][] ctrLow, float[][] tri, byte[][] tri_color, byte[][][] o_flags, float[] values, byte[][] color_bin, float[][][] grd_normals, float[][] tri_normals)
           
 void init()
           
static float[] intervalToLevels(float interval, float low, float high, float ba, boolean[] dash)
          Returns an array of contour values and an indication on whether to use dashed lines below the base value.
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void paint(java.awt.Graphics gr)
           
 
Methods inherited from class java.applet.Applet
destroy, getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

con

protected Contour2D con

whichlabels

protected int whichlabels

showgrid

protected boolean showgrid

rows

protected int rows

cols

protected int cols

scale

protected int scale

num1

protected int[] num1

num2

protected int[] num2

num3

protected int[] num3

num4

protected int[] num4

vx1

protected float[][] vx1

vy1

protected float[][] vy1

vx2

protected float[][] vx2

vy2

protected float[][] vy2

vx3

protected float[][] vx3

vy3

protected float[][] vy3

vx4

protected float[][] vx4

vy4

protected float[][] vy4
Constructor Detail

Contour2D

public Contour2D()
Method Detail

contour

public static void contour(float[] g,
                           int nr,
                           int nc,
                           float interval,
                           float lowlimit,
                           float highlimit,
                           float base,
                           float[][] vx1,
                           float[][] vy1,
                           int maxv1,
                           int[] numv1,
                           float[][] vx2,
                           float[][] vy2,
                           int maxv2,
                           int[] numv2,
                           float[][] vx3,
                           float[][] vy3,
                           int maxv3,
                           int[] numv3,
                           float[][] vx4,
                           float[][] vy4,
                           int maxv4,
                           int[] numv4,
                           byte[][] auxValues,
                           byte[][] auxLevels1,
                           byte[][] auxLevels2,
                           byte[][] auxLevels3,
                           boolean[] swap,
                           boolean fill,
                           float[][] tri,
                           byte[][] tri_color,
                           float[][][] grd_normals,
                           float[][] tri_normals,
                           byte[][] interval_colors)
                    throws VisADException
Compute contour lines for a 2-D array. If the interval is negative, then contour lines less than base will be drawn as dashed lines. The contour lines will be computed for all V such that:
lowlimit <= V <= highlimit
and V = base + n*interval for some integer n
Note that the input array, g, should be in column-major (FORTRAN) order.

Parameters:
g - the 2-D array to contour.
nr - size of 2-D array in rows
nc - size of 2-D array in columns.
interval - contour interval
lowlimit - the lower limit on values to contour.
highlimit - the upper limit on values to contour.
base - base value to start contouring at.
vx1 - array to put contour line vertices (x value)
vy1 - array to put contour line vertices (y value)
maxv1 - size of vx1, vy1 arrays
numv1 - pointer to int to return number of vertices in vx1,vy1
vx2 - array to put 'hidden' contour line vertices (x value)
vy2 - array to put 'hidden' contour line vertices (y value)
maxv2 - size of vx2, vy2 arrays
numv2 - pointer to int to return number of vertices in vx2,vy2
vx3 - array to put contour label vertices (x value)
vy3 - array to put contour label vertices (y value)
maxv3 - size of vx3, vy3 arrays
numv3 - pointer to int to return number of vertices in vx3,vy3
vx4 - array to put contour label vertices, inverted (x value)
vy4 - array to put contour label vertices, inverted (y value)
** see note for VxB and VyB in PlotDigits.java **
maxv4 - size of vx4, vy4 arrays
numv4 - pointer to int to return number of vertices in vx4,vy4
Throws:
VisADException

intervalToLevels

public static float[] intervalToLevels(float interval,
                                       float low,
                                       float high,
                                       float ba,
                                       boolean[] dash)
                                throws VisADException
Returns an array of contour values and an indication on whether to use dashed lines below the base value.

Parameters:
interval - The contouring interval. Must be non-zero. If the interval is negative, then contour lines less than the base will be drawn as dashed lines. Must not be NaN.
low - The minimum contour value. The returned array will not contain a value below this. Must not be NaN.
high - The maximum contour value. The returned array will not contain a value above this. Must not be NaN.
ba - The base contour value. The returned values will be integer multiples of the interval away from this this value. Must not be NaN.
dash - Whether or not contour lines less than the base should be drawn as dashed lines. This is a computed and returned value.
Throws:
VisADException - The contour interval is zero or too small.

contour

public static void contour(float[] g,
                           int nr,
                           int nc,
                           float[] values,
                           float lowlimit,
                           float highlimit,
                           float base,
                           boolean dash,
                           float[][] vx1,
                           float[][] vy1,
                           int maxv1,
                           int[] numv1,
                           float[][] vx2,
                           float[][] vy2,
                           int maxv2,
                           int[] numv2,
                           float[][] vx3,
                           float[][] vy3,
                           int maxv3,
                           int[] numv3,
                           float[][] vx4,
                           float[][] vy4,
                           int maxv4,
                           int[] numv4,
                           byte[][] auxValues,
                           byte[][] auxLevels1,
                           byte[][] auxLevels2,
                           byte[][] auxLevels3,
                           boolean[] swap,
                           boolean fill,
                           float[][] tri,
                           byte[][] tri_color,
                           float[][][] grd_normals,
                           float[][] tri_normals,
                           byte[][] interval_colors)
                    throws VisADException
Compute contour lines for a 2-D array. If the interval is negative, then contour lines less than base will be drawn as dashed lines. The contour lines will be computed for all V such that:
lowlimit <= V <= highlimit
and V = base + n*interval for some integer n
Note that the input array, g, should be in column-major (FORTRAN) order.

Parameters:
g - the 2-D array to contour.
nr - size of 2-D array in rows
nc - size of 2-D array in columns.
values - the values to be plotted
lowlimit - the lower limit on values to contour.
highlimit - the upper limit on values to contour.
base - base value to start contouring at.
dash - boolean to dash contours below base or not
vx1 - array to put contour line vertices (x value)
vy1 - array to put contour line vertices (y value)
maxv1 - size of vx1, vy1 arrays
numv1 - pointer to int to return number of vertices in vx1,vy1
vx2 - array to put 'hidden' contour line vertices (x value)
vy2 - array to put 'hidden' contour line vertices (y value)
maxv2 - size of vx2, vy2 arrays
numv2 - pointer to int to return number of vertices in vx2,vy2
vx3 - array to put contour label vertices (x value)
vy3 - array to put contour label vertices (y value)
maxv3 - size of vx3, vy3 arrays
numv3 - pointer to int to return number of vertices in vx3,vy3
vx4 - array to put contour label vertices, inverted (x value)
vy4 - array to put contour label vertices, inverted (y value)
** see note for VxB and VyB in PlotDigits.java **
maxv4 - size of vx4, vy4 arrays
numv4 - pointer to int to return number of vertices in vx4,vy4
Throws:
VisADException

fillGridBox

public static void fillGridBox(float[] g,
                               short[][] n_lines,
                               float[] vx,
                               float[] vy,
                               float xd,
                               float xdd,
                               float yd,
                               float ydd,
                               int nr,
                               int nrm,
                               int nc,
                               int ncm,
                               short[][] ctrLow,
                               float[][] tri,
                               byte[][] tri_color,
                               byte[][][] o_flags,
                               float[] values,
                               byte[][] color_bin,
                               float[][][] grd_normals,
                               float[][] tri_normals)

fillGridBox

public static void fillGridBox(float[] corners,
                               int numc,
                               float[] vx,
                               float[] vy,
                               float xx,
                               float yy,
                               float xd,
                               float yd,
                               int nc,
                               int nr,
                               short ctrLow,
                               float[][] tri,
                               int[] t_idx,
                               byte[][] tri_color,
                               int numv,
                               byte[] o_flags,
                               float[] values,
                               byte[][] color_bin,
                               float[][][] grd_normals,
                               int[] n_idx,
                               float[][] tri_normals_a)

init

public void init()
Overrides:
init in class java.applet.Applet

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

paint

public void paint(java.awt.Graphics gr)
Overrides:
paint in class java.awt.Container