Browse Source

Fixes small holes in the Link visualization ring

Andreas T. Meyer-Berg 6 years ago
parent
commit
22b592bf81

+ 3 - 3
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/view/VisualisationPanel.java

@@ -165,13 +165,13 @@ public class VisualisationPanel extends JPanel implements Observer {
 		/**
 		 * Angle per Link in "linkSlice degrees"
 		 */
-		int linkSlice = Math.min((int) Math.round(360.0 / numberOfLinks),90);
+		double linkSlice = Math.min(360.0 / numberOfLinks,90.0);
 		/**
 		 * Map of links to Colors and position of the Color
 		 */
 		HashMap<Link, Pair<Integer,Color>> linkColors = null;
 		/**
-		 * Dimension of the link ring
+		 * Dimension in pixels of the link ring
 		 */
 		int linkDim = 6;
 		
@@ -244,7 +244,7 @@ public class VisualisationPanel extends JPanel implements Observer {
 					g.setColor(linkPos.getRight());
 					g.fillArc(x - config.getDeviceVisualizationRadius() - linkDim, y - config.getDeviceVisualizationRadius() - linkDim,
 							2 * config.getDeviceVisualizationRadius() - 1 + 2 * linkDim, 2 * config.getDeviceVisualizationRadius() - 1 + 2*linkDim,
-							linkPos.getLeft()*linkSlice, linkSlice);
+							(int)Math.round(linkPos.getLeft()*linkSlice), (int)Math.ceil(linkSlice));
 				}
 			
 			}