Explorar el Código

Merge branch 'Ohne_Drag_and_Drop' of https://git.tk.informatik.tu-darmstadt.de/carlos.garcia/praktikum-holons into Ohne_Drag_and_Drop

Teh-Hai Julian Zheng hace 8 años
padre
commit
b9e0c4bcba
Se han modificado 1 ficheros con 17 adiciones y 23 borrados
  1. 17 23
      src/ui/view/UnitGraph.java

+ 17 - 23
src/ui/view/UnitGraph.java

@@ -77,27 +77,28 @@ class UnitGraph extends JPanel implements MouseListener, MouseMotionListener, Co
 		g2 = (Graphics2D) g;
 		RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
 		g2.setRenderingHints(rh);
-		g2.setStroke(new BasicStroke(1));
+		g2.setStroke(new BasicStroke(0));
 
 		graphCurve.reset();
 
 		// Draw the Vertical Lines
-		g2.setColor(new Color(240, 240, 240));
-		for (int i = 0; i < model.getIterations(); i++) {
+		g2.setColor(Color.BLACK);
+		for (int i = 0; i <= model.getIterations(); i++) {
 			g2.drawLine((i) * this.getWidth() / (model.getIterations() - 1), 0,
 					(i) * this.getWidth() / (model.getIterations() - 1), this.getHeight());
 		}
 
-		for (int i = 0; i < model.getIterations(); i++) {
+		for (int i = 0; i <= model.getIterations(); i++) {
 			g2.drawLine(0, (i) * this.getHeight() / (model.getIterations() - 1), this.getWidth(),
 					(i) * this.getHeight() / (model.getIterations() - 1));
 		}
 
 		if (arrayOfValue != null) {
-			//array fillen
+			// array fillen
 			fillArrayofValue();
 
 			// Draw the Lines
+			g2.setStroke(new BasicStroke(2));
 			g2.setColor(Color.BLACK);
 			for (int i = 0; i < pointList.size() - 1; i++) {
 				c = buildCurve(pointList.get(i), pointList.get(i + 1));
@@ -115,30 +116,24 @@ class UnitGraph extends JPanel implements MouseListener, MouseMotionListener, Co
 		}
 		// Iteration Line
 		g2.setColor(Color.BLUE);
+		g2.setStroke(new BasicStroke(1));
 		g2.drawLine((model.getCurIteration()) * this.getWidth() / (model.getIterations() - 1), 0,
 				(model.getCurIteration()) * this.getWidth() / (model.getIterations() - 1), this.getHeight());
 		// Iteration Value
 		if (arrayOfValue != null) {
-			if (model.getCurIteration() > model.getIterations() / 2) {
 				g2.drawString("" + arrayOfValue[model.getCurIteration()],
-						(model.getCurIteration()) * this.getWidth() / (model.getIterations() - 1) - 30,
-						this.getHeight() / 2);
-			} else {
-				g2.drawString("" + arrayOfValue[model.getCurIteration()],
-						(model.getCurIteration()) * this.getWidth() / (model.getIterations() - 1) + 2,
-						this.getHeight() / 2);
-			}
+						(model.getCurIteration()) * this.getWidth() / (model.getIterations() - 1) +2,
+						this.getHeight()-10);
 		}
-		// Actual Iteration Point Visualization
 
-		g2.setColor(Color.RED);
-		if (arrayOfValue != null) {
-			for (int i = 0; i < arrayOfValue.length; i++) {
-				g2.fillOval((int) (i * width / (model.getIterations() - 1) * scaleX - recSize.getX() / 2),
-						(int) (convertToCanvasY((int) arrayOfValue[i]) * scaleY - recSize.getY() / 2),
-						(int) recSize.getX(), (int) recSize.getY());
-			}
-		}
+		/*
+		 * // Actual Iteration Point Visualization g2.setColor(Color.RED); if
+		 * (arrayOfValue != null) { for (int i = 0; i < arrayOfValue.length;
+		 * i++) { g2.fillOval((int) (i * width / (model.getIterations() - 1) *
+		 * scaleX - recSize.getX() / 2), (int) (convertToCanvasY((int)
+		 * arrayOfValue[i]) * scaleY - recSize.getY() / 2), (int)
+		 * recSize.getX(), (int) recSize.getY()); } }
+		 */
 	}
 
 	@Override
@@ -163,7 +158,6 @@ class UnitGraph extends JPanel implements MouseListener, MouseMotionListener, Co
 			repaint();
 		}
 
-		
 	}
 
 	@Override