|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectks.common.view.RectangleHierarchy
Manages a Tree of rectangles that represent the non-widget elements on the container.
Assuming an outer boundary rectangle (x,y,width,height), this class keeps track of 'negative space' assuming that each inserted rectangle represents 'positive space'.
For example, given the root (x,y,width,height) and the rectangle (u,v,l,m) is inserted, this node has four children R0, R1, R2, R3.
R0 = (x,y,width,v-y) ;; top horizontal slice
R1 = (x,v,u-1,m) ;; rectangle slice to the left of the
;; inserted rectangle
R2 = (u+m,v,width-m-(u-x)) ;; rectangle slice to the right of the
;; inserted rectangle
R3 = (x,v+m,width,height-m-(v-y)) ;; bottom horizontal slice.
insert (Rectangle r) is a recursive method, enabling partialling intersecting rectangles to be modeled.
Constructor Summary | |
RectangleHierarchy(java.awt.Rectangle initialBounds)
RectangleHierarchy constructor. |
Method Summary | |
void |
accept(RectangleHierarchyVisitor visitor)
Accept visitor and use double dispatching to pass ourselves in as a parameter to the visitor. |
void |
accept(RectangleHierarchyVisitor visitor,
java.awt.Rectangle clip)
Accept visitor and use double dispatching to pass ourselves in as a parameter to the visitor. |
java.awt.Rectangle |
getBounds()
Return bounds of this node. |
RectangleHierarchy[] |
getChildren()
Return all children of the given node in array (or null if there are no children). |
boolean |
insert(java.awt.Rectangle r)
Insert the given rectangle into the hierarchy. |
java.lang.String |
toString()
Convert to String the hierarchy root Rectangle. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public RectangleHierarchy(java.awt.Rectangle initialBounds)
Method Detail |
public void accept(RectangleHierarchyVisitor visitor)
visitor
- ks.common.view.RectangleHierarchyVisitorpublic void accept(RectangleHierarchyVisitor visitor, java.awt.Rectangle clip)
Clip all drawing to this clip Rect. [clip is unaffected by this invocation.]
visitor
- ks.common.view.RectangleHierarchyVisitorclip
- Rectanglepublic java.awt.Rectangle getBounds()
The rectangle returned is the actual rectangle. DO NOT MODIFY THIS OBJECT.
public RectangleHierarchy[] getChildren()
public boolean insert(java.awt.Rectangle r)
The rectangle represents the bounds of a widget. We essentially need to model the other portions that remain as rectangles. Consider the widget as positive space; the RectangleHierarchy models the negative space.
r
- Rectangle
public java.lang.String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |