|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.olduvai.accordiondrawer.AccordionDrawer
net.sourceforge.olduvai.treejuxtaposer.drawer.AccordionTreeDrawer
public abstract class AccordionTreeDrawer
An abstract class representing a multi-scale rectangular grid on which a tree consisting of horizontal and vertical line segments is drawn Fills in the fields of the abstract class AccordionDrawer based on information from the Tree class.
AccordionDrawer
,
AccordionTreeDrawerFinal
,
Tree
,
TreeNode
,
GridCell
Field Summary | |
---|---|
private int |
coloredNode
Index for colored node in getLeftMostNodes(TreeNode, TreeNode) . |
static int |
countDrawnFrame
Count of number of objects drawn for the current frame, benchmark. |
static int |
countDrawnScene
Count of number of objects drawn for the current scene, benchmark. |
static int |
cumFrameTime
Cumulative time for a frame, benchmark. |
protected int[] |
drawnlabelsize
width and height of last mouseover label drawn |
protected LabelBox |
flashLabelBox
Label box for the flash (mouse-over) drawing object |
static boolean |
fullyQualified
If true, all nodes will have fully qualified names. |
int |
internalDrawCount
Debugging value, for information of drawing efficiency. |
protected boolean |
labelAtLeaves
set to true when we want to draw labels only at the leaf level. |
protected int[] |
labelbuffer
Amount of space in X and Y (in pixels) that labels must be separated by. |
protected int[] |
labeloffset
Label offset for leaf nodes. |
protected java.nio.FloatBuffer |
labelPixels
framebuffer pixels from last mouseover label drawn |
int |
leafDrawCount
Debugging value, for information of drawing efficiency. |
protected int[] |
lineLength
Length of nodes for horizontal and vertical edges. |
protected java.nio.FloatBuffer[] |
linePixel
Drawing buffer for mouse-over drawing/undrawing. |
protected int[][] |
linePos
Location of tree edges (for flash drawing) that we are storing in linePixel |
int |
maxFontHeight
Maximum size of fonts. |
int |
minFontHeight
Minimum size of fonts. |
protected java.awt.Color |
objectColor
Default color for objects that aren't marked. |
int |
pickFuzz
Distance to an object in pixels that is close enough for a successful pick. |
float |
pixelDiv
Inverted block size: the minimum partition size is 1/pixelDiv, if a section of tree requires culling this matters. |
private double |
pixelSize
Size of block/pixel used for rendering. |
int |
popupFontHeight
Size of fonts for mouse-over highlighting. |
protected TreeNode |
rootNode
Root of the tree . |
Tree |
tree
Tree that is drawn in this drawer's canvas. |
private int |
uncoloredNode
Index for uncolored node in getLeftMostNodes(TreeNode, TreeNode) . |
Constructor Summary | |
---|---|
AccordionTreeDrawer(Tree t,
int w,
int h,
javax.swing.JProgressBar jpb)
Class constructor for new tree drawers. |
Method Summary | |
---|---|
void |
addToDrawQueue(java.lang.Object r)
Add an object ( RangeInTree , or TreeNode ) to the drawing queue AccordionDrawer#toDrawQ |
private void |
buildCells(javax.swing.JProgressBar jpb)
Build cells for each TreeNode. |
void |
decreaseLabelBuffer(int xy)
Decrement the size for the label buffer in the given axis by 1. |
void |
decreaseMaxFontHeight()
Decrement maximum font height by 1. |
void |
decreaseMinFontHeight()
Decrement minimum font height by 1. |
void |
doFlash()
Flash drawing wrapper, must be called for flash requests; flashDraw() is later called back within a drawing cycle. |
void |
drawGeom(CellGeom cg,
DrawableRange r)
Draws a geometric object (treenode here) within a containing cell A node is drawn when it's larger than some ratio of block value, as determined from the drawRange function, or when a node is marked individually, such as mouse over highlighting or single node marking |
protected void |
drawPostFrame()
Function that runs following a frame. |
protected void |
drawPostScene()
Function that runs following a scene's completion. |
protected void |
drawPreContFrame()
Function that runs before a frame that is being drawn for a continued scene. |
protected void |
drawPreNewFrame()
Function that runs prior to a new scene. |
void |
drawRange(DrawableRange r)
Draw a given range. |
void |
drawRange(SplitLine sl)
Stub function. |
protected void |
finalize()
Finalize function for this class, which calls shutdown() , and might not be necessary. |
void |
flashDraw()
Not to be called directly, only called by doFlash() via flag doingFlash that redirects
in a normal drawing call. |
javax.media.opengl.GLAutoDrawable |
getCanvasDrawable()
Canvas accessor. |
abstract java.util.ArrayList |
getColorsForRange(int min,
int max)
Get the list of colors for the given split line index range |
int |
getLabelBuffer(int xy)
Get the size for the label buffer in the given axis by 1. |
TreeNode |
getLeaf(int leafNum)
Get the leaf indexed by the input value. |
private TreeNode[] |
getLeftMostNodes(TreeNode minChild,
TreeNode maxChild)
Get the "left most nodes". |
java.util.TreeSet |
getListOfLeaves()
Get the list of leaves, as determined by the visible (drawing) set from the partition list of split axis Y. |
int |
getMaxFontHeight()
Get the current maximum font height. |
private StaticSplitLine |
getMaxLineX(java.util.ArrayList children)
Helper function for buildCells(JProgressBar) . |
int |
getMinFontHeight()
Get the current minimum font height. |
TreeNode |
getNodeByKey(int key)
Node access by node key. |
TreeNode |
getNodeByName(java.lang.String name)
Node access by node name. |
java.awt.Color |
getObjectColor()
Get the objectColor . |
abstract RangeList |
getRangeByKey(int key)
Get a range list by the given key. |
Tree |
getTree()
Get the tree that this drawer represents. |
void |
increaseLabelBuffer(int xy)
Increment the size for the label buffer in the given axis by 1. |
void |
increaseMaxFontHeight()
Increment maximum font height by 1. |
void |
increaseMinFontHeight()
Increment minimum font height by 1. |
void |
initCells(javax.swing.JProgressBar jpb)
Initializes split lines, and builds cells for each tree node. |
InteractionBox |
makeBox(CellGeom cg)
Create box enclosing the subtree beneath input node/edge. |
CellGeom |
pickGeom(int x,
int y)
Pick the object at the given X/Y pixel location. |
protected void |
preDraw(javax.media.opengl.GLAutoDrawable canvas)
Stub function. |
void |
resetSplitValues()
Stub function. |
void |
setLabelBuffer(int buffer)
Set the size for the label buffer in both axes. |
void |
setLabelBuffer(int buffer,
int xy)
Set the size for the label buffer in the given axis. |
void |
setMaxFontHeight(int fontheight)
Set the maximum font height to the given value. |
void |
setMinFontHeight(int fontheight)
Set the minimum font height to the given value. |
void |
setObjectColor(java.awt.Color objectColor)
Set the objectColor . |
void |
shutdown()
Clear the objects initiated in ATD. |
private void |
updateMinLineX(java.util.ArrayList children,
StaticSplitLine newMinLine)
Helper function for buildCells(JProgressBar) . |
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 |
---|
protected int[] labeloffset
protected int[] labelbuffer
public final float pixelDiv
protected java.nio.FloatBuffer labelPixels
protected LabelBox flashLabelBox
protected java.nio.FloatBuffer[] linePixel
protected int[] lineLength
protected int[][] linePos
linePixel
protected int[] drawnlabelsize
public int minFontHeight
public int maxFontHeight
public int popupFontHeight
public int pickFuzz
protected boolean labelAtLeaves
public Tree tree
protected TreeNode rootNode
tree
.
public static boolean fullyQualified
public static int countDrawnFrame
public static int countDrawnScene
public static int cumFrameTime
protected java.awt.Color objectColor
public int leafDrawCount
public int internalDrawCount
private double pixelSize
private final int uncoloredNode
getLeftMostNodes(TreeNode, TreeNode)
.
private final int coloredNode
getLeftMostNodes(TreeNode, TreeNode)
.
Constructor Detail |
---|
public AccordionTreeDrawer(Tree t, int w, int h, javax.swing.JProgressBar jpb)
initCells(JProgressBar)
.
t
- Tree to be drawn on the drawer's canvas.w
- width of canvas, in pixels.h
- height of canvas, in pixels.jpb
- Progress bar.Method Detail |
---|
public void shutdown()
shutdown
in class AccordionDrawer
protected void finalize() throws java.lang.Throwable
shutdown()
, and might not be necessary.
finalize
in class AccordionDrawer
java.lang.Throwable
private StaticSplitLine getMaxLineX(java.util.ArrayList children)
buildCells(JProgressBar)
.
Get the maxline for the parent of the given list of children.
Children are later extended to reach the same line if they are not the closest to the root.
private void updateMinLineX(java.util.ArrayList children, StaticSplitLine newMinLine)
buildCells(JProgressBar)
.
Extends the child minlines (leftmost split line) to reach its parent.
children
- Child listnewMinLine
- new minimum X split line for each tree node in the child listprivate void buildCells(javax.swing.JProgressBar jpb)
jpb
- progress barpublic void initCells(javax.swing.JProgressBar jpb)
initCells
in class AccordionDrawer
jpb
- progress bar.public CellGeom pickGeom(int x, int y)
pickGeom
in class AccordionDrawer
x
- horizontal location of cursor, in screen spacey
- vertical location of cursor, in screen space
TreeNode.pickDescend(double, double, double, double)
.public InteractionBox makeBox(CellGeom cg)
cg
- TreeNode to act upon, passed in as CellGeom from
AccordionDrawer (where TreeNodes are not known)InteractionBox
public void doFlash()
flashDraw()
is later called back within a drawing cycle.
On mouseover, flash the object under the mouse and draw its
label at maximum size.
doFlash
in class AccordionDrawer
GridCell
,
Tree
,
TreeNode
public void flashDraw()
doFlash()
via flag doingFlash that redirects
in a normal drawing call.
Flash drawing function, called from within the display function.
order matters: 1) undraw old box 2) redraw old pixels
3) save new overdrawn pixels 4) draw flash box
flashDraw
in class AccordionDrawer
protected void drawPreNewFrame()
drawPreNewFrame
in class AccordionDrawer
protected void drawPreContFrame()
drawPreContFrame
in class AccordionDrawer
protected void drawPostScene()
drawPostScene
in class AccordionDrawer
protected void drawPostFrame()
drawPostFrame
in class AccordionDrawer
public Tree getTree()
tree
.public javax.media.opengl.GLAutoDrawable getCanvasDrawable()
public TreeNode getNodeByKey(int key)
key
- key for node of interest.
public TreeNode getNodeByName(java.lang.String name)
name
- name/label for node of interest
public int getLabelBuffer(int xy)
xy
- X or Y (0/horizontal,1/vertical) axis.public void setLabelBuffer(int buffer)
buffer
- new buffer amount, in pixels.public void setLabelBuffer(int buffer, int xy)
buffer
- new buffer amount, in pixels.xy
- X or Y (0/horizontal,1/vertical) axis.public void increaseLabelBuffer(int xy)
xy
- X or Y (0/horizontal,1/vertical) axis.public void decreaseLabelBuffer(int xy)
xy
- X or Y (0/horizontal,1/vertical) axis.public int getMaxFontHeight()
maxFontHeight
.public void setMaxFontHeight(int fontheight)
fontheight
- new value for maxFontHeight
.public void increaseMaxFontHeight()
public void decreaseMaxFontHeight()
public int getMinFontHeight()
minFontHeight
.public void setMinFontHeight(int fontheight)
fontheight
- new value for minFontHeight
.public void increaseMinFontHeight()
public void decreaseMinFontHeight()
public java.awt.Color getObjectColor()
objectColor
.
objectColor
.public void setObjectColor(java.awt.Color objectColor)
objectColor
.
objectColor
- new value of objectColor
.public void drawGeom(CellGeom cg, DrawableRange r)
drawGeom
in class AccordionDrawer
cg
- The treenode to drawr
- The drawable range that the tree node is in, for directing the descent to a proper leaf in range.private TreeNode[] getLeftMostNodes(TreeNode minChild, TreeNode maxChild)
minChild
- minimum tree node in the block range, a leaf.maxChild
- maximum tree node in the block range, a leaf.
public void drawRange(DrawableRange r)
drawRange
in class AccordionDrawer
r
- Range object to be drawn.public void drawRange(SplitLine sl)
drawRange
in class AccordionDrawer
sl
- The SplitLine
object to retrieve boundaries.public void addToDrawQueue(java.lang.Object r)
RangeInTree
, or TreeNode
) to the drawing queue AccordionDrawer#toDrawQ
r
- Object to add. RangeInTree objects are converted into split line ranges before insertion, TreeNodes are added directly.public abstract java.util.ArrayList getColorsForRange(int min, int max)
min
- start of range to get colors for.max
- end of range to get colors for.
public abstract RangeList getRangeByKey(int key)
key
- index into the list of ranges, aka the group number (like marked groups or difference groups)public TreeNode getLeaf(int leafNum)
leafNum
- leaf index.
public java.util.TreeSet getListOfLeaves()
public void resetSplitValues()
resetSplitValues
in class AccordionDrawer
protected void preDraw(javax.media.opengl.GLAutoDrawable canvas)
preDraw
in class AccordionDrawer
canvas
- The canvas object for this drawer.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |