net.sourceforge.olduvai.accordiondrawer
Class AccordionDrawer

java.lang.Object
  extended by net.sourceforge.olduvai.accordiondrawer.AccordionDrawer
All Implemented Interfaces:
java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener, javax.media.opengl.GLEventListener
Direct Known Subclasses:
AccordionTreeDrawer

public abstract class AccordionDrawer
extends java.lang.Object
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.KeyListener, javax.media.opengl.GLEventListener

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

Version:
2.1
Author:
Tamara Munzner, Serdar Tasiran, James Slack

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

debugOutput

public static final boolean debugOutput
Set flag to true to display debug output, false for interactive performance or releases.

See Also:
Constant Field Values

canvas

protected javax.media.opengl.GLCanvas canvas
The drawing surface object, a 1-to-1 relationship between canvas and this AccordionDrawer


DEFAULTFONTFAMILY

public static final java.lang.String DEFAULTFONTFAMILY
Default font family (concatenate string with other font properties) to use for all labels.

See Also:
Constant Field Values

DEFAULTTITLEFONTSIZE

public static final float DEFAULTTITLEFONTSIZE
Default title font size, in points.

See Also:
Constant Field Values

DEFAULTTITLEFONT

public static final java.awt.Font DEFAULTTITLEFONT
Default title font type, using bolded fonts in the default title size.


DEFAULTLABELFONTSIZE

public static final float DEFAULTLABELFONTSIZE
Default label font size, in points.

See Also:
Constant Field Values

DEFAULTLABELFONT

public static final java.awt.Font DEFAULTLABELFONT
Default title font type, using normal fonts in the default label size.


bff

public FontWrapper bff
Font wrapper (to jFTGL library) object for drawing labels.


fontInitialized

protected boolean fontInitialized
Flag to check for an already initialized font object (the first AccordionDrawer will initialize fonts for subsequent drawers)


uniformSplits

protected boolean[] uniformSplits
Flags to set initial distribution of split lines (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).


splitAxis

protected SplitAxis[] splitAxis
The split axis objects in the X and Y directions.


ToDrawQ

protected java.util.Vector ToDrawQ
The drawing queue. Objects to be drawn are placed in here by seedQueue() and used by drawFrame().


loaded

public static boolean loaded
Set initially to false, true when data is done loading and canvas is ready to draw. Prevents early interactions (or other draw commands) causing drawing events on slow loading datasets.


startFrame

protected boolean startFrame
True when drawing a frame for the first time, set when in startNewFrame()


continueFrame

protected boolean continueFrame
True when the current drawing continues a previously unfinished frame, set in continueFrame()


winsize

protected int[] winsize
Size of the window (in pixels) to draw canvas in, for X and Y directions


dynamicStart

protected long dynamicStart
Start time for any new rendering pass, refreshed in startNewFrame() and continueFrame()


continueStart

protected long continueStart
Start time for first drawing frame, set in startNewFrame()


dynamicTime

protected long dynamicTime
Dynamic time frame that specifies minimum time spent (in ms) for a rendering pass, set to 30 milliseconds for most applications.


now

protected long now
Refreshed during a rendering pass in drawFrame(), used to check time spent rendering.


frameNum

protected int frameNum
Frame number, updated after each scene redraw and any reshaping command.


backgroundColor

protected static java.awt.Color backgroundColor
Color of the background, used by clear().


labelColor

protected java.awt.Color labelColor
Foreground color of label text.


labelBackColor

protected java.awt.Color labelBackColor
Background color of label text.


labelHiColor

protected java.awt.Color labelHiColor
Foreground color of highlighted label text.


labelBackHiColor

protected java.awt.Color labelBackHiColor
Background color of highlighted label text.


rubberbandColor

protected java.awt.Color rubberbandColor
XOR color mask for rubberband interaction box.


backplane

protected float backplane
Lowest plane for drawing, everything below clipped


hiliteplane

protected float hiliteplane
Above 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).


labelplane

protected float labelplane
Above labelbgplane, below interactionplane, for drawing actual label text


labelbgplane

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


gridplane

protected float gridplane
Same as backplane, the plane on which the deformable grid is drawn (default not drawn)


objplane

protected float objplane
Above gridplane, below labelbgplane, the plane on which we draw geometric objects, but not the text or highlighting layers


interactionplane

protected float interactionplane
Highest plane for drawing, above labelplane, for performing interactions and mouse-over label drawing


drawBackground

public boolean drawBackground
Flag for background drawing


focusCell

public GridCell focusCell

defaultFocusCell

public GridCell defaultFocusCell

drawnLabels

protected java.util.ArrayList drawnLabels
The set of labels that we have drawn, checked by drawing functions to prevent overlaps. This arrayList stores LabelBox objects.


minContextInside

public double minContextInside
The percentage of screen area guaranteed for smooshed things between pairs of growing regions.


minContextPeriphery

public double minContextPeriphery
The percentage of screen area guaranteed for smooshed things between the boundaries and nearest growing region.


X

public static final int X
Constant for X (horizontal grid direction)

See Also:
Constant Field Values

Y

public static final int Y
Constant for Y (vertical grid direction)

See Also:
Constant Field Values

toMove

public java.util.Hashtable toMove
Table of SplitTransition, which store information about SplitLine movements that are in progress.


doDoubleBuffer

public final boolean doDoubleBuffer
True: double buffering is active, draw on back buffer and swap to front. False: only draw on front. This is the initial state of doublebuffer.

See Also:
Constant Field Values

ignoreProgressive

public boolean ignoreProgressive
State of progressive rendering. True: NO progressive rendering, each frame is drawn before next transition in movement queue is processed. False: DO progressive rendering by default, frames are drawn until the frame time limit (default 30ms) expires, when a new movement will cause a complete redraw.


doublebuffer

protected boolean doublebuffer
State of the double buffer state of GL, which is turned off during some mouse-over flash actions. The over-all state of double buffering for normal drawing is kept in doDoubleBuffer.


takeSnapshot

public boolean takeSnapshot
Flag turned on when user wants a snapshot of the current scene. Turned off (false) after written. The file name is the window title (e.g. tree file names, replacing spaces with underscores), an incrementing number, and the snapShotExtension, ".eps".


snapShotExtension

public static final java.lang.String snapShotExtension
Extension used for postscipt output figures.

See Also:
Constant Field Values

snapshotName

public static java.lang.String snapshotName
Global snapshot name that is derived from one AD object. Names end with snapShotExtension.


snapShotWriter

public java.io.BufferedWriter snapShotWriter
Snapshot writer object, one for each AD, created when snapshot function (doSnapshot(ArrayList)) is run.


flashBoxWidth

protected float flashBoxWidth
Width of flash box border, in pixels. Defaults to 1 for mouse-over bounding boxes, but set to 3 or higher for during a rectilinear reshape.


doBox

protected boolean doBox
Flag to request drawing the interaction box (flashBox) in the drawer. Typically defaults to false with no interaction box, but set after user selects a deformation region.


flashBox

public InteractionBox flashBox
The current interaction box being stetched, or selected through a mouse-over.


flashBoxOld

protected InteractionBox flashBoxOld
The previous interaction box that is being replaced by flashBox. Used to replace information kept in a pixel buffer since subsequent doFlash() calls can not reference previously drawn flash state.


baseBox

public InteractionBox baseBox
A temporary 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?


flashGeom

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).


flashGeomOld

protected CellGeom flashGeomOld
The geometry for the previously selected flash object (see flashGeom, flashBox, and flashBoxOld).


flashCol

protected java.awt.Color flashCol
The color used to represent a mouse cursor, a geometry is highlighted with this special color (defaults to orange).


flashX

protected int flashX
Mouse cursor X position during a flash draw. Used to place the pop-up label.


flashY

protected int flashY
Mouse cursor Y position during a flash draw. Used to place the pop-up label.


flashXOld

protected int flashXOld
Old mouse cursor X position from previous flash draw. Used to remove the previous pop-up label.


flashYOld

protected int flashYOld
Old mouse cursor Y position from previous flash draw. Used to remove the previous pop-up label.


drawGrid

public boolean drawGrid
Flag to draw a background grid, with one line from min SplitAxis to max SplitAxis. Defaults to off, useful to show generic navigation algorithm when geometry is turned off (see drawGeoms)


drawGeoms

public boolean drawGeoms
Flag to draw the geometries, which is default true (do draw geometries for data objects). Turn this off and drawGrid on to see the generic navigation algorithm on a small dataset.


noflash

public boolean noflash
Flag to turn flash drawing on (default, true), or off (false).


showdiffs

public boolean showdiffs
Flag to turn automated difference marking on (default, true), or off (false).


linethickness

private int linethickness
Thickness of lines used in geometric object drawing, currently only used in TJ, where marked nodes are (width+2).


drawlabels

public boolean drawlabels
Flag to turn label drawing on (default, true), or off (false).


labelposright

public boolean labelposright
(currently only TJ) Flag to set position of labels (non-mouseover). True: labels drawn adjacent to node junctions (default), False: labels drawn left of geometry.


labeldrawback

public boolean labeldrawback
Flag set to draw the background (filled bounding box) for non-mouseover labels.


dimcolors

public boolean dimcolors
(currently only TJ) Flag to draw marked colors dimmer (less saturated). Defaults to false where marks are a constant color, rather than following the saturation rules of unmarked (see dimbrite).


dimbrite

public boolean dimbrite
(currently only TJ) Flag to draw unmarked nodes dimmer (less saturated for visual depth cues). Defaults to true, where nodes change from black (close to root) to light grey (close to leaves).


linkednav

public boolean linkednav
(currently only TJ) Linked navigation flag, defaults to true, where certain navigations (subtree stretching) are linked between drawers. This does not affect marked group stretching as this is done for free if linked highlighting is on.


dumpstats

public boolean dumpstats
Flag to indicate that we are currently dumping stats (i.e. time to render) to stats.


mouseDragging

protected boolean mouseDragging
State flag to indicate that a mouse drag is in progress.


doingFlash

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()).


forceRedraw

protected boolean forceRedraw
Set to true to force a full draw ignoring toDraw() and toMove() queues (queues should be cleared by forceRedraw()). This is set by forceRedraw() (As opposed to requestRedraw())

See Also:
requestRedraw(), forceRedraw()

numAnimSteps

protected int numAnimSteps
The number of animations steps for navigation transitions. Set to 1 for jump cuts. Must be > 0.


mouseMoveAnimSteps

protected int mouseMoveAnimSteps
The number of animation steps to use for mouse animations. Set > 1 to smoothen mouse navigation at cost of rendering extra frames. Must be > 0.


mouseMoveAnimStepsNPR

protected int mouseMoveAnimStepsNPR
The number of animation steps to use for mouse animations, for normal, full-frame rendering (non-progressive rendering). Set > 1 to smoothen mouse navigation at cost of rendering extra frames. Must be > 0.


inflateIncr

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.


minCellDims

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). By default set to 1 for TJ, 5 for SJ (see initialBlockSize static final in each application).


key

protected int key
Single integer key for applications that may have more than one drawer object (TJ), for array lookups and identification.


stats

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. TODO: reimplement for current interesting test cases?


numCellsDrawnThisFrame

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.


clearCount

protected static int clearCount
The number of times clear is called by any drawer. Used for debugging to check for extra clears that may cause flickering.


dequeueChunkPerTimeCheck

public static int dequeueChunkPerTimeCheck
The number of enqueued objects to draw per inner drawing loop before checking the timer. Applications that require intense drawing or processing per object should adjust this (approx this many objects should be drawable in well under 30 ms, or the value set by dynamicTime)


mousePrev

protected int[] mousePrev
Previous location of the cursor, in X and Y directions. mousePrev = mouseNow after each mouse movement.


mouseNow

protected int[] mouseNow
Current location of the cursor in X and Y directions.


basePass

public boolean basePass
Flag to indicate a base pass for saving the current scene as a postscript figure. The base pass is the lower level, unmarked nodes, drawn first, and will appear below groups (groupPass next), and text (textPass last).


groupPass

public boolean groupPass
Flag to indicate a group pass for saving the current scene as a postscript figure. The group pass is the mid level, marked nodes, drawn second, and will appear above the base (basePass first), and below text (textPass last).


textPass

public boolean textPass
Flag to indicate a text pass for saving the current scene as a postscript figure. The text pass is the top level, scene labels, drawn last, and will appear above the base (basePass first), and groups (groupPass previous).


FAR_FROM_STUCK

protected static final int FAR_FROM_STUCK
A mouse click was far from a stuck line. Does not activate a stuck split line (boundary) for manual moving.

See Also:
Constant Field Values

MIN_STUCK_X

protected static final int MIN_STUCK_X
A mouse click was close to the min stuck of X. Allows min X stuck line to be moved manually in the canvas.

See Also:
Constant Field Values

MIN_STUCK_Y

protected static final int MIN_STUCK_Y
A mouse click was close to the min stuck of Y. Allows min Y stuck line to be moved manually in the canvas.

See Also:
Constant Field Values

MAX_STUCK_X

protected static final int MAX_STUCK_X
A mouse click was close to the max stuck of X. Allows max X stuck line to be moved manually in the canvas.

See Also:
Constant Field Values

MAX_STUCK_Y

protected static final int MAX_STUCK_Y
A mouse click was close to the max stuck of Y. Allows max Y stuck line to be moved manually in the canvas.

See Also:
Constant Field Values
Constructor Detail

AccordionDrawer

public AccordionDrawer(int w,
                       int h)
Main constructor for Accordion Drawer objects. Requires canvas dimensions from the application. This function creates the canvas object, initializes state for generic accordion drawer operations, initializes the font object for all drawers (if this is the first AD for applications with many drawers), and starts event listeners.

Parameters:
w - the width of the new canvas object, in pixels
h - the height of the new canvas object, in pixels
Method Detail

getBFF

public FontWrapper getBFF()
Retrieve the font family wrapper object to render text.

Returns:
the font family wrapper object

getDescent

public int getDescent(java.lang.String text,
                      java.awt.Font f)
Get the maximum descent for the family of fonts for the given height. The descent is the distance a character needs below the line (for characters like 'g', 'y' or 'j').

Parameters:
text - String used to compute the maximum descent
f - the font (type, size, properties in the Font object)
Returns:
Largest descent for any character in the font family in pixels.

stringWidth

public int stringWidth(java.lang.String name,
                       java.awt.Font f)
Get the width of a string in pixels.

Parameters:
name - String to get width for.
f - the font (type, size, properties in the Font object)
Returns:
Width of string in pixels.

initializeFont

public void initializeFont()
Initialize variable font family wrapper.


keepDrawing

public boolean keepDrawing()
State function to determine if more drawing is required for the current frame. True when number of objects in ToDrawQ > 0.


keepMoving

public boolean keepMoving()
State function to determine if there are more navigations after the current frame. True when number of objects in toMove > 0.


newSnapshotName

public 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. The result is written to the current state of snapshotName.

Parameters:
base - Starting base name before the file name is appended to snapshotName.
directory - Location to save the file.

whoCalledMe

public 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

Parameters:
stackStart - 0 = function that called this directly, +1 for each function in the call stack
stackEnd - Last call stack function to display, 0 will print only the function that called this (needs to be >= stackStart)

newPixelDiv

public void newPixelDiv(double newSize,
                        int y)
Sets the size of a block, in pixels. A block is the limiting size in partitioning a split axis prior to rendering. Each partitioned region will be smaller than the block size, if not a single region between adjacent SplitLine objects. See SplitAxis.makePixelRanges(int).

Parameters:
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.

getPixelSize

public double getPixelSize(int y)
Returns the size of a block in world ([0,1], fractional) space size. Uses minCellDims in the given dimension.

Parameters:
y - Dimension of interest, typically X or Y.
Returns:
size of a block in the given dimension. For example, in a canvas height of 200 pixels, block size of 1, dimension Y, the block size is 1/200 or 0.005

endAllTransitions

public 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. Transitions are also removed from the queue after the call.


initSplitLines

public void initSplitLines(boolean reset,
                           boolean staticLines,
                           int Xsize,
                           int Ysize)
Initialize the split lines for a two dimensional accordion drawing object. See SplitAxis.SplitAxis(AccordionDrawer, boolean, double, double, int, boolean, boolean), which handles similar inputs for each horizonal and vertical split axis.

Parameters:
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.

shutdown

public void shutdown()
Clear all the data structures initiated in AD, called when tree(s) get deleted from AD. This function was initially created when AD objects were going to be reused (i.e. a new tree loaded into the drawer), but now we create new drawers with new trees.


finalize

protected void finalize()
                 throws java.lang.Throwable
Drawer delete function, which calls the 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?)

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

setKey

public void setKey(int i)
Sets the unique integer identifier for this drawer. Useful when using many drawers in the same application.

Parameters:
i - The unique identifier for this drawer.

getKey

public int getKey()
Returns the unique integer identifier for this drawer.

Returns:
The unique identifier for this drawer.

getGL

public javax.media.opengl.GL getGL()
Retrieves the GL context for this accordion drawer. This should be called each time a drawing method is required, do not store the GL object as state.

Returns:
GL context handle for the canvas.

init

public void init(javax.media.opengl.GLAutoDrawable canvas)
JOGL-called initialization function that sets up fonts and the main GUI window. DO NOT CALL THIS FUNCTION DIRECTLY. This function will be called by JOGL after creating the canvas (see AccordionDrawer(int, int)).

Specified by:
init in interface javax.media.opengl.GLEventListener
Parameters:
canvas - The canvas object.

customGLInit

protected abstract void customGLInit(javax.media.opengl.GL gl)
This is called from the init method of AccordionDrawer. The purpose of this method is to set any custom GL state required by the application. This method is called AFTER all other GL setup has been performed.

See Also:
init(GLAutoDrawable)

displayFrame

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. This function is called only from display(GLAutoDrawable).


preDraw

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).

Parameters:
canvas - The canvas object for this drawer.

display

public void display(javax.media.opengl.GLAutoDrawable canvas)
Display function that is called ONLY by JOGL (via canvas.display()), NEVER call this directly. Calls application-specific pre-draw function, then either calls flash drawing function or normal drawing. Normal drawing is either starting a new frame, or continuing an existing one.

Specified by:
display in interface javax.media.opengl.GLEventListener
Parameters:
canvas - The canvas object for this drawer.

reshape

public 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. Do not call this function directly, this is called by JOGL after the containing window has been resized.

Specified by:
reshape in interface javax.media.opengl.GLEventListener
Parameters:
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.

requestRedraw

public void requestRedraw()
Redraw immediately, do not continue filling in details. All drawing requests are made through this function, nothing else should call canvas.display() to protect the proper use of display (to prevent accidental ad.display() calls).


forceRedraw

public void forceRedraw()
Currently has no different function from a direct call to 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.


setClearColor

public void setClearColor(java.awt.Color col)
Set the background color (the neutral "clear" color) for this drawer. Does not update the scene directly, requires a redraw to take effect.

Parameters:
col - The color for the background, usually backgroundColor.

clear

public void clear()
Clears the canvas. Called by startNewFrame().


setDoubleBuffer

public 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).

Parameters:
value - The new value for double buffering, changes doublebuffer. True means double buffering is on.

getDoubleBuffer

public boolean getDoubleBuffer()
Gets the current state of double buffering.

Returns:
The state of double buffering for this drawer (doublebuffer).

drawRange

public 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

Parameters:
r - A range of objects that initiates drawing a partitioned region.

drawRange

public 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.

Parameters:
rangeLine - The SplitLine object to retrieve boundaries.

drawGeom

public abstract void drawGeom(CellGeom cg,
                              DrawableRange r)
Draws a single geom. use the range if geom might require assistance - TJ draws a tree node, descends to some leaf, ascends to the root (skeleton drawing) - needs range to determine originating drawing range to descend toward - SJ does not draw single geoms in typical use, only aggregated columns are supported

Parameters:
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.

drawSplits

public void drawSplits(SplitAxis axis,
                       double minBound,
                       double maxBound)
Draw the split lines for an axis that are in the partitioned list. Fake split lines are not drawn. This function is limited to the partition set, only the top level split lines are shown (not useful for datasets with tens of thousands of split lines, but useful for small datasets to show rubbersheet function with data overlaid.)

Parameters:
axis - The axis to draw. X is horizontal, Y is vertical
minBound - Starting position of the split in the other direction
maxBound - Ending position of the split in the other direction

drawFrame

public void drawFrame()
Main drawing loop: draws the objects in the ToDrawQ. Called by the display function, and is sensitive to progressive rendering, the value of dequeueChunkPerTimeCheck, and the state of taking snapshots.

See Also:
display(GLAutoDrawable)

startNewFrame

protected void startNewFrame()
Starts a new scene, performs a transition, seeds the drawing queue, and starts drawing the next frame.


continueFrame

protected void continueFrame()
Continues a scene by drawing an additional frame related to what is already visible. Does not perform transitions and is only used while progressive rendering (when ignoreProgressive is set to false).


doFrameMove

protected void doFrameMove()
Transition function to perform a single animation step. This is run before 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.

See Also:
SplitAxis, SplitLine, SplitTransition

getFrameNum

public int getFrameNum()
Accessor for current frame number.

Returns:
frameNum, starts at 0, increases by 1 for each new frame.

getBackgroundColor

public java.awt.Color getBackgroundColor()
Accessor for background color.

Returns:
backgroundColor

getLabelColor

public java.awt.Color getLabelColor()
Accessor for label font color.

Returns:
labelColor

getLabelBackColor

public java.awt.Color getLabelBackColor()
Accessor for label background color.

Returns:
labelBackColor

getLabelHiColor

public java.awt.Color getLabelHiColor()
Accessor for highlighted label font color.

Returns:
labelHiColor

getLabelBackHiColor

public java.awt.Color getLabelBackHiColor()
Accessor for highlighted label background color.

Returns:
labelBackHiColor

getRubberbandColor

public java.awt.Color getRubberbandColor()
Accessor for rubber band color.

Returns:
rubberbandColor

setBackgroundColor

public static void setBackgroundColor(java.awt.Color backgroundColor)
Modifier for background color.

Parameters:
backgroundColor - New background color (sets backgroundColor)

setLabelColor

public void setLabelColor(java.awt.Color labelColor)
Modifier for label font color.

Parameters:
labelColor - New label font color (sets labelColor)

setLabelBackColor

public void setLabelBackColor(java.awt.Color labelBackColor)
Modifier for label background color.

Parameters:
labelBackColor - New label background color (sets labelBackColor)

setLabelHiColor

public void setLabelHiColor(java.awt.Color labelHiColor)
Modifier for highlighted label font color.

Parameters:
labelHiColor - New highlighted label font color (sets labelHiColor)

setLabelBackHiColor

public void setLabelBackHiColor(java.awt.Color labelBackHiColor)
Modifier for highlighted label background color.

Parameters:
labelBackHiColor - New highlighted label background color (sets labelBackHiColor)

setRubberbandColor

public void setRubberbandColor(java.awt.Color rubberbandColor)
Modifier for rubber band color.

Parameters:
rubberbandColor - New rubber band color (sets rubberbandColor)

setNumAnimSteps

public void setNumAnimSteps(int numAnimSteps)
Modifier for number of animated transition steps.

Parameters:
numAnimSteps - New number of steps for each animated transition (sets numAnimSteps)

getNumAnimSteps

public int getNumAnimSteps()
Accessor for number of animated transition steps.

Returns:
numAnimSteps

setMouseMoveAnimSteps

public void setMouseMoveAnimSteps(int mouseMoveAnimSteps,
                                  int nonProgressiveRendering)
Modifier for number of animated transitions for mouse movements.

Parameters:
mouseMoveAnimSteps -
nonProgressiveRendering -

getMouseMoveAnimSteps

public int getMouseMoveAnimSteps()
Accessory for number of animated transitions for mouse movements. Depends on the current state of progressive rendering (PR). If we're doing PR, we typically want fewer transitions for large mouse movements (jump cuts), and for non-PR, more transitions make the animations smoother, as there is typically less to render per scene. Many mouse actions per second will cancel previous transactions, so only "jerky" mouse movements make a difference with more transaction steps.

Returns:
The number of animation steps per mouse movement (stretching actions).

setInflateIncr

public void setInflateIncr(double value)
Modifier for the inflation increment for each automated stretching action. Does not affect the user-controlled mouse stretching, only the "make bigger" actions that usually happen after a user types "b" (or "s" for smaller). This value should be between 0 and 1, where 0 means stretches do nothing, and 1 means a stretch will fill in the maximum size available. A stretch followed by a squish of the same area should be idempotent, but may be slightly skewed by restrictions on minimum squishing size parameters (minContextInside and minContextPeriphery).

Parameters:
value - inflateIncr: [0,1] value that controls the amount of growing for stretches.

getInflateIncr

public double getInflateIncr()
Accessor for inflate increment. See setInflateIncr(double)

Returns:
inflateIncr

setFlash

public 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(). The state for each flash action includes: flashGeom, flashCol, flashX, flashY, and doBox.

Parameters:
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)

setHighlightPlane

protected void setHighlightPlane(float w)
Sets the height of the highlight plane.

Parameters:
w - The new value of hiliteplane.

resetHighlightPlane

protected void resetHighlightPlane()
Sets the highlight plane back to its default value (-0.3f = magic number?)


setObjectPlane

protected void setObjectPlane(float w)
Sets the height of the object plane.

Parameters:
w - The new value of objplane

resetObjectPlane

protected void resetObjectPlane()
Sets the object plane back to its default value (-0.5f = magic number?)


setFocusCell

public void setFocusCell(GridCell fc)
Sets the focus cell to the given grid cell

Parameters:
fc - The new value of focusCell

getDimBrite

public boolean getDimBrite()
Returns true if we're drawing a dimmed view of objects, used in TJ to show the depth of nodes. False draws all nodes the same non-dimmed, standard object color.

Returns:
The value of dimbrite

setDimBrite

public void setDimBrite(boolean on)
Sets the value of dimmed/bright viewing state (TJ only). Redraws.

Parameters:
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.

toggleDimBrite

public void toggleDimBrite()
Toggle the value of dimbrite


getDimColors

public boolean getDimColors()
Returns true if we're drawing a dimmed view of marked objects, used in TJ to show the depth of nodes. False draws all nodes the same non-dimmed, standard marked object colors.

Returns:
The value of dimcolors

setDimColors

public void setDimColors(boolean on)
Sets the value of dimmed/bright viewing state for marked nodes (TJ only). Redraws.

Parameters:
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.

toggleDimColors

public void toggleDimColors()
Toggle the value of dimcolors


getDrawLabels

public boolean getDrawLabels()
Returns state of label drawing (drawlabels)

Returns:
Value of drawlabels: true = draw labels, false = don't draw labels

setDrawLabels

public void setDrawLabels(boolean on)
Sets the state of label drawing (drawlabels), then redraws.

Parameters:
on - Value of drawlabels: true = draw labels, false = don't draw labels

toggleDrawLabels

public void toggleDrawLabels()
Toggles value of drawlabels


getDumpStats

public boolean getDumpStats()
Returns state of stats output (dumpstats)

Returns:
Value of dumpstats: true = output stats, false = don't output stats

setDumpStats

public void setDumpStats(boolean on)
Sets the state of stats output (dumpstats)

Parameters:
on - Value of dumpstats: true = output stats, false = don't output stats

toggleDumpStats

public void toggleDumpStats()
Toggles value of dumpstats


getLabelDrawBack

public boolean getLabelDrawBack()
Returns the state of drawing the label background (labeldrawback)

Returns:
Value of labeldrawback: true = draw the rectangle behind the label, false = no background for labels

setLabelDrawBack

public void setLabelDrawBack(boolean on)
Sets the state of drawing the label background (labeldrawback). Redraws.

Parameters:
on - Value of labeldrawback: true = draw the rectangle behind the label, false = no background for labels

toggleLabelDrawBack

public void toggleLabelDrawBack()
Toggles value of labeldrawback


getLabelPosRight

public boolean getLabelPosRight()
Returns the state of where TJ draws labels relative to mouse cursor (labelposright)

Returns:
Value of labelposright: true = draw labels close to node junctions, false = draw labels left of geometry's bounding box (TJ only)

setLabelPosRight

public void setLabelPosRight(boolean on)
Sets the state of where TJ draws labels relative to mouse cursor (labelposright)

Parameters:
on - Value of labelposright: true = draw labels close to node junctions, false = draw labels left of geometry's bounding box (TJ only)

toggleLabelPosRight

public void toggleLabelPosRight()
Toggles value of labelposright


getLineThickness

public int getLineThickness()
Returns the line thickness used in drawing (linethickness, TJ only)

Returns:
The value of linethickness

setLineThickness

public void setLineThickness(int thickness)
Sets the line thickness used in drawing (linethickness, TJ only)

Parameters:
thickness - The new value of linethickness

increaseLineThickness

public void increaseLineThickness()
Increases the line thickness used in drawing by 1 (linethickness, TJ only)


decreaseLineThickness

public void decreaseLineThickness()
Decreases the line thickness used in drawing by 1 (linethickness, TJ only)


getLinkedNav

public boolean getLinkedNav()
Returns the state of linked navigation (linkednav, TJ only)

Returns:
Value of linkednav: true = do linked navigation for supported navigation techniques, false = do not link navigation

setLinkedNav

public void setLinkedNav(boolean on)
Sets the state of linked navigation (linkednav, TJ only).

Parameters:
on - The new value of linkednav: true = do linked navigation for supported navigation techniques, false = do not link navigation

toggleLinkedNav

public void toggleLinkedNav()
Toggles value of linkednav


getNoFlash

public boolean getNoFlash()
Returns the state of mouse-over flash drawing (noflash)

Returns:
Value of noflash: true = do not perform mouse-over flash drawing, false = perform mouse-over flash drawing (default)

setNoFlash

public void setNoFlash(boolean on)
Sets the state of mouse-over flash drawing (noflash). Redraws.

Parameters:
on - New value of noflash: true = do not perform mouse-over flash drawing, false = perform mouse-over flash drawing (default)

toggleNoFlash

public void toggleNoFlash()
Toggles value of noflash


getDrawGeoms

public boolean getDrawGeoms()
Returns the state of drawing geometric objects to represent a dataset (drawGeoms)

Returns:
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)

setDrawGeoms

public void setDrawGeoms(boolean on)
Sets the state of drawing geometric objects to represent a dataset (drawGeoms). Redraws.

Parameters:
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)

toggleDrawGeoms

public void toggleDrawGeoms()
Toggles value of drawGeoms


getDrawGrid

public boolean getDrawGrid()
Returns the state of drawing the background grid (splitlines, drawGrid)

Returns:
Value of drawGrid: true = draw the horizontal and vertical grid, false =

setDrawGrid

public void setDrawGrid(boolean on)
Sets the state of drawing the background grid (splitlines, drawGrid). Redraws.

Parameters:
on - New value of drawGrid: true = draw the horizontal and vertical grid, false =

toggleDrawGrid

public void toggleDrawGrid()
Toggles value of drawGrid


reset

public void reset()
Resets the canvas to a state with a uniform grid, ends transitions, then redraws. Applications that do not have a uniform grid for a default drawing (such as genome browsers?) need to over-ride this function.


animatedReset

public void animatedReset(int numAnimSteps)

clearQueue

public void clearQueue()
Clears the drawing queue, ToDrawQ.


resetGridUniform

public void resetGridUniform()
Resets the grid to a uniform state. Each axis (X, Y) is reset.


s2w

public double s2w(int s,
                  int xy)
Converts pixel (screen) coordinates into relative (world) fractional coordinates [0,1].

Parameters:
s - Number of pixels to convert
xy - Direction of conversion (X or Y)
Returns:
Fraction of the screen covered by s pixels in the given direction.

s2w

public double s2w(double s,
                  int xy)
Converts pixel (screen) coordinates into relative (world) fractional coordinates [0,1].

Parameters:
s - Number of pixels to convert, may be fractional
xy - Direction of conversion (X or Y)
Returns:
Fraction of the screen covered by s pixels in the given direction.

s2w

public double[] s2w(int[] s)
Converts pixel (screen) coordinates into relative (world) fractional coordinates [0,1]. Returns results for both axes.

Parameters:
s - Number of pixels to convert, for both X and Y.
Returns:
Fraction of the screen covered by s pixels in both directions.

w2s

public int w2s(double w,
               int xy)
Converts relative (world) fractional coordinates from [0, 1] to pixel (screen) coordinates.

Parameters:
w - Fraction of the screen to convert into pixel size
xy - Direction of conversion (X or Y)
Returns:
Number of pixels covered by the given fraction w. Rounded down to the nearest integer.

getWinMax

public int getWinMax(int xy)
Return the size of the window, in X or Y direction

Parameters:
xy - The axes of interest (either X or Y)
Returns:
winsize[xy] the size of the window in the given direction

pickGeom

public abstract CellGeom pickGeom(int x,
                                  int y)
Get the geometric object found at pixel coordinate (x,y)

Parameters:
x - Horizontal cursor location
y - Vertical cursor location
Returns:
The geometric object at (x,y)

setCellHighlight

public void setCellHighlight(GridCell c,
                             boolean on)
Turn on the highlight flag for the given cell

Parameters:
c - A gridcell to highlight
on - True: turn on the highlight for the cell, False: turn off the highlight

setColorGL

public void setColorGL(java.awt.Color col)
Set the color to be used for the next GL drawing primitive. Only sets RGB, does not change the alpha channel.

Parameters:
col - The chosen java.awt.Color object

setColorGLAlpha

public void setColorGLAlpha(java.awt.Color col)
Set the color to be used for the next GL drawing primitive. Sets RGB and the alpha channel

Parameters:
col - The chosen java.awt.Color object

drawStart

public void drawStart(boolean swap)
Drawing wrapper function called before drawing starts. Pseudo-deprecated.

Parameters:
swap - True: swap the drawing buffers before starting, which we never do (always false)

drawEnd

public void drawEnd(boolean swap)
Drawing wrapper function called after drawing ends.

Parameters:
swap - True: swap the drawing buffers after flushing. False: do nothing.

initCells

public abstract void initCells(javax.swing.JProgressBar jpb)
Initialize the split line hierarchies, including the axes and set the initial sizes.

Parameters:
jpb - A progressBar widget for displaying progress

getColorsForCellGeom

public abstract java.util.ArrayList getColorsForCellGeom(CellGeom c)
(TJ only) Get the list of possible colors for the given cell geometry

Parameters:
c - The object to draw, once we have the color
Returns:
An array of java.awt.Color objects that have priorities in drawing

doFlash

public abstract void doFlash()
Perform application-specific flash drawing.


drawPreContFrame

protected abstract void drawPreContFrame()
Perform application-specific pre-drawing before a continuing frame


drawPreNewFrame

protected abstract void drawPreNewFrame()
Perform application-specific pre-drawing before a scene starting frame


drawPostFrame

protected abstract void drawPostFrame()
Perform application-specific drawing after each frame


drawPostScene

protected abstract void drawPostScene()
Perform application-specific drawing after each a complete scene


seedQueue

protected abstract void seedQueue()
Seed the drawing queue, application specific


resetSplitValues

public abstract void resetSplitValues()
Reset split lines to application-specific values. May be non-uniform. For uniform resets, suitable in most applications, use resetGridUniform().


getMinCellDims

public double getMinCellDims(int xy)
Accesses the minimum cell dimensions in screen coordinates for the current block size. See minCellDims, this value could be fractional, but is usually 1 for single pixel blocks, or 5 for larger initial block sizes.

Parameters:
xy - Direction of interest, X or Y.
Returns:
minCellDims for the given xy direction.

setMinCellDims

public void setMinCellDims(int xy,
                           double is)
Sets the minimum cell dimensions in screen coordinates to the given block size. See minCellDims, this value could be fractional, but is usually 1 for single pixel blocks, or 5 for larger initial block sizes.

Parameters:
xy - Direction of interest, X or Y.
is - New minCellDims for the given xy direction.

getObjplane

public double getObjplane()
Accessor for the object plane, the depth in drawing for geometric objects.

Returns:
The value of objplane.

getLabelplane

public double getLabelplane()
Accessor for the label plane, the depth in drawing for object labels.

Returns:
The value of labelplane.

isDoingFlash

public boolean isDoingFlash()
State accessor for determining if flash drawing is active. Flash state is set before calling a redraw (no state may be passed to jogl specific drawing commands) and detected in the first stages of our drawing function, display(GLAutoDrawable).

Returns:
State of doingFlash.

getWinsize

public int getWinsize(int xy)
Accessor for the size of the drawing canvas, in pixels, in the given direction.

Parameters:
xy - Horizontal X or vertical Y direction.
Returns:
The size of the drawing canvas, as stored in winsize.

toggleDrawSplits

public void toggleDrawSplits()
Toggle for the state of drawing split lines. TODO: This state needs to be cleared with additional drawers as a new drawer will initially have this set to false, while a true setting in an existing drawer is not affected.


setDrawSplits

public void setDrawSplits(boolean on)
Set the state of split drawing, the drawing of all split lines with no culling.

Parameters:
on - The state to set the grid drawing value drawGrid.

getDrawnLabels

public java.util.ArrayList getDrawnLabels()
Return the list of drawn labels, stored in an array list.

Returns:
drawnLabels, the list of labels that are currently being displayed in the frame.

createBoxFromCells

protected InteractionBox createBoxFromCells(int stuckType)
Creates an interaction box with a given stuck line, if one has been chosen.

Parameters:
stuckType - See MIN_STUCK_X, MIN_STUCK_Y, MAX_STUCK_X, MAX_STUCK_Y.
Returns:
An interaction box with a movable stuck line. The next drag action will allow this line to move only.

createBoxFromCells

protected InteractionBox createBoxFromCells(int[] dragStart,
                                            int[] dragEnd)
Creates an interaction box from the drag motion input.

Parameters:
dragStart - X/Y coordinate of the starting position
dragEnd - X/Y coordinate of the ending position
Returns:
An interaction box from start to end corners around appropriate cell boundaries.

createRectFromPick

protected int[] createRectFromPick(InteractionBox stretchBox)
Make an InteractionBox from the GridCells nearest to the box of the mousedrag. Expects dragStart[X]/Y, dragEnd[X]/Y to be set. Positions are in pixels; where mouse started and is now while dragging.

Parameters:
stretchBox - Defined by 4 split lines (2 movable, 2 not) and is currently being resized.
Returns:
2 integers: pixel differences for movable lines in X and Y

moveStuckPosition

protected void moveStuckPosition(InteractionBox stretchBox)
Allows for the movement of the stuck lines, for user-directed control of the accordion drawing boundaries. X/Y determined by setting the split line for the input interaction box to the same value (if basebox.maxline(X) == basebox.minline(X), then we move X) MIN/MAX determined by setting the split line to either minstuck or maxstuck.

Parameters:
stretchBox - Box that defines the stuck line to be moved, the X or the Y, MIN or MAX stuck position.

getToDrawQ

public java.util.Vector getToDrawQ()
Accessor for the drawing queue.

Returns:
Vector that represents the drawing queue, ToDrawQ

getSplitAxis

public SplitAxis getSplitAxis(int xy)
Accessor for split axes, X X or Y Y.

Returns:
SplitAxis for given direction from splitAxis.

incrementFrameNumber

public void incrementFrameNumber()
Adds 1 to the frame number.


getFlashBox

public InteractionBox getFlashBox()
Gets the flash box, the box that currently surrounds the highlighted node/region.

Returns:
An interaction box for flashBox.

getFlashCol

public java.awt.Color getFlashCol()
Gets the current flash color.

Returns:
Flash (mouse-over) color from flashCol.

drawText

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)
Draw text on jogl canvas, or write text layer to postscript file.

Parameters:
x - Horizontal position
y - Vertical postition
name - String to display at the given position
f - Font object used to display string
col - Color to draw the font objects
zplane - Height in the drawing plane to render the font
outlineColor - Color for the outside edge or background for each font object.

displayChanged

public void displayChanged(javax.media.opengl.GLAutoDrawable drawable,
                           boolean modeChanged,
                           boolean deviceChanged)
JOGL canvas function for updating the display. This function is only called by the event handler, which initializes all parameters. AD does a complete redraw, after clearing the canvas.

Specified by:
displayChanged in interface javax.media.opengl.GLEventListener
Parameters:
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 redraw
deviceChanged - Unused in implementation, we do a complete redraw

flashDraw

public abstract void flashDraw()
"Real" flash drawing code, down-called from the high-level abstract drawing sequence.


getCanvas

public javax.media.opengl.GLCanvas getCanvas()
Accessor for the jogl canvas object.

Returns:
Returns the canvas object canvas.

saveScreenShot

public void saveScreenShot(java.io.File file)
Saves a screen shot of current GL frame to the specified file. The extension of the file determines what type of file is created. Supported formats include: tiff (tif) jpeg (jpg) png (png) gif (gif)

Parameters:
file - Java File object specifying file to write the output to.

doSnapshot

public static void doSnapshot(java.util.ArrayList drawers)
Wrapper for starting a snapshot (postscript) output. Opens a file dialog for saving. 3 stages: 1) Draw the background objects (base). 2) Draw groups (group). 3) Draw text (text).

Parameters:
drawers - The list of drawers to export to eps (postscript). Each specific drawer type will require

gethiliteplane

public float gethiliteplane()
Accessor for the highlight plane.

Returns:
The current value of hiliteplane.