|
|||||||||
Home >> All >> edu >> stanford >> genetics >> treeview >> [ dendroview overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
edu.stanford.genetics.treeview.dendroview
Class ArrayDrawer

java.lang.Objectjava.util.Observable
edu.stanford.genetics.treeview.dendroview.ArrayDrawer
- All Implemented Interfaces:
- java.util.Observer
- Direct Known Subclasses:
- KnnArrayDrawer
- public class ArrayDrawer
- extends java.util.Observable
- implements java.util.Observer
- extends java.util.Observable
Class for Drawing A Colored Grid Representation of a Data Matrix. Each cell in the view corresponds to an element in the array. The color of the pixels is determined by the ColorExtractor, which is passed in the value to be converted.
The ArrayDrawer is Observable. It setsChanged() itself when the data array is changed, but you have to call notifyObservers() yourself. Notifications from the ColorExtractor, however, are immediately passed on to listeners.
Upon setting a data array, ArrayDrawer will set a reference to the data array, and may refer to it when it asked to draw things. Of course, it may form some kind of internal buffer- you're advised to call setData() if you change the data, and not to change the data unless you call setData() too.
The ArrayDrawer can draw on a Graphics object. It requires a source rectangle in units of array indexes, to determine which array values to render, and a destination rectangle to draw them to.
At some point, we many want to allow arrays of ints to specify source rows and columns to grab data from for non-contiguous views.
- Version:
- $Revision: 1.9 $ $Date: 2003/08/01 19:09:24 $
Field Summary | |
private boolean |
bufferValid
|
protected ColorExtractor |
colorExtractor
Used to convert data values into colors |
protected edu.stanford.genetics.treeview.DataMatrix |
dataMatrix
The array of data values to be rendered. |
protected double |
nodata
|
private edu.stanford.genetics.treeview.ConfigNode |
root
|
Fields inherited from class java.util.Observable |
|
Constructor Summary | |
ArrayDrawer()
Constructor does nothing but set defaults |
Method Summary | |
void |
bindConfig(edu.stanford.genetics.treeview.ConfigNode configNode)
binds this arraydrawer to a particular ConfigNode. |
java.awt.Color |
getColor(int x,
int y)
Get Color for a given array element |
ColorExtractor |
getColorExtractor()
Gets the colorExtractor attribute of the ArrayDrawer object |
double |
getValue(int x,
int y)
Get value for a given array element |
double |
noData()
returns the value which stands for nodata |
void |
paint(java.awt.Graphics g,
java.awt.Rectangle source,
java.awt.Rectangle dest,
int[] geneOrder)
Paint the view of the Pixels |
void |
paint(int[] pixels,
java.awt.Rectangle source,
java.awt.Rectangle dest,
int scanSize)
Paint the array values onto pixels. |
void |
paint(int[] pixels,
java.awt.Rectangle source,
java.awt.Rectangle dest,
int scanSize,
int[] geneOrder)
Paint the array values onto pixels. |
void |
paintPixel(java.awt.Graphics g,
MapContainer xmap,
MapContainer ymap,
int x,
int y,
int[] geneOrder)
Method to draw a single point (x,y) on grapics g using xmap and ymap |
void |
recalculateContrast()
sets contrast to 4 times the mean. |
void |
setColorExtractor(ColorExtractor colorExtractor)
Set ColorExtractor for future draws |
void |
setDataMatrix(edu.stanford.genetics.treeview.DataMatrix matrix)
Set the source of the data. |
private void |
setDefaults()
resets the ArrayDrawer to a default state. |
void |
update(java.util.Observable o,
java.lang.Object arg)
This drawer can only draw from a single, unchangng model This method may not be necessary. |
Methods inherited from class java.util.Observable |
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
colorExtractor
protected ColorExtractor colorExtractor
- Used to convert data values into colors
root
private edu.stanford.genetics.treeview.ConfigNode root
bufferValid
private boolean bufferValid
dataMatrix
protected edu.stanford.genetics.treeview.DataMatrix dataMatrix
- The array of data values to be rendered.
nodata
protected double nodata
Constructor Detail |
ArrayDrawer
public ArrayDrawer()
- Constructor does nothing but set defaults
Method Detail |
bindConfig
public void bindConfig(edu.stanford.genetics.treeview.ConfigNode configNode)
- binds this arraydrawer to a particular ConfigNode.
setColorExtractor
public void setColorExtractor(ColorExtractor colorExtractor)
- Set ColorExtractor for future draws
getColorExtractor
public ColorExtractor getColorExtractor()
- Gets the colorExtractor attribute of the ArrayDrawer object
setDataMatrix
public void setDataMatrix(edu.stanford.genetics.treeview.DataMatrix matrix)
- Set the source of the data.
recalculateContrast
public void recalculateContrast()
- sets contrast to 4 times the mean. Works well in practice.
paint
public void paint(java.awt.Graphics g, java.awt.Rectangle source, java.awt.Rectangle dest, int[] geneOrder)
- Paint the view of the Pixels
paint
public void paint(int[] pixels, java.awt.Rectangle source, java.awt.Rectangle dest, int scanSize)
- Paint the array values onto pixels. This method will do averaging if multiple
values map to the same pixel.
paint
public void paint(int[] pixels, java.awt.Rectangle source, java.awt.Rectangle dest, int scanSize, int[] geneOrder)
- Paint the array values onto pixels. This method will do averaging if multiple
values map to the same pixel.
paintPixel
public void paintPixel(java.awt.Graphics g, MapContainer xmap, MapContainer ymap, int x, int y, int[] geneOrder)
- Method to draw a single point (x,y) on grapics g using xmap and ymap
update
public void update(java.util.Observable o, java.lang.Object arg)
- This drawer can only draw from a single, unchangng model This method may not
be necessary. Neither may the observer/observable stuff.
- Specified by:
update
in interfacejava.util.Observer
getValue
public double getValue(int x, int y)
- Get value for a given array element
getColor
public java.awt.Color getColor(int x, int y)
- Get Color for a given array element
noData
public double noData()
- returns the value which stands for nodata
setDefaults
private void setDefaults()
- resets the ArrayDrawer to a default state.
|
|||||||||
Home >> All >> edu >> stanford >> genetics >> treeview >> [ dendroview overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |