|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.olduvai.accordiondrawer.InteractionBox
public class InteractionBox
Draw and cache information about an onscreen rubberband box. Because we need to draw exactly this box again to erase it in XOR mode, we must cache the corner points instead of looking them up dynamically.
GridCell
Field Summary | |
---|---|
private java.awt.Color |
col
Outline color of interaction box |
private AccordionDrawer |
d
The drawer for this interaction box. |
int[] |
dragEnd
Store where the interaction box drag ends in the interaction box |
int[] |
dragStart
Store where the interaction box drag starts in the interaction box |
CellGeom |
item
The item that is contained in the interaction box, if applicable |
private float |
linewidth
Width of lines used to draw an interaction box |
private SplitLine[] |
maxLine
Bounding box max lines, later assigned to either stuckLines or moveLines after drag starts. |
private SplitLine[] |
minLine
Bounding box min lines, later assigned to either stuckLines or moveLines after drag starts. |
SplitLine[] |
moveLines
Moving split lines set when starting drag |
int[] |
oldDragEnd
Store where the previous interaction box drag ended in the interaction box |
int[] |
originalMovePixelPosition
Store where the interaction box drag starts/ends in the interaction box |
private float |
plane
Drawing plane for the interaction box |
SplitLine[] |
stuckLines
Stuck split lines when starting drag |
private static int |
X
Redeclare X locally |
private static int |
Y
Redeclare Y locally |
Constructor Summary | |
---|---|
InteractionBox(SplitLine[] minSplit,
SplitLine[] maxSplit,
CellGeom item,
AccordionDrawer d)
Creates an interaction box with the given split lines, data object, and drawer |
Method Summary | |
---|---|
void |
draw(java.awt.Color col,
float linewidth,
float plane)
Set the color, plane height and line width, then draw the rubber band (interaction box outer ring) with those properties. |
void |
drawRubberband()
Rendering function for interaction boxes. |
int |
getMax(int xy)
Returns the pixel-position of the maximum split line in the given dimension. |
double |
getMaxAbs(int xy)
Get the screen space position of the maximum split line for a given dimension. |
int |
getMaxIndex(int xy)
Return the index of the maximum split line for a given dimension. |
SplitLine |
getMaxLine(int xy)
Get the actual maximum split line for a given dimension. |
int |
getMin(int xy)
Returns the pixel-position of the minimum split line in the given dimension. |
double |
getMinAbs(int xy)
Get the screen space position of the minimum split line for a given dimension. |
int |
getMinIndex(int xy)
Return the index of the minimum split line for a given dimension. |
SplitLine |
getMinLine(int xy)
Get the actual minimum split line for a given dimension. |
private boolean |
isMinLineMoving(int dragPosition,
int xy)
Determines if dragPosition (the starting drag value) is closer to min or max. |
void |
setDragPoints(int[] dragStart,
int[] dragEnd)
Sets the start and end drag point variables. |
java.lang.String |
toString()
Return the string representation of this interaction box. |
void |
undraw()
Similar to draw(Color, float, float) , but only draw the rubber band with drawRubberband() and the same set parameters, to undraw the previous interaction box. |
void |
updateDrag(int[] dragEnd)
Updates oldDragEnd with the previous value of dragEnd , and dragEnd with the new value passed in. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final int X
private static final int Y
private float linewidth
private java.awt.Color col
private float plane
public int[] dragStart
public int[] dragEnd
public int[] oldDragEnd
public int[] originalMovePixelPosition
public SplitLine[] stuckLines
public SplitLine[] moveLines
private SplitLine[] minLine
stuckLines
or moveLines
after drag starts.
private SplitLine[] maxLine
stuckLines
or moveLines
after drag starts.
public CellGeom item
private AccordionDrawer d
Constructor Detail |
---|
public InteractionBox(SplitLine[] minSplit, SplitLine[] maxSplit, CellGeom item, AccordionDrawer d)
minSplit
- Minimum splits in X
and Y
for this boxmaxSplit
- Maximum splits in X
and Y
for this boxitem
- Item that is attached to this interaction box, not requiredd
- Drawer for this interaction boxMethod Detail |
---|
public void setDragPoints(int[] dragStart, int[] dragEnd)
moveLines
, stuckLines
)
dragStart
- Determines which split line is moving and which is stuck, sets starting position of current drag.dragEnd
- Updates the ending position of the current drag.public void updateDrag(int[] dragEnd)
oldDragEnd
with the previous value of dragEnd
, and dragEnd
with the new value passed in.
Essentially this is setDragPoints(int[], int[])
but ignoring the drag start, which happens if the start is set to something other than -1.
dragEnd
- The new value for dragEnd
private boolean isMinLineMoving(int dragPosition, int xy)
dragPosition
- The position of the cursor to check for proximity to the min or max box linexy
- The direction of the cursor being checked
getMin(int)
than getMax(int)
public void draw(java.awt.Color col, float linewidth, float plane)
col
- Drawing color, XOR to the actual color (all drawRubberband()
painting is XOR draw to be reversable on subsequent draws)linewidth
- Line width, in pixelsplane
- Height of the drawing plane for the interaction boxpublic void undraw()
draw(Color, float, float)
, but only draw the rubber band with drawRubberband()
and the same set parameters, to undraw the previous interaction box.
public double getMinAbs(int xy)
xy
- Either X
or Y
.
minLine
in X or Y.public double getMaxAbs(int xy)
xy
- Either X
or Y
.
maxLine
in X or Y.public SplitLine getMinLine(int xy)
xy
- Either X
or Y
.
public SplitLine getMaxLine(int xy)
xy
- Either X
or Y
.
public int getMinIndex(int xy)
xy
- Either X
or Y
.
SplitAxis.getSplitIndex(SplitLine)
.public int getMaxIndex(int xy)
xy
- Either X
or Y
.
SplitAxis.getSplitIndex(SplitLine)
.public int getMin(int xy)
xy
- Either X
or Y
.
public int getMax(int xy)
xy
- Either X
or Y
.
public void drawRubberband()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |