소스 검색

edit edges fix

dominik.rieder 7 년 전
부모
커밋
d1ddc68c29
2개의 변경된 파일18개의 추가작업 그리고 1개의 파일을 삭제
  1. 7 0
      src/ui/controller/SimulationManager.java
  2. 11 1
      src/ui/view/EditEdgesPopUp.java

+ 7 - 0
src/ui/controller/SimulationManager.java

@@ -559,6 +559,13 @@ public class SimulationManager {
 		return subNets;
 	}
 	
+	/**
+	 * Get broken Edges
+	 */
+	public ArrayList<CpsEdge> getBrokenEdges(){
+		return brokenEdges;
+	}
+	
 	/**
 	 * checks wether a given object is connected to an object inside the upperNode.
 	 * if yes, the state for the edge is changed in "connected" or "not connected"

+ 11 - 1
src/ui/view/EditEdgesPopUp.java

@@ -16,6 +16,7 @@ import javax.swing.JButton;
 import javax.swing.border.EmptyBorder;
 
 import classes.CpsEdge;
+import classes.SubNet;
 import ui.controller.Control;
 
 import java.awt.event.ActionListener;
@@ -192,9 +193,18 @@ public class EditEdgesPopUp extends JDialog {
 	 *            the Capacity
 	 */
 	public void changeForExisting(float cap) {
-		for (CpsEdge edge : controller.getModel().getEdgesOnCanvas()) {
+		for(SubNet sn: controller.getSimManager().getSubNets()){
+			for(CpsEdge edge: sn.getEdges()){
+				edge.setCapacity(cap);
+			}
+		}
+		for(CpsEdge edge: controller.getSimManager().getBrokenEdges()){
 			edge.setCapacity(cap);
 		}
+		/*
+		for (CpsEdge edge : controller.getModel().getEdgesOnCanvas()) {
+			edge.setCapacity(cap);
+		}*/
 		controller.calculateStateForCurrentTimeStep();
 		canvas.repaint();
 	}