|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Canvas | +--Draw2Dplot
This is a base class used for drawing 2D graphics plots. It contains code to draw axes, titles, captions, scale the data, overlay graphics, point event handlers, etc. In particular DrawScatterPlot, ExprProfileOverlay extend this class.
This work was produced by Peter Lemkin of the National Cancer Institute, an agency of the United States Government. As a work of the United States Government there is no associated copyright. It is offered as open source software under the Mozilla Public License (version 1.1) subject to the limitations noted in the accompanying LEGAL file. This notice must be included with the code. The MAExplorer Mozilla and Legal files are available on http://maexplorer.sourceforge.net/.
DrawScatterPlot
,
ExprProfileOverlay
, Serialized FormInner classes inherited from class java.awt.Canvas |
java.awt.Canvas.AccessibleAWTCanvas |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock |
Field Summary | |
private java.lang.String |
aText
ARGS: |
private java.lang.String |
aTextOrig
copy of original aText disp below title3 |
(package private) CompositeDatabase |
cdb
link to global CompositeDatabase instance |
(package private) int |
cvPrecision
fraction precision reporting data |
(package private) float |
cx1
clipped x1 for clipping divider |
(package private) float |
cx2
clipped x2 for clipping divider |
(package private) float |
cy1
clipped y1 for clipping divider |
(package private) float |
cy2
clipped y2for clipping divider |
(package private) GeneList |
dispCL
associated GeneList if not null |
private boolean |
draw180lineFlag
flag: draw 180 degree line |
private boolean |
draw45lineFlag
flag: draw 45 degree line |
(package private) boolean |
drawIntoImageFlag
flag: set if draw plot to GIF file |
(package private) ExprProfileOverlay |
epov
if ExprProfileOverlay is the parent, else null |
(package private) GeneList |
eventHandlerCL
set to gene list being used |
(package private) Filter |
fc
link to global Filter instance |
private java.awt.Font |
fontReg
regular font |
(package private) java.awt.Graphics |
gScatterPlot
Graphics context used with displayPlot |
private java.lang.String |
horizCaption
ARGS: horizontal caption |
private int |
iFontHdrSize
|
private int |
iFontSize
integer regular font size |
private int |
iHeight
working canvas height |
private java.lang.String |
info1
ARGS: |
private java.lang.String |
info2
ARGS: |
private java.lang.String |
info3
ARGS: |
private java.lang.String |
info4
ARGS: |
private int |
iWidth
working canvas width |
private boolean[] |
jGrpList
group # for EP [0:maxGenes-1] |
private boolean |
logScalingFlag
flag: Linear(false)/Log(true) |
(package private) MAExplorer |
mae
link to global instance |
private int[] |
mapPntToMid
map point # in [0:nGroup*maxGenes] to [0:maxGenes] |
(package private) int |
maxLineList
max allowed # of EGL genes |
(package private) double |
maxX
max X range set in initial call |
(package private) double |
maxXscroll
max X range set by ShowPlotPopup scrollers |
(package private) double |
maxY
max X range set in initial call |
(package private) double |
maxYscroll
max Y range set by ShowPlotPopup scrollers |
(package private) static int |
MIN_CANVAS_HEIGHT
default canvas height |
(package private) static int |
MIN_CANVAS_WIDTH
default canvas width |
(package private) double |
minX
min X range set in initial call |
(package private) double |
minXscroll
min X range set by ShowPlotPopup scrollers |
(package private) double |
minY
min Y range set in initial call |
(package private) double |
minYscroll
min Y range set by ShowPlotPopup scrollers |
(package private) MaHybridSample |
ms
link to global MaHybridSample instance |
(package private) int |
nLineGroup
# sequential points to connect group with line for use with EP 2D plot # of lines/line-group |
(package private) int |
nList
# elements in x(y)(p)List[0:nList-1] |
(package private) int |
nPointsPlotted
# points plotted. |
(package private) java.lang.String |
oGifFileName
full Gif file path name |
(package private) OverlayMap |
olmap
link to scatterplot named overlay maps instance |
(package private) int |
plotMode2D
plot mode for spp |
(package private) int |
preferredHeight
preferred canvas height |
(package private) int |
preferredWidth
preferred canvas width |
private int[] |
propList
property of data to draw |
(package private) double |
scaleX
scale factor X-axis |
(package private) double |
scaleY
scale factor X-axis |
(package private) boolean |
showNonFilteredGenesFlag
show grayed out non-filtered genes |
(package private) ShowPlotPopup |
spp
if ShowPlotPopup is the parent, else null |
(package private) static int |
TARGET_SIZE
target Size for selecting a line |
private java.lang.String |
title
ARGS: horizontal caption |
private java.lang.String |
title1
ARGS: |
private java.lang.String |
title2
ARGS: |
private java.lang.String |
title3
ARGS: |
private java.lang.String |
topTitle
ARGS: |
private boolean |
useXaxisIntNbrFlag
flag: label all vert lines w/int # |
private java.lang.String |
vertCaption
ARGS: vertical caption |
(package private) float |
vx1
viewport x1 for clipping divider |
(package private) float |
vx2
viewport x2 for clipping divider |
(package private) float |
vy1
viewport y1 for clipping divider |
(package private) float |
vy2
viewport y2 for clipping divider |
private float |
xBase
baseline for xxList to xPnt |
(package private) float[] |
xDataScatterPlot
x Data for computing ratios when clicking |
private int[][] |
xLineList
X values for only EGL gene points [0:nGroup-1][0:maxGenes-1] |
(package private) float[] |
xList
ALL of actual X data points to draw [0:nList-1] |
(package private) int[] |
xPlotted
x plot coordinate for clicking on point in list |
private int |
xPnt
xList[] data mapped to int |
private float |
xScale
slope for xList to xPnt |
private int |
xText
-- |
private float |
yBase
baseline for yList to xyPnt |
(package private) float[] |
yDataScatterPlot
y Data for computing ratios when clicking |
private int[][] |
yLineList
Y values for only EGL gene points [0:nGroup-1][0:maxGenes-1] |
(package private) float[] |
yList
ALL of actual Y data points to draw [0:nList-1] |
(package private) int[] |
yPlotted
y plot coordinate for clicking on point in list |
private int |
yPnt
yList[] data mapped to int |
private float |
yScale
slope for yList to yPnt |
private int |
yText
-- |
Fields inherited from class java.awt.Canvas |
base, nameCounter, serialVersionUID |
Fields inherited from class java.awt.Component |
accessibleContext, actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dbg, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
(package private) |
Draw2Dplot(MAExplorer mae,
int plotMode,
ShowPlotPopup spp,
ExprProfileOverlay epov,
java.lang.String title,
int nPoints,
int nLineGroup,
boolean useXaxisIntNbrFlag)
Draw2Dplot() - constructor |
Method Summary | |
private int |
clipCodeViewport(float x,
float y)
clip_code_viewport(x,y) - Return the clipping code of where (x,y) is w.r.t. |
(package private) boolean |
clipViewport(float x1,
float x2,
float y1,
float y2)
clipViewport(x1,x2,y1,y2) - Compute if (x1,x2,y1,y2) is inside of Viewport window. |
(package private) void |
draw2Dplot(java.awt.Graphics g)
draw2Dplot() - draw a plot in the current graphics context. |
private void |
drawCircle(java.awt.Graphics g,
int xC,
int yC,
int radius,
java.awt.Color color)
drawCircle() - draw a circle as overlay graphic in specified color. |
private void |
drawFilledColoredCircle(java.awt.Graphics g,
int x,
int y,
int radius,
int red,
int green,
int blue)
drawFilledColoredCircle() - draw filled circle of specified RGB color |
private void |
drawFilledGrayCircle(java.awt.Graphics g,
int x,
int y,
int radius,
int grayValue)
drawFilledGrayCircle() - draw filled circle of specified grayvalue |
private void |
drawNamedOverlayMaps(java.awt.Graphics g,
float scaleXplot,
float scaleYplot,
double minXscroll,
double minYscroll,
int xOffset,
int yOffset)
drawNamedOverlayMaps() try to draw overlay maps if there are any and they are enabled |
private void |
drawPlus(java.awt.Graphics g,
int x,
int y,
java.awt.Color color)
drawPlus() - draw plus sign as overlay graphic in specified color. |
private void |
drawRectangleBin(java.awt.Graphics g,
int x,
int y,
int width,
int height,
java.awt.Color color)
drawRectangleBin() - draw rectangle (histogram) bin as overlay graphic in specified color. |
private void |
drawSquare(java.awt.Graphics g,
int xC,
int yC,
int radius,
java.awt.Color color)
drawSquare() - draw a square as overlay graphic in specified color. |
java.awt.Dimension |
getMinimumSize()
getMinimumSize() - get the minimum preferred size |
java.awt.Dimension |
getPreferredSize()
getPreferredSize() - get the preferred size |
void |
mouseClicked(java.awt.event.MouseEvent e)
|
void |
mouseDragged(java.awt.event.MouseEvent e)
|
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mouseMoved(java.awt.event.MouseEvent e)
mouseMoved() - process mouse event - update MouseOver |
void |
mousePressed(java.awt.event.MouseEvent e)
mousePressed() - process mouse event, change current gene. |
void |
mouseReleased(java.awt.event.MouseEvent e)
|
void |
paint(java.awt.Graphics g)
paint() - draw the 2D plot. |
(package private) void |
set2DplotSubtitles(java.lang.String info1,
java.lang.String info2,
java.lang.String info3,
java.lang.String info4)
set2DplotSubtitles() - set info1,2,3,4 subtitles for plot. |
(package private) void |
setDataToClip(float x1,
float x2,
float y1,
float y2)
setDataToClip() - set (cx1,cx2,cy1,cy2) data to clip from((x1,x2,y1,y2) |
private void |
setFontsFromState()
setFontsFromState() - set the regular fonts from the state variables |
(package private) void |
setViewport(float vx1,
float vx2,
float vy1,
float vy2)
setViewport() - set the viewport (vx1,vx2,vy1,vy2) between two points. |
(package private) void |
update2Dplot(java.lang.String vertCaption,
java.lang.String horizCaption,
java.lang.String title,
java.lang.String topTitle,
java.lang.String title1,
java.lang.String title2,
java.lang.String title3,
java.lang.String aText,
int xText,
int yText,
double scaleX,
double scaleY,
double minX,
double maxX,
double minY,
double maxY,
boolean draw45lineFlag,
boolean draw180lineFlag,
float[] xList,
float[] yList,
int[] propList,
GeneList dispCL,
int nList,
int[] mapPntToMid)
update2Dplot() - set data for plot and then update the plot. |
(package private) void |
updateScaling(boolean logScalingFlag,
boolean showNonFilteredGenesFlag)
updateScaling() - set scaling mode in proper sub-object. |
(package private) void |
updateScrolledRegion(float x1Pos,
float x2Pos,
float y1Pos,
float y2Pos)
updateScrolledRegion() - update scrolled region to plot. |
Methods inherited from class java.awt.Canvas |
|
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkGD, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createChildHierarchyEvents, createHierarchyEvents, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, dispatchEventImpl, doLayout, enable, enable, enableEvents, enableInputMethods, eventEnabled, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getMaximumSize, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, initIDs, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, layout, lightweightPaint, lightweightPrint, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, numListening, paintAll, paintHeavyweightComponents, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, printHeavyweightComponents, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, readObject, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, resetGC, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate, writeObject |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait |
Field Detail |
MAExplorer mae
MaHybridSample ms
Filter fc
CompositeDatabase cdb
ExprProfileOverlay epov
ShowPlotPopup spp
OverlayMap olmap
int plotMode2D
static final int MIN_CANVAS_WIDTH
static final int MIN_CANVAS_HEIGHT
static final int TARGET_SIZE
int preferredHeight
int preferredWidth
private int iWidth
private int iHeight
float[] xDataScatterPlot
float[] yDataScatterPlot
int[] xPlotted
int[] yPlotted
float vx1
float vx2
float vy1
float vy2
float cx1
float cx2
float cy1
float cy2
int cvPrecision
int nPointsPlotted
GeneList eventHandlerCL
java.awt.Graphics gScatterPlot
boolean drawIntoImageFlag
java.lang.String oGifFileName
private java.lang.String vertCaption
private java.lang.String horizCaption
private java.lang.String title
private java.lang.String topTitle
private java.lang.String title1
private java.lang.String title2
private java.lang.String title3
private java.lang.String info1
private java.lang.String info2
private java.lang.String info3
private java.lang.String info4
private java.lang.String aText
private java.lang.String aTextOrig
private int iFontSize
private int iFontHdrSize
private java.awt.Font fontReg
private int xText
private int yText
double scaleX
double scaleY
double minX
double maxX
double minY
double maxY
double minXscroll
double minYscroll
double maxXscroll
double maxYscroll
boolean showNonFilteredGenesFlag
private boolean logScalingFlag
private boolean draw45lineFlag
private boolean draw180lineFlag
private boolean useXaxisIntNbrFlag
private float xScale
private float yScale
private float xBase
private float yBase
float[] xList
float[] yList
private int[][] xLineList
private int[][] yLineList
private int[] mapPntToMid
private boolean[] jGrpList
private int xPnt
private int yPnt
private int[] propList
GeneList dispCL
int maxLineList
int nList
int nLineGroup
Constructor Detail |
Draw2Dplot(MAExplorer mae, int plotMode, ShowPlotPopup spp, ExprProfileOverlay epov, java.lang.String title, int nPoints, int nLineGroup, boolean useXaxisIntNbrFlag)
mae
- is the MAExplorer instanceplotMode
- is the 2D plot modespp
- is the ShowPlotPopup instanceepov
- is ExprProfileOverlay instance if not nulltitle
- is window titlenPoints
- is the # points= #genes X #samplesnLineGroup
- # of lines/line-group. 1 for scatter plotuseXaxisIntNbrFlag
- to label all vert lines w/int #Method Detail |
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class java.awt.Component
public java.awt.Dimension getMinimumSize()
getMinimumSize
in class java.awt.Component
void setViewport(float vx1, float vx2, float vy1, float vy2)
vx1
- is viewport x1 coordinatevx2
- is viewport x2 coordinatevy1
- is viewport y1 coordinatevy2
- is viewport y2 coordinatevoid setDataToClip(float x1, float x2, float y1, float y2)
x1
- is coordinatex2
- is coordinatey1
- is coordinatey2
- is coordinateprivate int clipCodeViewport(float x, float y)
x
- is coordinatey
- is coordinateboolean clipViewport(float x1, float x2, float y1, float y2)
x1
- is coordinatex2
- is coordinatey1
- is coordinatey2
- is coordinatesetDataToClip(float, float, float, float)
,
clipCodeViewport(float, float)
public void paint(java.awt.Graphics g)
paint
in class java.awt.Canvas
g
- is graphics contextdraw2Dplot(java.awt.Graphics)
private final void drawPlus(java.awt.Graphics g, int x, int y, java.awt.Color color)
g
- is graphics contextx
- is center of objecty
- is center of objectcolor
- is color to drawprivate final void drawCircle(java.awt.Graphics g, int xC, int yC, int radius, java.awt.Color color)
g
- is graphics contextx
- is center of objecty
- is center of objectradius
- of objectcolor
- is color to drawprivate final void drawSquare(java.awt.Graphics g, int xC, int yC, int radius, java.awt.Color color)
g
- is graphics contextx
- is center of objecty
- is center of objectradius
- of objectcolor
- is color to drawprivate final void drawRectangleBin(java.awt.Graphics g, int x, int y, int width, int height, java.awt.Color color)
g
- is graphics contextx
- is center of objecty
- is center of objectwidth
- of objectheight
- of objectcolor
- is color to drawprivate final void drawFilledGrayCircle(java.awt.Graphics g, int x, int y, int radius, int grayValue)
g
- is graphics contextx
- is center of objecty
- is center of objectradius
- of objectgrayvalue
- is gray value color to drawprivate final void drawFilledColoredCircle(java.awt.Graphics g, int x, int y, int radius, int red, int green, int blue)
g
- is graphics contextx
- is center of objecty
- is center of objectradius
- of objectred
- is red component of colorgreen
- is green component of colorblue
- is blue component of colorvoid update2Dplot(java.lang.String vertCaption, java.lang.String horizCaption, java.lang.String title, java.lang.String topTitle, java.lang.String title1, java.lang.String title2, java.lang.String title3, java.lang.String aText, int xText, int yText, double scaleX, double scaleY, double minX, double maxX, double minY, double maxY, boolean draw45lineFlag, boolean draw180lineFlag, float[] xList, float[] yList, int[] propList, GeneList dispCL, int nList, int[] mapPntToMid)
vertCaption
- vertical captionhorizCaption
- is horizontal captiontitle
- is window titloetopTitle
- is top title in plottitle1
- is next top title in plottitle2
- is next top title in plottitle3
- is next top title in plotaText
- is bottom title in plotxText
- is bottom title in plotyText
- is bottom title in plotscaleX
- is global scalingscaleY
- is global scalingminX
- is min possible XmaxX
- is max possible X rangeminY
- is min possible YmaxY
- is max possible Y rangedraw45lineFlag
- draw180lineFlag
- xList[]
- is list of X axis data pointsyList
- is list of Y axis data pointspropList
- is gene property list fo points (optional)dispCL
- is the display GeneList if not nullnList
- is the # entries in List[]'smapPntToMid
- is the expression profile overlay nHP*nGenes MIDs mappingpaint(java.awt.Graphics)
,
Component.repaint()
void updateScrolledRegion(float x1Pos, float x2Pos, float y1Pos, float y2Pos)
x1Pos
- in range 0.0:1.0x2Pos
- in range 0.0:1.0y1Pos
- in range 0.0:1.0y2Pos
- in range 0.0:1.0paint(java.awt.Graphics)
void set2DplotSubtitles(java.lang.String info1, java.lang.String info2, java.lang.String info3, java.lang.String info4)
info1
- is extra subtitlesinfo2
- is extra subtitlesinfo3
- is extra subtitlesinfo4
- is extra subtitlesprivate void setFontsFromState()
private void drawNamedOverlayMaps(java.awt.Graphics g, float scaleXplot, float scaleYplot, double minXscroll, double minYscroll, int xOffset, int yOffset)
g
- is graphics contextvoid draw2Dplot(java.awt.Graphics g)
g
- is graphics contextGeneList.isMIDinGeneList(int)
,
Util.cvd2s(double, int)
,
WriteGifEncoder
,
WriteGifEncoder.writeFile(java.lang.String)
,
draw2Dplot(java.awt.Graphics)
,
drawCircle(java.awt.Graphics, int, int, int, java.awt.Color)
,
drawPlus(java.awt.Graphics, int, int, java.awt.Color)
,
drawSquare(java.awt.Graphics, int, int, int, java.awt.Color)
,
Component.repaint()
void updateScaling(boolean logScalingFlag, boolean showNonFilteredGenesFlag)
logScalingFlag
- to do log scaling if setshowNonFilteredGenesFlag
- if setComponent.repaint()
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
e
- is mouse pressed eventDrawScatterPlot.mouseHandler(int, int, int, boolean)
,
ExprProfileOverlay.mouseHandler(int, int, int, boolean)
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
e
- is mouse moved eventDrawScatterPlot.mouseHandler(int, int, int, boolean)
,
ExprProfileOverlay.mouseHandler(int, int, int, boolean)
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |