Browse Source

GraphEdit

Tom Troppmann 6 years ago
parent
commit
3fd2d7520d
1 changed files with 22 additions and 5 deletions
  1. 22 5
      src/ui/view/UnitGraph.java

+ 22 - 5
src/ui/view/UnitGraph.java

@@ -61,7 +61,7 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 	private IGraphedElement current;
 	
 	//NEW ERA
-	
+	int dotSize = 8;
 	
 	
 
@@ -97,8 +97,9 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
         g2D.setColor(Color.BLACK);
         int höhe = this.getHeight();
         int breite = this.getWidth();
+        int punktGröße = 8;
         g2D.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON));
-        g2D.setStroke(new BasicStroke(1));
+        g2D.setStroke(new BasicStroke(2));
        // g2D.drawLine(0, 0,breite, höhe);
         //generate Path --> maybe als Methode auslagern
         
@@ -107,10 +108,21 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
         
         
         Path2D.Double mypath = new Path2D.Double();
-        mypath.moveTo(0, 0);
-        mypath.curveTo(breite, breite, breite, breite, breite, höhe);
+        
+        Position punktStart = new Position(+40,40);
+        Position punktEnd = new Position(breite-180,höhe-90);
+        //Werden Bestimmt
+        //Erster Punkt bleibt in Höhe gleich aber nimmt die Hälfte der Breite zu
+        
+        
+        mypath.moveTo(punktStart.x, punktStart.y);
+        double mitte = (punktStart.x + punktEnd.x)* 0.5;
+        mypath.curveTo(mitte, punktStart.y, mitte, punktEnd.y, punktEnd.x, punktEnd.y);
         
         g2D.draw(mypath);
+        g2D.setColor(Color.BLUE);
+        drawDot(g2D,punktStart);
+        drawDot(g2D,punktEnd);
 //        g2 = (Graphics2D) g;
 //        RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
 //        g2.setRenderingHints(rh);
@@ -294,7 +306,12 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 //                this.getHeight());
 //
 //        // algorithmus
-//        controller.calculateStateForTimeStep(model.getCurIteration());
+//        controller.calculateStateForTimeStep(model.getCurIteration()); 
+    }
+    
+    private void drawDot(Graphics2D g, Position p)
+    {    	
+    	g.fillOval(p.x -dotSize/2, p.y-dotSize/2, dotSize, dotSize);
     }
 
     @Override