AccordionDrawer
Class GridCell

java.lang.Object
  |
  +--AccordionDrawer.GridCell
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
BinaryGridCell, LeafGridCell, QuadGridCell

public abstract class GridCell
extends java.lang.Object
implements java.lang.Comparable

A class representing a cell in the quad tree data structure A GridCell can have up to four (4) kid cells and may have a parent cell

Version:
Author:
Tamara Munzner, Serdar Tasiran
See Also:
AccordionDrawer, GridCell

Field Summary
 float area
           
 AccordionDrawer drawer
           
 int drewMarkedAttachedFrame
           
 int objmax
           
 int objmin
           
 int[] rowcol
          rowcol[0] = column, rowcol[1] = row.
 
Constructor Summary
GridCell(AccordionDrawer thedrawer, int thelevel, int therow, int thecol, boolean isQuad)
           
 
Method Summary
abstract  void addGeom(CellGeom g)
           
abstract  boolean bigEnough()
           
abstract  int compareTo(java.lang.Object o)
           
 void computePlaceThisFrame()
          Computes min[], max[], and splitPos, the minimum, maximum and split point coordinates for this GridCell in absolute window coordinates.
abstract  GridCell createCell(int level, int row, int col, boolean isQuad)
           
abstract  void draw()
          Draws this GridCell.
 void drawAttachedObjects()
           
abstract  void drawDescend()
           
abstract  boolean equals(java.lang.Object o)
           
 float getArea(boolean maybeCompute)
           
 int getAreaPix(boolean maybeCompute)
           
 CellGeom getCellGeomDummy()
           
 int getDrewMarkedAttachedFrame()
           
 java.util.ArrayList getGeoms()
           
 int getGeomsSize()
           
 int getLevel()
           
 float getMax(int xy, boolean maybeCompute)
           
 GridCell getMaxLine(int xy)
           
 int getMaxPix(int xy, boolean maybeCompute)
           
 float getMin(int xy, boolean maybeCompute)
           
 GridCell getMinLine(int xy)
           
 int getMinPix(int xy, boolean maybeCompute)
           
 int getObjMax()
           
 int getObjMin()
           
abstract  GridCell getParent()
           
 float getSize(int xy, boolean maybeCompute)
           
 int getSizeInPix(int xy, boolean maybeCompute)
           
 int getSplitPix(int xy, boolean maybeCompute)
           
 float getSplitPos(int xy, boolean maybeCompute)
           
static void incrementCountBBoxDraw()
           
 boolean isQuadTree()
           
 java.util.ArrayList pickAttached(int x, int y)
          Computes an ArrayList of features (CellGeom's, like TreeNode or TreeEdge) that are "picked", i.e., are around (x,y) in screen coordinates and are attached to this GridCell Recurses down the quadtree hierarchy, starting at this GridCell, until at least one picked object is found or the bottom of the hierarchy is reached.
 GridCell pickCell(int x, int y)
          Computes the lowest level visible GridCell picked (selected) by a click at (x,y)
abstract  GridCell pickDescend(int x, int y)
           
abstract  void possiblyEnqueue()
           
 java.lang.String print(int indent)
           
 void removeGeom(CellGeom g)
           
 void setCellGeomDummy(CellGeom geom)
           
abstract  void setChild(GridCell newChild, int row, int col)
           
 void setDrawBackground(boolean on)
           
 void setDrewMarkedAttachedFrame(int i)
           
 void setObjMax(int n)
           
 void setObjMin(int n)
           
abstract  void setParent(GridCell p)
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

objmin

public int objmin

objmax

public int objmax

area

public float area

rowcol

public int[] rowcol
rowcol[0] = column, rowcol[1] = row. We store these in array so that we can easily act on both using a loop, to avoid duplicated code.


drewMarkedAttachedFrame

public int drewMarkedAttachedFrame

drawer

public AccordionDrawer drawer
Constructor Detail

GridCell

public GridCell(AccordionDrawer thedrawer,
                int thelevel,
                int therow,
                int thecol,
                boolean isQuad)
Method Detail

getCellGeomDummy

public CellGeom getCellGeomDummy()

createCell

public abstract GridCell createCell(int level,
                                    int row,
                                    int col,
                                    boolean isQuad)

incrementCountBBoxDraw

public static void incrementCountBBoxDraw()

setChild

public abstract void setChild(GridCell newChild,
                              int row,
                              int col)

getParent

public abstract GridCell getParent()

setParent

public abstract void setParent(GridCell p)

setDrawBackground

public void setDrawBackground(boolean on)

computePlaceThisFrame

public void computePlaceThisFrame()
Computes min[], max[], and splitPos, the minimum, maximum and split point coordinates for this GridCell in absolute window coordinates. Absolute coordinates are computed hierarchically from the relative position of the splits. Values computed are minimum boundary, maximum boundary, split position, and area. All these are computed in both window and screen coordinates. All these fields should never be accessed directly, only through the "get" access functions, so that this computation takes place when needed. This data is updated only if it is stale, it is cached for the duration of a frame. The current frame number (frameNum) is the determiner of staleness, recompute whenever it's incremented. Note that incrementing can happen based in internal computation, not just an actual frame boundary visible to the user.


getMin

public float getMin(int xy,
                    boolean maybeCompute)

getMax

public float getMax(int xy,
                    boolean maybeCompute)

getSize

public float getSize(int xy,
                     boolean maybeCompute)

getMaxPix

public int getMaxPix(int xy,
                     boolean maybeCompute)

getMinPix

public int getMinPix(int xy,
                     boolean maybeCompute)

getSizeInPix

public int getSizeInPix(int xy,
                        boolean maybeCompute)

getSplitPos

public float getSplitPos(int xy,
                         boolean maybeCompute)

getSplitPix

public int getSplitPix(int xy,
                       boolean maybeCompute)

getObjMin

public int getObjMin()

getObjMax

public int getObjMax()

setObjMin

public void setObjMin(int n)

setObjMax

public void setObjMax(int n)

getArea

public float getArea(boolean maybeCompute)

getAreaPix

public int getAreaPix(boolean maybeCompute)

getMinLine

public GridCell getMinLine(int xy)

getMaxLine

public GridCell getMaxLine(int xy)

draw

public abstract void draw()
Draws this GridCell. We only draw a background box if we need to highlight something - no need to draw boxes in the true background color. we draw boxes for our children, not for ourself. don't draw if: a) we have no children at all. then we can't possibly need to be highlighted, there's nothing underneath to be missed. b) a child is enqueued. in this case it will eventually be reponsible for highlighting itself if need be. otherwise, if a child is too small to be enqueued, check if we need to draw a box for it, i.e., if there are any highlighted features enclosed by the child cell After we're done queueing and/or drawing child cells, we draw the features (objects) attached to this GridCell.


possiblyEnqueue

public abstract void possiblyEnqueue()

bigEnough

public abstract boolean bigEnough()

pickAttached

public java.util.ArrayList pickAttached(int x,
                                        int y)
Computes an ArrayList of features (CellGeom's, like TreeNode or TreeEdge) that are "picked", i.e., are around (x,y) in screen coordinates and are attached to this GridCell Recurses down the quadtree hierarchy, starting at this GridCell, until at least one picked object is found or the bottom of the hierarchy is reached.


drawDescend

public abstract void drawDescend()

pickCell

public GridCell pickCell(int x,
                         int y)
Computes the lowest level visible GridCell picked (selected) by a click at (x,y)


pickDescend

public abstract GridCell pickDescend(int x,
                                     int y)

drawAttachedObjects

public void drawAttachedObjects()

addGeom

public abstract void addGeom(CellGeom g)

removeGeom

public void removeGeom(CellGeom g)

getGeoms

public java.util.ArrayList getGeoms()

getGeomsSize

public int getGeomsSize()

compareTo

public abstract int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

equals

public abstract boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

print

public java.lang.String print(int indent)

isQuadTree

public boolean isQuadTree()
Returns:

getDrewMarkedAttachedFrame

public int getDrewMarkedAttachedFrame()
Returns:

setDrewMarkedAttachedFrame

public void setDrewMarkedAttachedFrame(int i)
Parameters:
i -

getLevel

public int getLevel()

setCellGeomDummy

public void setCellGeomDummy(CellGeom geom)
Parameters:
geom -