|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opensourcephysics.display.Grid org.opensourcephysics.display2d.SiteLattice
public class SiteLattice
A SiteLattice displays an array where each array element can assume one of 256 values. Array values are drawn as non-overlapping circles. 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.
Field Summary |
---|
Fields inherited from class org.opensourcephysics.display.Grid |
---|
color, dx, dy, generalPath, nx, ny, xmax, xmin, ymax, ymin |
Constructor Summary | |
---|---|
SiteLattice(int sx,
int sy)
Constructs a Site lattice with the given size. |
Method Summary | |
---|---|
ByteLattice |
createCellLattice()
Creates a new CellLattice containing the same data as this lattice. |
void |
createDefaultColors()
Creates the default palette. |
void |
draw(DrawingPanel panel,
java.awt.Graphics g)
Draws the lattice and the grid. |
int |
getNx()
Gets the number of x entries. |
int |
getNy()
Gets the number of y entries. |
byte |
getValue(int col,
int row)
Gets a lattice site value. |
double |
getXMax()
Method getXMax |
double |
getXMin()
Method getXMin |
double |
getYMax()
Method getYMax |
double |
getYMin()
Method getYMin |
int |
indexFromPoint(double x,
double y)
Determines the lattice index (row-major order) from given x and y world coordinates Returns -1 if the world coordinates are outside the lattice. |
boolean |
isMeasured()
Method isMeasured |
void |
randomize()
Randomizes the lattice values. |
void |
resizeLattice(int _nx,
int _ny)
Resizes the lattice. |
void |
setAll(byte[][] val)
Sets a block of data to new values. |
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 cells to new values. |
void |
setBlock(int ix_offset,
int iy_offset,
byte[][] val)
Sets a block of cells using byte 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 _color)
Sets the grid line color. |
void |
setIndexedColor(int i,
java.awt.Color color)
Sets the color for a single index. |
void |
setRow(int iy,
int ix_offset,
byte[] val)
Sets a row to new values. |
void |
setShowGridLines(boolean showGridLines)
Sets the visibility of the grid connecting the sites. |
void |
setShowVisible(boolean isVisible)
Sets the visibility of the sites. |
void |
setValue(int ix,
int iy,
byte val)
Sets the given x,y location to a new value. |
void |
setVisible(boolean isVisible)
Sets the visibility of the lattice. |
void |
setXMax(double _value)
Sets xmax. |
void |
setXMin(double _value)
Sets xmin. |
void |
setYMax(double _value)
Sets ymax. |
void |
setYMin(double _value)
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 org.opensourcephysics.display.Grid |
---|
getCellPoint, getClosestGridPoint, getColor, getDx, getDy, isVisible, setColor, setMinMax |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.opensourcephysics.display2d.ByteLattice |
---|
setMinMax |
Constructor Detail |
---|
public SiteLattice(int sx, int sy)
sx
- sites in x dirctionsy
- sites in y directionMethod Detail |
---|
public void resizeLattice(int _nx, int _ny)
ByteLattice
resizeLattice
in interface ByteLattice
public ByteLattice createCellLattice()
public int getNx()
getNx
in interface ByteLattice
public int getNy()
getNy
in interface ByteLattice
public void setVisible(boolean isVisible)
setVisible
in interface ByteLattice
setVisible
in class Grid
isVisible
- public void draw(DrawingPanel panel, java.awt.Graphics g)
draw
in interface Drawable
draw
in class Grid
panel
- g
- public void setAll(byte[][] val)
val
- public void setAll(byte[][] val, double xmin, double xmax, double ymin, double ymax)
setAll
in interface ByteLattice
val
- int[][] the new valuesxmin
- doublexmax
- doubleymin
- doubleymax
- doublepublic void setBlock(int ix_offset, int iy_offset, byte[][] val)
setBlock
in interface ByteLattice
ix_offset
- intiy_offset
- intval
- byte[][]public void setBlock(int ix_offset, int iy_offset, int[][] val)
ix_offset
- intiy_offset
- intval
- int[][]public void setBlock(byte[][] val)
setBlock
in interface ByteLattice
val
- public void setCol(int ix, int iy_offset, byte[] val)
setCol
in interface ByteLattice
ix
- the x index of the columniy_offset
- the y offset in the columnval
- values in columnpublic void setRow(int iy, int ix_offset, byte[] val)
setRow
in interface ByteLattice
iy
- the y index of the rowix_offset
- the x offset in the rowval
- public void setValue(int ix, int iy, byte val)
setValue
in interface ByteLattice
ix
- iy
- val
- public byte getValue(int col, int row)
getValue
in interface ByteLattice
row
- col
-
public int indexFromPoint(double x, double y)
indexFromPoint
in interface ByteLattice
x
- y
-
public int xToIndex(double x)
xToIndex
in interface ByteLattice
x
- double the coordinate
public int yToIndex(double y)
yToIndex
in interface ByteLattice
y
- double the coordinate
public void setShowVisible(boolean isVisible)
isVisible
- public void setShowGridLines(boolean showGridLines)
setShowGridLines
in interface ByteLattice
showGridLines
- public void randomize()
randomize
in interface ByteLattice
public javax.swing.JFrame showLegend()
showLegend
in interface ByteLattice
public void setColorPalette(java.awt.Color[] _colors)
setColorPalette
in interface ByteLattice
_colors
- public void setGridLineColor(java.awt.Color _color)
setGridLineColor
in interface ByteLattice
_color
- public void setIndexedColor(int i, java.awt.Color color)
setIndexedColor
in interface ByteLattice
i
- color
- public boolean isMeasured()
isMeasured
in interface Measurable
public double getXMin()
getXMin
in interface Measurable
getXMin
in class Grid
public double getXMax()
getXMax
in interface Measurable
getXMax
in class Grid
public double getYMin()
getYMin
in interface Measurable
getYMin
in class Grid
public double getYMax()
getYMax
in interface Measurable
getYMax
in class Grid
public void setXMin(double _value)
ByteLattice
setXMin
in interface ByteLattice
_value
- doublepublic void setXMax(double _value)
ByteLattice
setXMax
in interface ByteLattice
_value
- doublepublic void setYMin(double _value)
ByteLattice
setYMin
in interface ByteLattice
_value
- doublepublic void setYMax(double _value)
ByteLattice
setYMax
in interface ByteLattice
_value
- doublepublic void createDefaultColors()
createDefaultColors
in interface ByteLattice
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |