Переглянути джерело

#5 Thicker connecting lines: changed the size from 0-4 to 1-4

Kevin Trometer 7 роки тому
батько
коміт
eddf56bfbe

+ 3 - 3
src/ui/view/MyCanvas.java

@@ -445,7 +445,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 					if (con.getState()) {
 						g2.setColor(Color.GREEN);
 						if (con.getCapacity() != -1) {
-							g2.setStroke(new BasicStroke(Math.min((con.getFlow() / con.getCapacity() * 4), 4)));
+							g2.setStroke(new BasicStroke(Math.min(((con.getFlow() / con.getCapacity() * 3)+1), 4)));
 						}
 					} else {
 						g2.setColor(Color.RED);
@@ -490,7 +490,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 			g2.setColor(Color.BLUE);
 			for (CpsEdge con : model.getEdgesOnCanvas()) {
 				if (con.getFlow() <= con.getCapacity()) {
-					g2.setStroke(new BasicStroke(Math.min((con.getFlow() / con.getCapacity() * 4), 4)));
+					g2.setStroke(new BasicStroke(Math.min(((con.getFlow() / con.getCapacity() * 3)+1), 4)));
 				} else {
 					g2.setStroke(new BasicStroke(2));
 				}
@@ -531,7 +531,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 		} else if (edgeHighlight != null) {
 			g2.setColor(Color.BLUE);
 			if (edgeHighlight.getFlow() <= edgeHighlight.getCapacity()) {
-				g2.setStroke(new BasicStroke(Math.min((edgeHighlight.getFlow() / edgeHighlight.getCapacity() * 4), 4)));
+				g2.setStroke(new BasicStroke(Math.min(((edgeHighlight.getFlow() / edgeHighlight.getCapacity() * 3)+1), 4)));
 			} else {
 				g2.setStroke(new BasicStroke(2));
 			}

+ 0 - 2
src/ui/view/TimePanel.java

@@ -2,7 +2,6 @@ package ui.view;
 
 import java.awt.BorderLayout;
 import java.awt.Color;
-import java.awt.Dimension;
 import java.awt.FlowLayout;
 import java.awt.Image;
 import java.awt.event.ActionEvent;
@@ -14,7 +13,6 @@ import javax.swing.ImageIcon;
 import javax.swing.JButton;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
-import javax.swing.JSeparator;
 import javax.swing.JSlider;
 import javax.swing.JTextField;
 import javax.swing.Timer;

+ 3 - 3
src/ui/view/UpperNodeCanvas.java

@@ -484,7 +484,7 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 					if (con.getState()) {
 						g2.setColor(Color.GREEN);
 						if (con.getCapacity() != -1) {
-							g2.setStroke(new BasicStroke(Math.min((con.getFlow() / con.getCapacity() * 4), 4)));
+							g2.setStroke(new BasicStroke(Math.min(((con.getFlow() / con.getCapacity() * 3)+1), 4)));
 						}
 					} else {
 						g2.setColor(Color.RED);
@@ -529,7 +529,7 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 			g2.setColor(Color.BLUE);
 			for (CpsEdge con : upperNode.getNodeEdges()) {
 				if (con.getFlow() <= con.getCapacity()) {
-					g2.setStroke(new BasicStroke(Math.min((con.getFlow() / con.getCapacity() * 4), 4)));
+					g2.setStroke(new BasicStroke(Math.min((con.getFlow() / con.getCapacity() * 3)+1, 4)));
 				} else {
 					g2.setStroke(new BasicStroke(2));
 				}
@@ -570,7 +570,7 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 		} else if (edgeHighlight != null) {
 			g2.setColor(Color.BLUE);
 			if (edgeHighlight.getFlow() <= edgeHighlight.getCapacity()) {
-				g2.setStroke(new BasicStroke(Math.min((edgeHighlight.getFlow() / edgeHighlight.getCapacity() * 4), 4)));
+				g2.setStroke(new BasicStroke(Math.min((edgeHighlight.getFlow() / edgeHighlight.getCapacity() * 3)+1, 4)));
 			} else {
 				g2.setStroke(new BasicStroke(2));
 			}