Skip to content

Commit

Permalink
Update maven settings and remove bogus code lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Jotschi committed Aug 31, 2014
1 parent 76d8a09 commit 956cd56
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
22 changes: 19 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@

<groupId>at.jotschi</groupId>
<artifactId>QuadTree</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>0.5.0-SNAPSHOT</version>
<packaging>jar</packaging>

<parent>
<groupId>de.jotschi</groupId>
<artifactId>oss-parent</artifactId>
<version>1.0.0</version>
</parent>

<name>QuadTree</name>
<url>http://maven.apache.org</url>

Expand All @@ -18,14 +24,24 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>

</dependencies>
<repositories>
<repository>
<id>maven.jotschi.de</id>
<url>http://maven.jotschi.de/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</project>
22 changes: 5 additions & 17 deletions src/test/java/at/jotschi/quadtree/RenderSpatialQuadTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ protected SpatialQuadTree<Image> createSpatialQuadTree() throws IOException {
Point startCoordinates = new Point(100, 100);
Dimension size = new Dimension(512, 512);

SpatialQuadTree<Image> tree = new SpatialQuadTree<Image>(
startCoordinates, size);
SpatialQuadTree<Image> tree = new SpatialQuadTree<Image>(startCoordinates, size);

int elementSize = 32;
for (int i = 0; i < 56; i++) {
Expand Down Expand Up @@ -89,14 +88,13 @@ public Image getRandomImage(int size) throws IOException {
int i = (int) (Math.random() * 4);
String fileName = types[i] + "_" + size + ".jpg";
log.debug("Loading image: " + fileName);
Image image = ImageIO.read(ClassLoader
.getSystemResourceAsStream(fileName));
Image image = ImageIO.read(ClassLoader.getSystemResourceAsStream(fileName));

return image;
}

protected void paintComponent(Graphics g) {

g.drawString("Hit space key to draw elements of the next level of the quadtree.", 100, 80);
SpatialNode<Image> rootNode = tree.getRootNode();
drawCells(rootNode, g);
Expand All @@ -106,8 +104,7 @@ protected void drawCells(SpatialNode<Image> node, Graphics g) {
Dimension bounds = node.getBounds();
Point startCoordinates = node.getStartCoordinates();
// Draw node bounds
g.drawRect(startCoordinates.x, startCoordinates.y, bounds.width,
bounds.height);
g.drawRect(startCoordinates.x, startCoordinates.y, bounds.width, bounds.height);

// Draw subnodes
Map<Cell, SpatialNode<Image>> subNodes = node.getSubNodes();
Expand Down Expand Up @@ -141,16 +138,7 @@ public void drawElements(SpatialNode<Image> node, Graphics g) {

SpatialNodeElement<Image> element = node.getElement();
if (element != null) {
// int i = (int) (Math.random() * 255);
// g.setColor(new Color(1, i, 1));

g.drawImage(element.getElement(), (int) element.getX(),
(int) element.getY(), null);
// g.drawImage(element.getElement(),element.getX(), (int)
// element.getY(),element.getWidth(), element.getHeight() ,null);
// g.fillRect((int) element.getX(), (int) element.getY(),
// element.getWidth(), element.getHeight());
// g.setColor(Color.BLACK);
g.drawImage(element.getElement(), (int) element.getX(), (int) element.getY(), null);
}

}
Expand Down
3 changes: 0 additions & 3 deletions src/test/java/at/jotschi/quadtree/gui/QuadTreePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Vector;

import javax.swing.JFrame;
import javax.swing.JPanel;

import org.apache.log4j.Logger;

import at.jotschi.quadtree.AbstractNodeElement;

@SuppressWarnings("serial")
public class QuadTreePanel extends JPanel implements KeyListener, MouseListener {

Expand Down

0 comments on commit 956cd56

Please sign in to comment.