浏览代码

final fix for editing edges

dominik.rieder 7 年之前
父节点
当前提交
3bc045f88b
共有 1 个文件被更改,包括 24 次插入2 次删除
  1. 24 2
      src/ui/view/EditEdgesPopUp.java

+ 24 - 2
src/ui/view/EditEdgesPopUp.java

@@ -15,7 +15,9 @@ import javax.swing.JTextField;
 import javax.swing.JButton;
 import javax.swing.border.EmptyBorder;
 
+import classes.AbstractCpsObject;
 import classes.CpsEdge;
+import classes.CpsUpperNode;
 import classes.SubNet;
 import ui.controller.Control;
 
@@ -193,6 +195,7 @@ public class EditEdgesPopUp extends JDialog {
 	 *            the Capacity
 	 */
 	public void changeForExisting(float cap) {
+		/*
 		for(SubNet sn: controller.getSimManager().getSubNets()){
 			for(CpsEdge edge: sn.getEdges()){
 				edge.setCapacity(cap);
@@ -201,13 +204,32 @@ public class EditEdgesPopUp extends JDialog {
 		for(CpsEdge edge: controller.getSimManager().getBrokenEdges()){
 			edge.setCapacity(cap);
 		}
-		/*
+		*/
 		for (CpsEdge edge : controller.getModel().getEdgesOnCanvas()) {
 			edge.setCapacity(cap);
-		}*/
+		}
+		for(AbstractCpsObject abs: controller.getModel().getObjectsOnCanvas()){
+			if(abs instanceof CpsUpperNode){
+				changeInUpperNode((CpsUpperNode)abs, cap);
+			}
+		}
 		controller.calculateStateForCurrentTimeStep();
 		canvas.repaint();
 	}
+	
+	public void changeInUpperNode(CpsUpperNode uN, float cap){
+		for(CpsEdge e: uN.getNodeEdges()){
+			e.setCapacity(cap);
+		}
+		for(CpsEdge e: uN.getOldEdges()){
+			e.setCapacity(cap);
+		}
+		for(AbstractCpsObject abs: uN.getNodes()){
+			if(abs instanceof CpsUpperNode){
+				changeInUpperNode((CpsUpperNode)abs, cap);
+			}
+		}
+	}
 
 	/**
 	 * Set the Capacity for all existing and new edges.