|
@@ -126,7 +126,7 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
|
|
|
* the Model
|
|
|
* @param control
|
|
|
* the Controller
|
|
|
- * @param unitGraph
|
|
|
+ * @param unitGraph
|
|
|
*/
|
|
|
public UpperNodeCanvas(Model mod, Control control, UnitGraph unitGraph, CpsUpperNode UpperNode, String parentPath) {
|
|
|
toolTip = false;
|
|
@@ -145,7 +145,7 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
|
|
|
borderPos = (int) (50 + scalediv20 + scalediv20 + 10);
|
|
|
for (AbstractCpsObject cps : upperNode.getNodes()) {
|
|
|
if (cps.getPosition().x < model.getScaleDiv2() + borderPos + 5) {
|
|
|
- cps.setPosition(new Position(borderPos + 5+model.getScaleDiv2(), cps.getPosition().y));
|
|
|
+ cps.setPosition(new Position(borderPos + 5 + model.getScaleDiv2(), cps.getPosition().y));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -675,10 +675,23 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
|
|
|
obj = ed.getB();
|
|
|
}
|
|
|
if (obj != null) {
|
|
|
- g2.setColor(Color.BLUE);
|
|
|
+ if (ed.getFlow() == 0)
|
|
|
+ g2.setColor(Color.RED);
|
|
|
+ else
|
|
|
+ g2.setColor(Color.BLUE);
|
|
|
g2.drawLine(obj.getPosition().x, obj.getPosition().y, (borderPos >> 1),
|
|
|
- (int) (scalediv20 + 5 + (50 + scalediv20 + 10) * count)
|
|
|
- + 25);
|
|
|
+ (int) (scalediv20 + 5 + (50 + scalediv20 + 10) * count) + 25);
|
|
|
+ if (showedInformation[0]) {
|
|
|
+ if (ed.getConnected() == 0 || ed.getConnected() == 1) {
|
|
|
+ g2.drawString(ed.getFlow() + "/" + ed.getCapacity(),
|
|
|
+ (ed.getA().getPosition().x + ed.getB().getPosition().x) / 2,
|
|
|
+ (ed.getA().getPosition().y + ed.getB().getPosition().y) / 2);
|
|
|
+ } else {
|
|
|
+ g2.drawString("not connected",
|
|
|
+ (ed.getA().getPosition().x + ed.getB().getPosition().x) / 2,
|
|
|
+ (ed.getA().getPosition().y + ed.getB().getPosition().y) / 2);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -689,8 +702,7 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
|
|
|
if (g2.getColor() != Color.WHITE) {
|
|
|
g2.fillRect((int) ((borderPos >> 1) - 25 - scalediv20) - 3,
|
|
|
(int) (scalediv20 + 5 + (25 + scalediv20 + 10) * count - scalediv20) - 3,
|
|
|
- (int) (50 + ((scalediv20 + 3) * 2)),
|
|
|
- (int) (50 + ((scalediv20 + 3) * 2)));
|
|
|
+ (int) (50 + ((scalediv20 + 3) * 2)), (int) (50 + ((scalediv20 + 3) * 2)));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -712,15 +724,13 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
|
|
|
g2.setColor(Color.BLUE);
|
|
|
g2.fillRect((int) ((borderPos >> 1) - 25 - scalediv20),
|
|
|
(int) (scalediv20 + 5 + (50 + scalediv20 + 10) * count - scalediv20),
|
|
|
- (int) (50 + (scalediv20 * 2)),
|
|
|
- (int) (50 + (scalediv20 * 2)));
|
|
|
+ (int) (50 + (scalediv20 * 2)), (int) (50 + (scalediv20 * 2)));
|
|
|
} else if (cps instanceof HolonObject) {
|
|
|
g2.setColor(((HolonObject) cps).getColor());
|
|
|
|
|
|
g2.fillRect((int) ((borderPos >> 1) - 25 - scalediv20),
|
|
|
(int) (scalediv20 + 5 + (50 + scalediv20 + 10) * count - scalediv20),
|
|
|
- (int) (50 + (scalediv20 * 2)),
|
|
|
- (int) (50 + (scalediv20 * 2)));
|
|
|
+ (int) (50 + (scalediv20 * 2)), (int) (50 + (scalediv20 * 2)));
|
|
|
}
|
|
|
// draw image
|
|
|
File checkPath = new File(cps.getImage());
|
|
@@ -730,9 +740,8 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
|
|
|
img = new ImageIcon(this.getClass().getResource(cps.getImage())).getImage();
|
|
|
}
|
|
|
}
|
|
|
- g2.drawImage(img, (borderPos >> 1) - 25,
|
|
|
- (int) (scalediv20 + 5 + (50 + scalediv20 + 10) * count), 50,
|
|
|
- 50, null);
|
|
|
+ g2.drawImage(img, (borderPos >> 1) - 25, (int) (scalediv20 + 5 + (50 + scalediv20 + 10) * count), 50, 50,
|
|
|
+ null);
|
|
|
count++;
|
|
|
}
|
|
|
|