|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.olduvai.accordiondrawer.AccordionDrawer
public abstract class AccordionDrawer
An abstract class representing a two dimensional rectangular grid on which
any geometric shape can be drawn. The geometric shapes use the grid as reference
points, and user-controlled deformations on the grid deform the shapes accordingly.
Some developed applications that render on the deformable grid include:
Trees: TreeJuxtaposer
Sequences: net.sourceforge.olduvai.sequencejuxtaposer.SequenceJuxtaposer
Network monitoring: net.sourceforge.olduvai.lrac.LiveRAC
Field Summary | |
---|---|
protected static java.awt.Color |
backgroundColor
Color of the background, used by clear() . |
protected float |
backplane
Lowest plane for drawing, everything below clipped |
InteractionBox |
baseBox
A temporary InteractionBox used to replace the flash box before a doFlash() call. |
boolean |
basePass
Flag to indicate a base pass for saving the current scene as a postscript figure. |
FontWrapper |
bff
Font wrapper (to jFTGL library) object for drawing labels. |
protected javax.media.opengl.GLCanvas |
canvas
The drawing surface object, a 1-to-1 relationship between canvas and this AccordionDrawer |
protected static int |
clearCount
The number of times clear is called by any drawer. |
protected boolean |
continueFrame
True when the current drawing continues a previously unfinished frame, set in continueFrame() |
protected long |
continueStart
Start time for first drawing frame, set in startNewFrame() |
static boolean |
debugOutput
Set flag to true to display debug output, false for interactive performance or releases. |
GridCell |
defaultFocusCell
|
static java.lang.String |
DEFAULTFONTFAMILY
Default font family (concatenate string with other font properties) to use for all labels. |
static java.awt.Font |
DEFAULTLABELFONT
Default title font type, using normal fonts in the default label size. |
static float |
DEFAULTLABELFONTSIZE
Default label font size, in points. |
static java.awt.Font |
DEFAULTTITLEFONT
Default title font type, using bolded fonts in the default title size. |
static float |
DEFAULTTITLEFONTSIZE
Default title font size, in points. |
static int |
dequeueChunkPerTimeCheck
The number of enqueued objects to draw per inner drawing loop before checking the timer. |
boolean |
dimbrite
(currently only TJ) Flag to draw unmarked nodes dimmer (less saturated for visual depth cues). |
boolean |
dimcolors
(currently only TJ) Flag to draw marked colors dimmer (less saturated). |
protected boolean |
doBox
Flag to request drawing the interaction box ( flashBox ) in the drawer. |
boolean |
doDoubleBuffer
True: double buffering is active, draw on back buffer and swap to front. |
protected boolean |
doingFlash
State flag to indicate that we are currently requesting a flash draw, not a full redraw (used by requestRedraw() to avoid extra drawFrame() ). |
protected boolean |
doublebuffer
State of the double buffer state of GL, which is turned off during some mouse-over flash actions. |
boolean |
drawBackground
Flag for background drawing |
boolean |
drawGeoms
Flag to draw the geometries, which is default true (do draw geometries for data objects). |
boolean |
drawGrid
Flag to draw a background grid, with one line from min SplitAxis to max SplitAxis. |
boolean |
drawlabels
Flag to turn label drawing on (default, true), or off (false). |
protected java.util.ArrayList |
drawnLabels
The set of labels that we have drawn, checked by drawing functions to prevent overlaps. |
boolean |
dumpstats
Flag to indicate that we are currently dumping stats (i.e. |
protected long |
dynamicStart
Start time for any new rendering pass, refreshed in startNewFrame() and continueFrame() |
protected long |
dynamicTime
Dynamic time frame that specifies minimum time spent (in ms) for a rendering pass, set to 30 milliseconds for most applications. |
protected static int |
FAR_FROM_STUCK
A mouse click was far from a stuck line. |
InteractionBox |
flashBox
The current interaction box being stetched, or selected through a mouse-over. |
protected InteractionBox |
flashBoxOld
The previous interaction box that is being replaced by flashBox . |
protected float |
flashBoxWidth
Width of flash box border, in pixels. |
protected java.awt.Color |
flashCol
The color used to represent a mouse cursor, a geometry is highlighted with this special color (defaults to orange). |
protected CellGeom |
flashGeom
A geometry that represents the currently drawn flash object (single object that is selected by a mouse-over; could be a composite/aggregate object, but it is drawn as a single entity). |
protected CellGeom |
flashGeomOld
The geometry for the previously selected flash object (see flashGeom , flashBox , and flashBoxOld ). |
protected int |
flashX
Mouse cursor X position during a flash draw. |
protected int |
flashXOld
Old mouse cursor X position from previous flash draw. |
protected int |
flashY
Mouse cursor Y position during a flash draw. |
protected int |
flashYOld
Old mouse cursor Y position from previous flash draw. |
GridCell |
focusCell
|
protected boolean |
fontInitialized
Flag to check for an already initialized font object (the first AccordionDrawer will initialize fonts for subsequent drawers) |
protected boolean |
forceRedraw
Set to true to force a full draw ignoring toDraw() and toMove() queues (queues should be cleared by forceRedraw() ). |
protected int |
frameNum
Frame number, updated after each scene redraw and any reshaping command. |
protected float |
gridplane
Same as backplane , the plane on which the deformable grid is drawn (default not drawn) |
boolean |
groupPass
Flag to indicate a group pass for saving the current scene as a postscript figure. |
protected float |
hiliteplane
Above objplane , below interactionplane , for showing regions of guaranteed visibility. |
boolean |
ignoreProgressive
State of progressive rendering. |
protected double |
inflateIncr
Percentage to add for an inflate (stretch), or subtract for deflate (squish); used to determine how much to grow each region, this value is split between resizing regions depending on their initial relative sizes. |
protected float |
interactionplane
Highest plane for drawing, above labelplane , for performing interactions and mouse-over label drawing |
protected int |
key
Single integer key for applications that may have more than one drawer object (TJ), for array lookups and identification. |
protected java.awt.Color |
labelBackColor
Background color of label text. |
protected java.awt.Color |
labelBackHiColor
Background color of highlighted label text. |
protected float |
labelbgplane
Above hiliteplane , below labelplane , for drawing label backgrounds,
where the label text is drawn 4 times (offset vertically and horizontally by a small number of pixels) in the label background color |
protected java.awt.Color |
labelColor
Foreground color of label text. |
boolean |
labeldrawback
Flag set to draw the background (filled bounding box) for non-mouseover labels. |
protected java.awt.Color |
labelHiColor
Foreground color of highlighted label text. |
protected float |
labelplane
Above labelbgplane , below interactionplane , for drawing actual label text |
boolean |
labelposright
(currently only TJ) Flag to set position of labels (non-mouseover). |
private int |
linethickness
Thickness of lines used in geometric object drawing, currently only used in TJ, where marked nodes are (width+2). |
boolean |
linkednav
(currently only TJ) Linked navigation flag, defaults to true, where certain navigations (subtree stretching) are linked between drawers. |
static boolean |
loaded
Set initially to false, true when data is done loading and canvas is ready to draw. |
protected static int |
MAX_STUCK_X
A mouse click was close to the max stuck of X. |
protected static int |
MAX_STUCK_Y
A mouse click was close to the max stuck of Y. |
protected static int |
MIN_STUCK_X
A mouse click was close to the min stuck of X. |
protected static int |
MIN_STUCK_Y
A mouse click was close to the min stuck of Y. |
protected double[] |
minCellDims
AKA block-size, this state is the number of pixels (could be fractional, in screen coordinates) to minimally descend to for a partition (see SplitAxis descent methods). |
double |
minContextInside
The percentage of screen area guaranteed for smooshed things between pairs of growing regions. |
double |
minContextPeriphery
The percentage of screen area guaranteed for smooshed things between the boundaries and nearest growing region. |
protected boolean |
mouseDragging
State flag to indicate that a mouse drag is in progress. |
protected int |
mouseMoveAnimSteps
The number of animation steps to use for mouse animations. |
protected int |
mouseMoveAnimStepsNPR
The number of animation steps to use for mouse animations, for normal, full-frame rendering (non-progressive rendering). |
protected int[] |
mouseNow
Current location of the cursor in X and Y directions. |
protected int[] |
mousePrev
Previous location of the cursor, in X and Y directions. |
boolean |
noflash
Flag to turn flash drawing on (default, true), or off (false). |
protected long |
now
Refreshed during a rendering pass in drawFrame() , used to check time spent rendering. |
protected int |
numAnimSteps
The number of animations steps for navigation transitions. |
protected int |
numCellsDrawnThisFrame
Debugging value used to compute efficiency of drawing algorithm, incremented once per geometric object, reset to 0 at start of each frame. |
protected float |
objplane
Above gridplane , below labelbgplane , the plane on which we draw geometric objects, but not the text or highlighting layers |
protected java.awt.Color |
rubberbandColor
XOR color mask for rubberband interaction box. |
boolean |
showdiffs
Flag to turn automated difference marking on (default, true), or off (false). |
static java.lang.String |
snapShotExtension
Extension used for postscipt output figures. |
static java.lang.String |
snapshotName
Global snapshot name that is derived from one AD object. |
java.io.BufferedWriter |
snapShotWriter
Snapshot writer object, one for each AD, created when snapshot function ( doSnapshot(ArrayList) ) is run. |
protected SplitAxis[] |
splitAxis
The split axis objects in the X and Y directions. |
protected boolean |
startFrame
True when drawing a frame for the first time, set when in startNewFrame() |
protected java.io.PrintWriter |
stats
Statistics (rendering time for different setups) buffered writer, currently not enabled as most original (pre 2.0) techniques for drawing are deprecated. |
boolean |
takeSnapshot
Flag turned on when user wants a snapshot of the current scene. |
boolean |
textPass
Flag to indicate a text pass for saving the current scene as a postscript figure. |
protected java.util.Vector |
ToDrawQ
The drawing queue. |
java.util.Hashtable |
toMove
Table of SplitTransition , which store information about SplitLine movements that are in progress. |
protected boolean[] |
uniformSplits
Flags to set initial distribution of split lines ( X , Y ). |
protected int[] |
winsize
Size of the window (in pixels) to draw canvas in, for X and Y directions |
static int |
X
Constant for X (horizontal grid direction) |
static int |
Y
Constant for Y (vertical grid direction) |
Constructor Summary | |
---|---|
AccordionDrawer(int w,
int h)
Main constructor for Accordion Drawer objects. |
Method Summary | |
---|---|
void |
animatedReset(int numAnimSteps)
|
void |
clear()
Clears the canvas. |
void |
clearQueue()
Clears the drawing queue, ToDrawQ . |
protected void |
continueFrame()
Continues a scene by drawing an additional frame related to what is already visible. |
protected InteractionBox |
createBoxFromCells(int stuckType)
Creates an interaction box with a given stuck line, if one has been chosen. |
protected InteractionBox |
createBoxFromCells(int[] dragStart,
int[] dragEnd)
Creates an interaction box from the drag motion input. |
protected int[] |
createRectFromPick(InteractionBox stretchBox)
Make an InteractionBox from the GridCells nearest to the box of the mousedrag. |
protected abstract void |
customGLInit(javax.media.opengl.GL gl)
This is called from the init method of AccordionDrawer. |
void |
decreaseLineThickness()
Decreases the line thickness used in drawing by 1 ( linethickness , TJ only) |
void |
display(javax.media.opengl.GLAutoDrawable canvas)
Display function that is called ONLY by JOGL (via canvas.display()), NEVER call this directly. |
void |
displayChanged(javax.media.opengl.GLAutoDrawable drawable,
boolean modeChanged,
boolean deviceChanged)
JOGL canvas function for updating the display. |
private void |
displayFrame()
Function that contains the logic to either continue an existing frame (we have started a frame already, or there's more to draw and a user hasn't performed a stretch operation) or start a new frame from a blank canvas. |
abstract void |
doFlash()
Perform application-specific flash drawing. |
protected void |
doFrameMove()
Transition function to perform a single animation step. |
static void |
doSnapshot(java.util.ArrayList drawers)
Wrapper for starting a snapshot (postscript) output. |
void |
drawEnd(boolean swap)
Drawing wrapper function called after drawing ends. |
void |
drawFrame()
Main drawing loop: draws the objects in the ToDrawQ. |
abstract void |
drawGeom(CellGeom cg,
DrawableRange r)
Draws a single geom. |
protected abstract void |
drawPostFrame()
Perform application-specific drawing after each frame |
protected abstract void |
drawPostScene()
Perform application-specific drawing after each a complete scene |
protected abstract void |
drawPreContFrame()
Perform application-specific pre-drawing before a continuing frame |
protected abstract void |
drawPreNewFrame()
Perform application-specific pre-drawing before a scene starting frame |
abstract void |
drawRange(DrawableRange r)
Draws a range of geoms by a DrawableRange object (see DrawableRange ):
- TJ draws a range of leaf nodes, and ascends to the root
- SJ draws a range of marked nodes, or a column range of site nodes |
abstract void |
drawRange(SplitLine rangeLine)
Draws a range of geoms by a splitline object (objects between split line boundaries of the input split line): - TJ determines which leaf node to draw, and ascends to the root - SJ determines which column of nucleotides to draw, and renders the color column. |
void |
drawSplits(SplitAxis axis,
double minBound,
double maxBound)
Draw the split lines for an axis that are in the partitioned list. |
void |
drawStart(boolean swap)
Drawing wrapper function called before drawing starts. |
void |
drawText(double x,
double y,
java.lang.String name,
java.awt.Font f,
java.awt.Color col,
double zplane,
java.awt.Color outlineColor)
Draw text on jogl canvas, or write text layer to postscript file. |
void |
endAllTransitions()
Attempts to stop all animated transitions in this accordion drawer by calling SplitTransition.end() ]
on each transition object in the movement queue, toMove . |
protected void |
finalize()
Drawer delete function, which calls the shutdown() function to clean up state. |
abstract void |
flashDraw()
"Real" flash drawing code, down-called from the high-level abstract drawing sequence. |
void |
forceRedraw()
Currently has no different function from a direct call to requestRedraw() . |
java.awt.Color |
getBackgroundColor()
Accessor for background color. |
FontWrapper |
getBFF()
Retrieve the font family wrapper object to render text. |
javax.media.opengl.GLCanvas |
getCanvas()
Accessor for the jogl canvas object. |
abstract java.util.ArrayList |
getColorsForCellGeom(CellGeom c)
(TJ only) Get the list of possible colors for the given cell geometry |
int |
getDescent(java.lang.String text,
java.awt.Font f)
Get the maximum descent for the family of fonts for the given height. |
boolean |
getDimBrite()
Returns true if we're drawing a dimmed view of objects, used in TJ to show the depth of nodes. |
boolean |
getDimColors()
Returns true if we're drawing a dimmed view of marked objects, used in TJ to show the depth of nodes. |
boolean |
getDoubleBuffer()
Gets the current state of double buffering. |
boolean |
getDrawGeoms()
Returns the state of drawing geometric objects to represent a dataset ( drawGeoms ) |
boolean |
getDrawGrid()
Returns the state of drawing the background grid (splitlines, drawGrid ) |
boolean |
getDrawLabels()
Returns state of label drawing ( drawlabels ) |
java.util.ArrayList |
getDrawnLabels()
Return the list of drawn labels, stored in an array list. |
boolean |
getDumpStats()
Returns state of stats output ( dumpstats ) |
InteractionBox |
getFlashBox()
Gets the flash box, the box that currently surrounds the highlighted node/region. |
java.awt.Color |
getFlashCol()
Gets the current flash color. |
int |
getFrameNum()
Accessor for current frame number. |
javax.media.opengl.GL |
getGL()
Retrieves the GL context for this accordion drawer. |
float |
gethiliteplane()
Accessor for the highlight plane. |
double |
getInflateIncr()
Accessor for inflate increment. |
int |
getKey()
Returns the unique integer identifier for this drawer. |
java.awt.Color |
getLabelBackColor()
Accessor for label background color. |
java.awt.Color |
getLabelBackHiColor()
Accessor for highlighted label background color. |
java.awt.Color |
getLabelColor()
Accessor for label font color. |
boolean |
getLabelDrawBack()
Returns the state of drawing the label background ( labeldrawback ) |
java.awt.Color |
getLabelHiColor()
Accessor for highlighted label font color. |
double |
getLabelplane()
Accessor for the label plane, the depth in drawing for object labels. |
boolean |
getLabelPosRight()
Returns the state of where TJ draws labels relative to mouse cursor ( labelposright ) |
int |
getLineThickness()
Returns the line thickness used in drawing ( linethickness , TJ only) |
boolean |
getLinkedNav()
Returns the state of linked navigation ( linkednav , TJ only) |
double |
getMinCellDims(int xy)
Accesses the minimum cell dimensions in screen coordinates for the current block size. |
int |
getMouseMoveAnimSteps()
Accessory for number of animated transitions for mouse movements. |
boolean |
getNoFlash()
Returns the state of mouse-over flash drawing ( noflash ) |
int |
getNumAnimSteps()
Accessor for number of animated transition steps. |
double |
getObjplane()
Accessor for the object plane, the depth in drawing for geometric objects. |
double |
getPixelSize(int y)
Returns the size of a block in world ([0,1], fractional) space size. |
java.awt.Color |
getRubberbandColor()
Accessor for rubber band color. |
SplitAxis |
getSplitAxis(int xy)
Accessor for split axes, X X or Y Y . |
java.util.Vector |
getToDrawQ()
Accessor for the drawing queue. |
int |
getWinMax(int xy)
Return the size of the window, in X or Y direction |
int |
getWinsize(int xy)
Accessor for the size of the drawing canvas, in pixels, in the given direction. |
void |
increaseLineThickness()
Increases the line thickness used in drawing by 1 ( linethickness , TJ only) |
void |
incrementFrameNumber()
Adds 1 to the frame number. |
void |
init(javax.media.opengl.GLAutoDrawable canvas)
JOGL-called initialization function that sets up fonts and the main GUI window. |
abstract void |
initCells(javax.swing.JProgressBar jpb)
Initialize the split line hierarchies, including the axes and set the initial sizes. |
void |
initializeFont()
Initialize variable font family wrapper. |
void |
initSplitLines(boolean reset,
boolean staticLines,
int Xsize,
int Ysize)
Initialize the split lines for a two dimensional accordion drawing object. |
boolean |
isDoingFlash()
State accessor for determining if flash drawing is active. |
boolean |
keepDrawing()
State function to determine if more drawing is required for the current frame. |
boolean |
keepMoving()
State function to determine if there are more navigations after the current frame. |
protected void |
moveStuckPosition(InteractionBox stretchBox)
Allows for the movement of the stuck lines, for user-directed control of the accordion drawing boundaries. |
void |
newPixelDiv(double newSize,
int y)
Sets the size of a block, in pixels. |
void |
newSnapshotName(java.lang.String base,
java.io.File directory)
Assembles a snapshot name to write a postscript figure that looks like the current scene. |
abstract CellGeom |
pickGeom(int x,
int y)
Get the geometric object found at pixel coordinate (x,y) |
protected abstract void |
preDraw(javax.media.opengl.GLAutoDrawable canvas)
This is the very first thing called from the display() function, for performing application-specific drawing routines (not currently necessary in exisiting applications). |
void |
requestRedraw()
Redraw immediately, do not continue filling in details. |
void |
reset()
Resets the canvas to a state with a uniform grid, ends transitions, then redraws. |
void |
resetGridUniform()
Resets the grid to a uniform state. |
protected void |
resetHighlightPlane()
Sets the highlight plane back to its default value (-0.3f = magic number?) |
protected void |
resetObjectPlane()
Sets the object plane back to its default value (-0.5f = magic number?) |
abstract void |
resetSplitValues()
Reset split lines to application-specific values. |
void |
reshape(javax.media.opengl.GLAutoDrawable canvas,
int x,
int y,
int w,
int h)
Overloaded JOGL function for reshaping the canvas object, given position and new dimensions. |
double |
s2w(double s,
int xy)
Converts pixel (screen) coordinates into relative (world) fractional coordinates [0,1]. |
double[] |
s2w(int[] s)
Converts pixel (screen) coordinates into relative (world) fractional coordinates [0,1]. |
double |
s2w(int s,
int xy)
Converts pixel (screen) coordinates into relative (world) fractional coordinates [0,1]. |
void |
saveScreenShot(java.io.File file)
Saves a screen shot of current GL frame to the specified file. |
protected abstract void |
seedQueue()
Seed the drawing queue, application specific |
static void |
setBackgroundColor(java.awt.Color backgroundColor)
Modifier for background color. |
void |
setCellHighlight(GridCell c,
boolean on)
Turn on the highlight flag for the given cell |
void |
setClearColor(java.awt.Color col)
Set the background color (the neutral "clear" color) for this drawer. |
void |
setColorGL(java.awt.Color col)
Set the color to be used for the next GL drawing primitive. |
void |
setColorGLAlpha(java.awt.Color col)
Set the color to be used for the next GL drawing primitive. |
void |
setDimBrite(boolean on)
Sets the value of dimmed/bright viewing state (TJ only). |
void |
setDimColors(boolean on)
Sets the value of dimmed/bright viewing state for marked nodes (TJ only). |
void |
setDoubleBuffer(boolean value)
Sets the state of double buffering in this drawer, and sets the drawing buffer depending on the current drawing state (different for flash drawing than starting or continuing a frame). |
void |
setDrawGeoms(boolean on)
Sets the state of drawing geometric objects to represent a dataset ( drawGeoms ). |
void |
setDrawGrid(boolean on)
Sets the state of drawing the background grid (splitlines, drawGrid ). |
void |
setDrawLabels(boolean on)
Sets the state of label drawing ( drawlabels ), then redraws. |
void |
setDrawSplits(boolean on)
Set the state of split drawing, the drawing of all split lines with no culling. |
void |
setDumpStats(boolean on)
Sets the state of stats output ( dumpstats ) |
void |
setFlash(CellGeom cg,
java.awt.Color col,
int x,
int y,
boolean doBox)
Sets the flash state and calls the flash drawing function, doFlash() . |
void |
setFocusCell(GridCell fc)
Sets the focus cell to the given grid cell |
protected void |
setHighlightPlane(float w)
Sets the height of the highlight plane. |
void |
setInflateIncr(double value)
Modifier for the inflation increment for each automated stretching action. |
void |
setKey(int i)
Sets the unique integer identifier for this drawer. |
void |
setLabelBackColor(java.awt.Color labelBackColor)
Modifier for label background color. |
void |
setLabelBackHiColor(java.awt.Color labelBackHiColor)
Modifier for highlighted label background color. |
void |
setLabelColor(java.awt.Color labelColor)
Modifier for label font color. |
void |
setLabelDrawBack(boolean on)
Sets the state of drawing the label background ( labeldrawback ). |
void |
setLabelHiColor(java.awt.Color labelHiColor)
Modifier for highlighted label font color. |
void |
setLabelPosRight(boolean on)
Sets the state of where TJ draws labels relative to mouse cursor ( labelposright ) |
void |
setLineThickness(int thickness)
Sets the line thickness used in drawing ( linethickness , TJ only) |
void |
setLinkedNav(boolean on)
Sets the state of linked navigation ( linkednav , TJ only). |
void |
setMinCellDims(int xy,
double is)
Sets the minimum cell dimensions in screen coordinates to the given block size. |
void |
setMouseMoveAnimSteps(int mouseMoveAnimSteps,
int nonProgressiveRendering)
Modifier for number of animated transitions for mouse movements. |
void |
setNoFlash(boolean on)
Sets the state of mouse-over flash drawing ( noflash ). |
void |
setNumAnimSteps(int numAnimSteps)
Modifier for number of animated transition steps. |
protected void |
setObjectPlane(float w)
Sets the height of the object plane. |
void |
setRubberbandColor(java.awt.Color rubberbandColor)
Modifier for rubber band color. |
void |
shutdown()
Clear all the data structures initiated in AD, called when tree(s) get deleted from AD. |
protected void |
startNewFrame()
Starts a new scene, performs a transition, seeds the drawing queue, and starts drawing the next frame. |
int |
stringWidth(java.lang.String name,
java.awt.Font f)
Get the width of a string in pixels. |
void |
toggleDimBrite()
Toggle the value of dimbrite |
void |
toggleDimColors()
Toggle the value of dimcolors |
void |
toggleDrawGeoms()
Toggles value of drawGeoms |
void |
toggleDrawGrid()
Toggles value of drawGrid |
void |
toggleDrawLabels()
Toggles value of drawlabels |
void |
toggleDrawSplits()
Toggle for the state of drawing split lines. |
void |
toggleDumpStats()
Toggles value of dumpstats |
void |
toggleLabelDrawBack()
Toggles value of labeldrawback |
void |
toggleLabelPosRight()
Toggles value of labelposright |
void |
toggleLinkedNav()
Toggles value of linkednav |
void |
toggleNoFlash()
Toggles value of noflash |
int |
w2s(double w,
int xy)
Converts relative (world) fractional coordinates from [0, 1] to pixel (screen) coordinates. |
void |
whoCalledMe(int stackStart,
int stackEnd)
Debugging function: print the list of calling functions (not including this one) stackStart <= stackEnd, both which equal the depth of the stack to print |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.awt.event.MouseListener |
---|
mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased |
Methods inherited from interface java.awt.event.MouseMotionListener |
---|
mouseDragged, mouseMoved |
Methods inherited from interface java.awt.event.KeyListener |
---|
keyPressed, keyReleased, keyTyped |
Field Detail |
---|
public static final boolean debugOutput
protected javax.media.opengl.GLCanvas canvas
canvas
and this AccordionDrawer
public static final java.lang.String DEFAULTFONTFAMILY
public static final float DEFAULTTITLEFONTSIZE
public static final java.awt.Font DEFAULTTITLEFONT
public static final float DEFAULTLABELFONTSIZE
public static final java.awt.Font DEFAULTLABELFONT
public FontWrapper bff
protected boolean fontInitialized
protected boolean[] uniformSplits
X
, Y
). True = split lines are distributed
uniformly between all objects (such as tree and sequence grid cells). False = split
lines are distributed according to application-specific parameters (such as BACJ
positioning of sequence segments of different lengths and starting positions).
protected SplitAxis[] splitAxis
X
and Y
directions.
protected java.util.Vector ToDrawQ
seedQueue()
and used by drawFrame()
.
public static boolean loaded
canvas
is ready to draw.
Prevents early interactions (or other draw commands) causing drawing events on slow loading datasets.
protected boolean startFrame
startNewFrame()
protected boolean continueFrame
continueFrame()
protected int[] winsize
canvas
in, for X
and Y
directions
protected long dynamicStart
startNewFrame()
and continueFrame()
protected long continueStart
startNewFrame()
protected long dynamicTime
protected long now
drawFrame()
, used to check time spent rendering.
protected int frameNum
protected static java.awt.Color backgroundColor
clear()
.
protected java.awt.Color labelColor
protected java.awt.Color labelBackColor
protected java.awt.Color labelHiColor
protected java.awt.Color labelBackHiColor
protected java.awt.Color rubberbandColor
protected float backplane
protected float hiliteplane
objplane
, below interactionplane
, for showing regions of guaranteed visibility.
For applications with several highlighting colors (such as groups in TJ), groups are on different planes, based on
their current priority (highest priority on top of all others). Flash text (mouse-over) is above marked groups,
which are in turn above automated guaranteed visibility marks (marked differences between trees in TJ, for example).
protected float labelplane
labelbgplane
, below interactionplane
, for drawing actual label text
protected float labelbgplane
hiliteplane
, below labelplane
, for drawing label backgrounds,
where the label text is drawn 4 times (offset vertically and horizontally by a small number of pixels) in the label background color
protected float gridplane
backplane
, the plane on which the deformable grid is drawn (default not drawn)
protected float objplane
gridplane
, below labelbgplane
, the plane on which we draw geometric objects, but not the text or highlighting layers
protected float interactionplane
labelplane
, for performing interactions and mouse-over label drawing
public boolean drawBackground
public GridCell focusCell
public GridCell defaultFocusCell
protected java.util.ArrayList drawnLabels
LabelBox
objects.
public double minContextInside
public double minContextPeriphery
public static final int X
public static final int Y
public java.util.Hashtable toMove
SplitTransition
, which store information about SplitLine
movements that are in progress.
public final boolean doDoubleBuffer
doublebuffer
.
public boolean ignoreProgressive
protected boolean doublebuffer
doDoubleBuffer
.
public boolean takeSnapshot
snapShotExtension
, ".eps".
public static final java.lang.String snapShotExtension
public static java.lang.String snapshotName
snapShotExtension
.
public java.io.BufferedWriter snapShotWriter
doSnapshot(ArrayList)
) is run.
protected float flashBoxWidth
protected boolean doBox
flashBox
) in the drawer. Typically defaults to false with no interaction box, but set after user selects a deformation region.
public InteractionBox flashBox
protected InteractionBox flashBoxOld
flashBox
. Used to replace information kept in a pixel buffer since subsequent doFlash()
calls can not reference previously drawn flash state.
public InteractionBox baseBox
InteractionBox
used to replace the flash box before a doFlash()
call. TODO: might be possible to make this a local variable or combine with flashBox
?
protected CellGeom flashGeom
protected CellGeom flashGeomOld
flashGeom
, flashBox
, and flashBoxOld
).
protected java.awt.Color flashCol
protected int flashX
protected int flashY
protected int flashXOld
protected int flashYOld
public boolean drawGrid
SplitAxis
to max SplitAxis. Defaults to off, useful to show generic navigation algorithm when geometry is turned off (see drawGeoms
)
public boolean drawGeoms
drawGrid
on to see the generic navigation algorithm on a small dataset.
public boolean noflash
public boolean showdiffs
private int linethickness
public boolean drawlabels
public boolean labelposright
public boolean labeldrawback
public boolean dimcolors
dimbrite
).
public boolean dimbrite
public boolean linkednav
public boolean dumpstats
stats
.
protected boolean mouseDragging
protected boolean doingFlash
requestRedraw()
to avoid extra drawFrame()
).
protected boolean forceRedraw
forceRedraw()
).
This is set by forceRedraw()
(As opposed to requestRedraw())
requestRedraw()
,
forceRedraw()
protected int numAnimSteps
protected int mouseMoveAnimSteps
protected int mouseMoveAnimStepsNPR
protected double inflateIncr
protected double[] minCellDims
SplitAxis
descent methods).
By default set to 1 for TJ, 5 for SJ (see initialBlockSize static final in each application).
protected int key
protected java.io.PrintWriter stats
protected int numCellsDrawnThisFrame
protected static int clearCount
public static int dequeueChunkPerTimeCheck
dynamicTime
)
protected int[] mousePrev
X
and Y
directions.
mousePrev
= mouseNow
after each mouse movement.
protected int[] mouseNow
X
and Y
directions.
public boolean basePass
groupPass
next), and text (textPass
last).
public boolean groupPass
basePass
first), and below text (textPass
last).
public boolean textPass
basePass
first), and groups (groupPass
previous).
protected static final int FAR_FROM_STUCK
protected static final int MIN_STUCK_X
protected static final int MIN_STUCK_Y
protected static final int MAX_STUCK_X
protected static final int MAX_STUCK_Y
Constructor Detail |
---|
public AccordionDrawer(int w, int h)
w
- the width of the new canvas object, in pixelsh
- the height of the new canvas object, in pixelsMethod Detail |
---|
public FontWrapper getBFF()
public int getDescent(java.lang.String text, java.awt.Font f)
text
- String used to compute the maximum descentf
- the font (type, size, properties in the Font object)
public int stringWidth(java.lang.String name, java.awt.Font f)
name
- String to get width for.f
- the font (type, size, properties in the Font object)
public void initializeFont()
public boolean keepDrawing()
ToDrawQ
> 0.
public boolean keepMoving()
toMove
> 0.
public void newSnapshotName(java.lang.String base, java.io.File directory)
snapshotName
.
base
- Starting base name before the file name is appended to snapshotName
.directory
- Location to save the file.public void whoCalledMe(int stackStart, int stackEnd)
stackStart
- 0 = function that called this directly, +1 for each function in the call stackstackEnd
- Last call stack function to display, 0 will print only the function that called this (needs to be >= stackStart)public void newPixelDiv(double newSize, int y)
SplitLine
objects.
See SplitAxis.makePixelRanges(int)
.
newSize
- The new block size, in pixels, can be fractional.y
- The axis dimension for the new pixel size. Typically pass X
or Y
) which have static values.public double getPixelSize(int y)
minCellDims
in the given dimension.
y
- Dimension of interest, typically X
or Y
.
public void endAllTransitions()
SplitTransition.end()
]
on each transition object in the movement queue, toMove
. Transitions are also removed from the queue after the call.
public void initSplitLines(boolean reset, boolean staticLines, int Xsize, int Ysize)
SplitAxis.SplitAxis(AccordionDrawer, boolean, double, double, int, boolean, boolean)
, which handles similar inputs for each horizonal and vertical split axis.
reset
- True: assign world-space, uniformly spaced, positions to all new split lines. False: no initialization for split line positions, useful for applications with non-uniform grid layouts (datasets such as gene positions within sequences that have set relative positions)staticLines
- True: use methods that only allow static datasets, assumes no new split lines. False: use dynamic methods, new split lines are placed with relative positions between existing lines.Xsize
- The number of split lines to initially (or permanently in static layouts) allocate in the horizontal direction.Ysize
- The number of split lines to initially (or permanently in static layouts) allocate in the vertical direction.public void shutdown()
protected void finalize() throws java.lang.Throwable
shutdown()
function to clean up state. The shutdown
function is not necessary when only one drawer is used, or when we finalize a drawer (the drawer state is
destroyed after the finalize, so why is shutdown needed?)
finalize
in class java.lang.Object
java.lang.Throwable
public void setKey(int i)
i
- The unique identifier for this drawer.public int getKey()
public javax.media.opengl.GL getGL()
canvas
.public void init(javax.media.opengl.GLAutoDrawable canvas)
AccordionDrawer(int, int)
).
init
in interface javax.media.opengl.GLEventListener
canvas
- The canvas object.protected abstract void customGLInit(javax.media.opengl.GL gl)
init(GLAutoDrawable)
private void displayFrame()
display(GLAutoDrawable)
.
protected abstract void preDraw(javax.media.opengl.GLAutoDrawable canvas)
canvas
- The canvas object for this drawer.public void display(javax.media.opengl.GLAutoDrawable canvas)
display
in interface javax.media.opengl.GLEventListener
canvas
- The canvas object for this drawer.public void reshape(javax.media.opengl.GLAutoDrawable canvas, int x, int y, int w, int h)
reshape
in interface javax.media.opengl.GLEventListener
canvas
- The canvas object for this drawer.x
- Canvas horizontal position in pixels from the left (0 = left side of screen).y
- Canvas vertical position in pixels from the top (0 = top side of screen).w
- Canvas width in pixels.h
- Canvas height in pixels.public void requestRedraw()
public void forceRedraw()
requestRedraw()
. Originally used to stop
progressive rendering and immediately redraw the scene, instead of requesting an eventual redraw. Now, all redraws
wait for the completion of a frame and enqueue redraw events if a user has requested one through an interaction.
public void setClearColor(java.awt.Color col)
col
- The color for the background, usually backgroundColor
.public void clear()
startNewFrame()
.
public void setDoubleBuffer(boolean value)
value
- The new value for double buffering, changes doublebuffer
. True means double buffering is on.public boolean getDoubleBuffer()
doublebuffer
).public abstract void drawRange(DrawableRange r)
DrawableRange
):
- TJ draws a range of leaf nodes, and ascends to the root
- SJ draws a range of marked nodes, or a column range of site nodes
r
- A range of objects that initiates drawing a partitioned region.public abstract void drawRange(SplitLine rangeLine)
rangeLine
- The SplitLine
object to retrieve boundaries.public abstract void drawGeom(CellGeom cg, DrawableRange r)
cg
- The cell to draw. Applications require their own cell-to-object translation functions.r
- Range to draw into, if drawing a cell requires a particular direction, such as rendering
internal nodes in TJ that must draw within a leaf partition.public void drawSplits(SplitAxis axis, double minBound, double maxBound)
axis
- The axis to draw. X is horizontal, Y is verticalminBound
- Starting position of the split in the other directionmaxBound
- Ending position of the split in the other directionpublic void drawFrame()
dequeueChunkPerTimeCheck
,
and the state of taking snapshots.
display(GLAutoDrawable)
protected void startNewFrame()
protected void continueFrame()
ignoreProgressive
is set to false).
protected void doFrameMove()
drawFrame()
to move
lines in each splitAxis
during animated transitions.
All split lines that are moved (i.e., GridCells resized) go
through a gradual animated transition. Of course other
lines may be moved by some amount to accomodate the directed
transitions.
SplitAxis
,
SplitLine
,
SplitTransition
public int getFrameNum()
frameNum
, starts at 0, increases by 1 for each new frame.public java.awt.Color getBackgroundColor()
backgroundColor
public java.awt.Color getLabelColor()
labelColor
public java.awt.Color getLabelBackColor()
labelBackColor
public java.awt.Color getLabelHiColor()
labelHiColor
public java.awt.Color getLabelBackHiColor()
labelBackHiColor
public java.awt.Color getRubberbandColor()
rubberbandColor
public static void setBackgroundColor(java.awt.Color backgroundColor)
backgroundColor
- New background color (sets backgroundColor
)public void setLabelColor(java.awt.Color labelColor)
labelColor
- New label font color (sets labelColor
)public void setLabelBackColor(java.awt.Color labelBackColor)
labelBackColor
- New label background color (sets labelBackColor
)public void setLabelHiColor(java.awt.Color labelHiColor)
labelHiColor
- New highlighted label font color (sets labelHiColor
)public void setLabelBackHiColor(java.awt.Color labelBackHiColor)
labelBackHiColor
- New highlighted label background color (sets labelBackHiColor
)public void setRubberbandColor(java.awt.Color rubberbandColor)
rubberbandColor
- New rubber band color (sets rubberbandColor
)public void setNumAnimSteps(int numAnimSteps)
numAnimSteps
- New number of steps for each animated transition (sets numAnimSteps
)public int getNumAnimSteps()
numAnimSteps
public void setMouseMoveAnimSteps(int mouseMoveAnimSteps, int nonProgressiveRendering)
mouseMoveAnimSteps
- nonProgressiveRendering
- public int getMouseMoveAnimSteps()
public void setInflateIncr(double value)
minContextInside
and minContextPeriphery
).
value
- inflateIncr
: [0,1] value that controls the amount of growing for stretches.public double getInflateIncr()
setInflateIncr(double)
inflateIncr
public void setFlash(CellGeom cg, java.awt.Color col, int x, int y, boolean doBox)
doFlash()
.
The state for each flash action includes: flashGeom
, flashCol
,
flashX
, flashY
, and doBox
.
cg
- New value of flashGeom
, the object that corresponds to the highlight, if any. May be null if an actual object isn't needed by the application.col
- The color (flashCol
) of the flash action, usually the global flash color (rubberbandColor
), or any highlight color. Null values should use an application-specific neutral color or the color of flashGeom
.x
- The horizontal mouse/cursor position, in screen (pixel) coordinates. Sets flashX
.y
- The vertical mouse/cursor position, in screen (pixel) coordinates. Sets flashY
.doBox
- Set to true if the flash drawing should also draw the rubber band (TJ only, where tree nodes are drawn inside an empty rectangular area)protected void setHighlightPlane(float w)
w
- The new value of hiliteplane
.protected void resetHighlightPlane()
protected void setObjectPlane(float w)
w
- The new value of objplane
protected void resetObjectPlane()
public void setFocusCell(GridCell fc)
fc
- The new value of focusCell
public boolean getDimBrite()
dimbrite
public void setDimBrite(boolean on)
on
- The new value of dimbrite
. True: draw unmarked nodes with less saturation as they are farther from the root. False: all nodes drawn the same color.public void toggleDimBrite()
dimbrite
public boolean getDimColors()
dimcolors
public void setDimColors(boolean on)
on
- The new value of dimcolors
. True: draw marked nodes with less saturation as they are farther from the root. False: all nodes drawn the same color.public void toggleDimColors()
dimcolors
public boolean getDrawLabels()
drawlabels
)
drawlabels
: true = draw labels, false = don't draw labelspublic void setDrawLabels(boolean on)
drawlabels
), then redraws.
on
- Value of drawlabels
: true = draw labels, false = don't draw labelspublic void toggleDrawLabels()
drawlabels
public boolean getDumpStats()
dumpstats
)
dumpstats
: true = output stats, false = don't output statspublic void setDumpStats(boolean on)
dumpstats
)
on
- Value of dumpstats
: true = output stats, false = don't output statspublic void toggleDumpStats()
dumpstats
public boolean getLabelDrawBack()
labeldrawback
)
labeldrawback
: true = draw the rectangle behind the label, false = no background for labelspublic void setLabelDrawBack(boolean on)
labeldrawback
). Redraws.
on
- Value of labeldrawback
: true = draw the rectangle behind the label, false = no background for labelspublic void toggleLabelDrawBack()
labeldrawback
public boolean getLabelPosRight()
labelposright
)
labelposright
: true = draw labels close to node junctions, false = draw labels left of geometry's bounding box (TJ only)public void setLabelPosRight(boolean on)
labelposright
)
on
- Value of labelposright
: true = draw labels close to node junctions, false = draw labels left of geometry's bounding box (TJ only)public void toggleLabelPosRight()
labelposright
public int getLineThickness()
linethickness
, TJ only)
linethickness
public void setLineThickness(int thickness)
linethickness
, TJ only)
thickness
- The new value of linethickness
public void increaseLineThickness()
linethickness
, TJ only)
public void decreaseLineThickness()
linethickness
, TJ only)
public boolean getLinkedNav()
linkednav
, TJ only)
linkednav
: true = do linked navigation for supported navigation techniques, false = do not link navigationpublic void setLinkedNav(boolean on)
linkednav
, TJ only).
on
- The new value of linkednav
: true = do linked navigation for supported navigation techniques, false = do not link navigationpublic void toggleLinkedNav()
linkednav
public boolean getNoFlash()
noflash
)
noflash
: true = do not perform mouse-over flash drawing, false = perform mouse-over flash drawing (default)public void setNoFlash(boolean on)
noflash
). Redraws.
on
- New value of noflash
: true = do not perform mouse-over flash drawing, false = perform mouse-over flash drawing (default)public void toggleNoFlash()
noflash
public boolean getDrawGeoms()
drawGeoms
)
drawGeoms
: true = draw geometric objects to represent data (default), false = do not draw the dataset objects (used when just drawing the stretch and squish grid)public void setDrawGeoms(boolean on)
drawGeoms
). Redraws.
on
- New value of drawGeoms
: true = draw geometric objects to represent data (default), false = do not draw the dataset objects (used when just drawing the stretch and squish grid)public void toggleDrawGeoms()
drawGeoms
public boolean getDrawGrid()
drawGrid
)
drawGrid
: true = draw the horizontal and vertical grid, false =public void setDrawGrid(boolean on)
drawGrid
). Redraws.
on
- New value of drawGrid
: true = draw the horizontal and vertical grid, false =public void toggleDrawGrid()
drawGrid
public void reset()
public void animatedReset(int numAnimSteps)
public void clearQueue()
ToDrawQ
.
public void resetGridUniform()
X
, Y
) is reset.
public double s2w(int s, int xy)
s
- Number of pixels to convertxy
- Direction of conversion (X
or Y
)
public double s2w(double s, int xy)
s
- Number of pixels to convert, may be fractionalxy
- Direction of conversion (X
or Y
)
public double[] s2w(int[] s)
s
- Number of pixels to convert, for both X
and Y
.
public int w2s(double w, int xy)
w
- Fraction of the screen to convert into pixel sizexy
- Direction of conversion (X
or Y
)
public int getWinMax(int xy)
X
or Y
direction
xy
- The axes of interest (either X
or Y
)
winsize
[xy] the size of the window in the given directionpublic abstract CellGeom pickGeom(int x, int y)
x
- Horizontal cursor locationy
- Vertical cursor location
public void setCellHighlight(GridCell c, boolean on)
c
- A gridcell to highlighton
- True: turn on the highlight for the cell, False: turn off the highlightpublic void setColorGL(java.awt.Color col)
col
- The chosen java.awt.Color objectpublic void setColorGLAlpha(java.awt.Color col)
col
- The chosen java.awt.Color objectpublic void drawStart(boolean swap)
swap
- True: swap the drawing buffers before starting, which we never do (always false)public void drawEnd(boolean swap)
swap
- True: swap the drawing buffers after flushing. False: do nothing.public abstract void initCells(javax.swing.JProgressBar jpb)
jpb
- A progressBar widget for displaying progresspublic abstract java.util.ArrayList getColorsForCellGeom(CellGeom c)
c
- The object to draw, once we have the color
public abstract void doFlash()
protected abstract void drawPreContFrame()
protected abstract void drawPreNewFrame()
protected abstract void drawPostFrame()
protected abstract void drawPostScene()
protected abstract void seedQueue()
public abstract void resetSplitValues()
resetGridUniform()
.
public double getMinCellDims(int xy)
minCellDims
, this value could be fractional, but is usually 1 for single pixel blocks,
or 5 for larger initial block sizes.
xy
- Direction of interest, X
or Y
.
minCellDims
for the given xy direction.public void setMinCellDims(int xy, double is)
minCellDims
, this value could be fractional, but is usually 1 for single pixel blocks,
or 5 for larger initial block sizes.
xy
- Direction of interest, X
or Y
.is
- New minCellDims
for the given xy direction.public double getObjplane()
objplane
.public double getLabelplane()
labelplane
.public boolean isDoingFlash()
display(GLAutoDrawable)
.
doingFlash
.public int getWinsize(int xy)
xy
- Horizontal X
or vertical Y
direction.
winsize
.public void toggleDrawSplits()
public void setDrawSplits(boolean on)
on
- The state to set the grid drawing value drawGrid
.public java.util.ArrayList getDrawnLabels()
drawnLabels
, the list of labels that are currently being displayed in the frame.protected InteractionBox createBoxFromCells(int stuckType)
stuckType
- See MIN_STUCK_X
, MIN_STUCK_Y
, MAX_STUCK_X
, MAX_STUCK_Y
.
protected InteractionBox createBoxFromCells(int[] dragStart, int[] dragEnd)
dragStart
- X/Y coordinate of the starting positiondragEnd
- X/Y coordinate of the ending position
protected int[] createRectFromPick(InteractionBox stretchBox)
stretchBox
- Defined by 4 split lines (2 movable, 2 not) and is currently being resized.
protected void moveStuckPosition(InteractionBox stretchBox)
stretchBox
- Box that defines the stuck line to be moved, the X or the Y, MIN or MAX stuck position.public java.util.Vector getToDrawQ()
ToDrawQ
public SplitAxis getSplitAxis(int xy)
X
or Y Y
.
splitAxis
.public void incrementFrameNumber()
public InteractionBox getFlashBox()
flashBox
.public java.awt.Color getFlashCol()
flashCol
.public void drawText(double x, double y, java.lang.String name, java.awt.Font f, java.awt.Color col, double zplane, java.awt.Color outlineColor)
x
- Horizontal positiony
- Vertical postitionname
- String to display at the given positionf
- Font object used to display stringcol
- Color to draw the font objectszplane
- Height in the drawing plane to render the fontoutlineColor
- Color for the outside edge or background for each font object.public void displayChanged(javax.media.opengl.GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged)
displayChanged
in interface javax.media.opengl.GLEventListener
drawable
- The drawable object, which is always the canvas object canvas
, passed in by the event handler.modeChanged
- Unused in implementation, we do a complete redrawdeviceChanged
- Unused in implementation, we do a complete redrawpublic abstract void flashDraw()
public javax.media.opengl.GLCanvas getCanvas()
canvas
.public void saveScreenShot(java.io.File file)
file
- Java File object specifying file to write the output to.public static void doSnapshot(java.util.ArrayList drawers)
drawers
- The list of drawers to export to eps (postscript). Each specific drawer type will requirepublic float gethiliteplane()
hiliteplane
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |