Bläddra i källkod

Length Update,

Tom 5 år sedan
förälder
incheckning
432895fe28

+ 14 - 0
src/classes/CpsEdge.java

@@ -24,6 +24,20 @@ public class CpsEdge {
     AbstractCpsObject a;
     // Destination
     AbstractCpsObject b;
+    
+    
+    
+    
+    
+    /**
+     * Getter for the length of the Cable.
+     * Always calculate never saved.
+     * Needs to be profiled whats better.
+     * @return
+     */
+    public float getLength() {
+    	return (float)a.getPosition().Distance(b.getPosition());
+    }
 
     @Expose
     private boolean breakedManuel = false;

+ 1 - 1
src/classes/HolonObject.java

@@ -6,7 +6,7 @@ import ui.controller.FlexManager;
 
 import java.util.ArrayList;
 
-
+
 
 /**
  * The class HolonObject represents any Object on the system which capability of

+ 1 - 1
src/ui/controller/SimulationManager.java

@@ -29,7 +29,7 @@ import java.util.List;
 import java.util.ListIterator;
 
 import javax.swing.JPanel;
-
+
 
 /**
  * Controller for Simulation.

+ 1 - 1
src/ui/controller/UpdateController.java

@@ -448,7 +448,7 @@ public class UpdateController {
 			Object[] tempCapacity = { Languages.getLanguage()[81], model.getSelectedEdge().getCapacity() };
 			model.getPropertyTable().addRow(tempCapacity);
 			// Status displayed
-            Object[] tempStatus = {Languages.getLanguage()[82], ""};
+            Object[] tempStatus = {"Length", model.getSelectedEdge().getLength() };
             model.getPropertyTable().addRow(tempStatus);
             // For edges, the only possible editable cell is the max
 			// flow

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

@@ -26,7 +26,7 @@ public class AddElementPopUp extends JDialog {
 	private static final long serialVersionUID = 1L;
 	/* Data */
 	/** Holon Object the Element should be added to */
-	private AbstractCpsObject tempCps;
+	private AbstractCpsObject tempCps;
 	/** Holon Element that should be edited (if in edit Modus */
 	private HolonElement hl;
 	
@@ -45,7 +45,7 @@ public class AddElementPopUp extends JDialog {
 	private JTextField flexibleEnergy;
 	/** Flexible if checkbox is checked */
 	JCheckBox checkboxFlexible;
-	/** Model which is used */
+	/** Model which is used */
 	private Model model;
 
 	/**
@@ -220,4 +220,4 @@ public class AddElementPopUp extends JDialog {
 			elementName.setBackground(new Color(255, 50, 50));
 		}
 	}
-}
+}

+ 2 - 2
src/ui/view/GUI.java

@@ -212,7 +212,7 @@ public class GUI implements CategoryListener {
 	private final JPanel panel = new JPanel();
 	private final JPanel panelHolonEl = new JPanel();
 	// Buttons
-
+
 	private final JButton btnAdd = new JButton("New");
 	private final JPopupMenu btnAddPopUp = new JPopupMenu("New");
 	private final JMenuItem mItemNew = new JMenuItem("New..");
@@ -224,7 +224,7 @@ public class GUI implements CategoryListener {
 	private final JButton btnAddHolEL = new JButton("New Element");
 	private final JButton btnDelHolEL = new JButton("Delete Element");
 	private final JButton resetGraphBtn = new JButton("Reset");
-
+
 	private final JToolBar toolBar = new JToolBar();
 	private final JToolBar toolBarHolonEl = new JToolBar();
 	private final JToolBar toolBarGraph = new JToolBar();