|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opensourcephysics.display2d.CellLattice
public class CellLattice
A CellLattice that displays an array where each array element can assume one of 256 values. Values can be set between -128 and 127. Because byte values larger than 127 overflow to negative, values can also be set between 0 and 255. The lattice is drawn as an array of rectangles to distinguish between the two possible values.
| Constructor Summary | |
|---|---|
CellLattice()
Constructor CellLattice |
|
CellLattice(int nx,
int ny)
Constructor CellLattice |
|
| Method Summary | |
|---|---|
void |
createDefaultColors()
Creates the default palette. |
SiteLattice |
createSiteLattice()
Creates a new SiteLattice containing the same data as this lattice. |
void |
draw(DrawingPanel panel,
java.awt.Graphics g)
Draws a representation of an object in a drawing panel. |
int |
getNx()
Gets the number of x entries. |
int |
getNy()
Gets the number of y entries. |
byte |
getValue(int ix,
int iy)
Gets a value from the given location. |
double |
getXMax()
Gets the maximum x needed to draw this object. |
double |
getXMin()
Gets the minimum x needed to draw this object. |
double |
getYMax()
Gets the maximum y needed to draw this object. |
double |
getYMin()
Gets the minimum y needed to draw this object. |
int |
indexFromPoint(double x,
double y)
Determines the lattice index (row-major order) from given x and y world coordinates. |
boolean |
isMeasured()
Determines if information is available to set min/max values. |
void |
randomize()
Randomizes the values. |
void |
resizeLattice(int nx,
int ny)
Resizes the lattice. |
void |
setAll(byte[][] val,
double xmin,
double xmax,
double ymin,
double ymax)
Sets the lattice values and scale. |
void |
setBlock(byte[][] val)
Sets a block of data starting at (0,0) to new values. |
void |
setBlock(int ix_offset,
int iy_offset,
byte[][] val)
Sets a block of data to new values. |
void |
setBlock(int ix_offset,
int iy_offset,
int[][] val)
Sets a block of cells using integer values. |
void |
setCol(int ix,
int iy_offset,
byte[] val)
Sets a column to new values. |
void |
setColorPalette(java.awt.Color[] colors)
Sets the color palette. |
void |
setGridLineColor(java.awt.Color c)
Sets the color for grid line boundaries |
void |
setIndexedColor(int i,
java.awt.Color color)
Sets the color for a single index. |
void |
setMinMax(double xmin,
double xmax,
double ymin,
double ymax)
Assigns a scale to the lattice in world units. |
void |
setRow(int iy,
int ix_offset,
byte[] val)
Sets a row to new values. |
void |
setShowGridLines(boolean show)
Outlines the lattice boundaries with a grid. |
void |
setValue(int ix,
int iy,
byte val)
Sets the given x,y location to a value. |
void |
setVisible(boolean isVisible)
Sets the visibility of the lattice. |
void |
setXMax(double xmax)
Sets xmax. |
void |
setXMin(double xmin)
Sets xmin. |
void |
setYMax(double ymax)
Sets ymax. |
void |
setYMin(double ymin)
Sets ymin. |
javax.swing.JFrame |
showLegend()
Shows the color associated with each value. |
int |
xToIndex(double x)
Gets closest index from the given x world coordinate. |
int |
yToIndex(double y)
Gets closest index from the given y world coordinate. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CellLattice()
public CellLattice(int nx,
int ny)
nx - ny - | Method Detail |
|---|
public double getXMin()
Measurable
getXMin in interface Measurablepublic double getXMax()
Measurable
getXMax in interface Measurablepublic double getYMin()
Measurable
getYMin in interface Measurablepublic double getYMax()
Measurable
getYMax in interface Measurablepublic boolean isMeasured()
Measurable
isMeasured in interface Measurable
public void draw(DrawingPanel panel,
java.awt.Graphics g)
Drawable
draw in interface Drawablepublic int getNx()
ByteLattice
getNx in interface ByteLatticepublic int getNy()
ByteLattice
getNy in interface ByteLattice
public int indexFromPoint(double x,
double y)
ByteLattice
indexFromPoint in interface ByteLatticepublic int xToIndex(double x)
ByteLattice
xToIndex in interface ByteLatticex - double the coordinate
public int yToIndex(double y)
ByteLattice
yToIndex in interface ByteLatticey - double the coordinate
public byte getValue(int ix,
int iy)
ByteLattice
getValue in interface ByteLattice
public void setValue(int ix,
int iy,
byte val)
ByteLattice
setValue in interface ByteLatticepublic void randomize()
ByteLattice
randomize in interface ByteLattice
public void resizeLattice(int nx,
int ny)
ByteLattice
resizeLattice in interface ByteLattice
public void setAll(byte[][] val,
double xmin,
double xmax,
double ymin,
double ymax)
setAll in interface ByteLatticeval - int[][] the new valuesxmin - doublexmax - doubleymin - doubleymax - double
public void setBlock(int ix_offset,
int iy_offset,
byte[][] val)
ByteLattice
setBlock in interface ByteLatticeix_offset - the x offset into the latticeiy_offset - the y offset into the latticepublic void setBlock(byte[][] val)
ByteLattice
setBlock in interface ByteLattice
public void setCol(int ix,
int iy_offset,
byte[] val)
ByteLattice
setCol in interface ByteLatticeix - the x index of the columniy_offset - the y offset in the columnval - values in column
public void setRow(int iy,
int ix_offset,
byte[] val)
ByteLattice
setRow in interface ByteLatticeiy - the y index of the rowix_offset - the x offset in the rowpublic void setShowGridLines(boolean show)
ByteLattice
setShowGridLines in interface ByteLatticepublic void setGridLineColor(java.awt.Color c)
ByteLattice
setGridLineColor in interface ByteLatticepublic javax.swing.JFrame showLegend()
ByteLattice
showLegend in interface ByteLatticepublic void setVisible(boolean isVisible)
ByteLattice
setVisible in interface ByteLatticepublic void setColorPalette(java.awt.Color[] colors)
ByteLattice
setColorPalette in interface ByteLattice
public void setIndexedColor(int i,
java.awt.Color color)
ByteLattice
setIndexedColor in interface ByteLattice
public void setMinMax(double xmin,
double xmax,
double ymin,
double ymax)
ByteLattice
setMinMax in interface ByteLatticepublic SiteLattice createSiteLattice()
public void setBlock(int ix_offset,
int iy_offset,
int[][] val)
ix_offset - intiy_offset - intval - int[][]public void setXMin(double xmin)
ByteLattice
setXMin in interface ByteLatticexmin - doublepublic void setXMax(double xmax)
ByteLattice
setXMax in interface ByteLatticexmax - doublepublic void setYMin(double ymin)
ByteLattice
setYMin in interface ByteLatticeymin - doublepublic void setYMax(double ymax)
ByteLattice
setYMax in interface ByteLatticeymax - doublepublic void createDefaultColors()
ByteLattice
createDefaultColors in interface ByteLattice
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||