Skip to content

Commit

Permalink
Added description for point quad tree example
Browse files Browse the repository at this point in the history
  • Loading branch information
Jotschi committed May 8, 2011
1 parent 697f9ec commit 6a8b7d7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/main/java/at/jotschi/quadtree/point/PointNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,5 +211,6 @@ public void clear() {
node.clear();
}
elements.clear();
nodes.clear();
}
}
16 changes: 15 additions & 1 deletion src/test/java/at/jotschi/quadtree/RenderPointQuadTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ protected PointQuadTree<String> createQuadTree() {

@Override
protected void paintComponent(Graphics g) {
g.drawString(
"Left click to add new points. Right click to highlight all elements of a selected cell/node.",
100, 80);
PointNode<String> rootNode = tree.getRootNode();
drawCells(rootNode, g);
}
Expand Down Expand Up @@ -104,7 +107,18 @@ public void drawElements(PointNode node, Graphics g) {
}
}


public void keyReleased(KeyEvent e) {

if (e.getKeyCode() == 27) {
System.exit(10);
} else if (e.getKeyCode() == 67) {
log.debug("Invoking clearing of tree.");
tree.clear();
repaint();
}

}

public void mouseClicked(MouseEvent e) {

Point p = e.getPoint();
Expand Down

0 comments on commit 6a8b7d7

Please sign in to comment.