org.opensourcephysics.display2d
Class IntegerRaster

java.lang.Object
  extended by org.opensourcephysics.display.MeasuredImage
      extended by org.opensourcephysics.display2d.IntegerRaster
All Implemented Interfaces:
Dimensioned, Drawable, Measurable

public class IntegerRaster
extends MeasuredImage
implements Dimensioned

A IntegerRaster contains an array of integers where each integer representents an image pixel. Because the image created by a IntegerRaster cannot be resized, the image dimensions are the same as the dimensions of the integer array.

Version:
1.0
Author:
Wolfgang Christian

Field Summary
protected  double scaleFactor
           
static int WHITE
           
 
Fields inherited from class org.opensourcephysics.display.MeasuredImage
image, xmax, xmin, ymax, ymin
 
Constructor Summary
IntegerRaster(int _nrow, int _ncol)
          Constructs IntegerRaster with the given size.
 
Method Summary
 void draw(DrawingPanel panel, java.awt.Graphics g)
          Draws the image and the grid.
 int getCell(int _row, int _col)
          Gets a lattice cell value.
 java.awt.Dimension getInterior(DrawingPanel panel)
          Gets the dimension of the lattice in pixel units.
 void setBlock(int row_offset, int col_offset, int[][] val)
          Sets a block of lattice cells to new values.
 void setCell(int _row, int _col, int val)
          Sets a lattice cell to a new value.
 void setCol(int row_offset, int col, int[] val)
          Sets a column of lattice cells to new values.
 void setRow(int row, int col_offset, int[] val)
          Sets a row of lattice cells to new values.
 
Methods inherited from class org.opensourcephysics.display.MeasuredImage
getXMax, getXMin, getYMax, getYMin, isMeasured, setImage, setMinMax, setVisible, setXMax, setXMin, setYMax, setYMin
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WHITE

public static int WHITE

scaleFactor

protected double scaleFactor
Constructor Detail

IntegerRaster

public IntegerRaster(int _nrow,
                     int _ncol)
Constructs IntegerRaster with the given size.

Parameters:
_nrow - the number of rows
_ncol - the number of columns
Method Detail

setBlock

public void setBlock(int row_offset,
                     int col_offset,
                     int[][] val)
Sets a block of lattice cells to new values.

Parameters:
row_offset -
col_offset -
val -

setRow

public void setRow(int row,
                   int col_offset,
                   int[] val)
Sets a row of lattice cells to new values.

Parameters:
row -
col_offset -
val -

setCol

public void setCol(int row_offset,
                   int col,
                   int[] val)
Sets a column of lattice cells to new values.

Parameters:
row_offset -
col -
val -

setCell

public void setCell(int _row,
                    int _col,
                    int val)
Sets a lattice cell to a new value.


getCell

public int getCell(int _row,
                   int _col)
Gets a lattice cell value.

Returns:
the cell value.

getInterior

public java.awt.Dimension getInterior(DrawingPanel panel)
Gets the dimension of the lattice in pixel units.

Specified by:
getInterior in interface Dimensioned
Parameters:
panel -
Returns:
the dimension

draw

public void draw(DrawingPanel panel,
                 java.awt.Graphics g)
Draws the image and the grid.

Specified by:
draw in interface Drawable
Overrides:
draw in class MeasuredImage
Parameters:
panel -
g -