From bb39b6d3ead5ddadbced6cf3fd5fea79dee1f3e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Tue, 25 Jan 2022 09:18:56 +0100 Subject: [PATCH] fix model --- src/java/adecWatt/model/Embedded.java | 3 ++- src/java/adecWatt/model/unit/Workspace.java | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/java/adecWatt/model/Embedded.java b/src/java/adecWatt/model/Embedded.java index 06db360..2ca1e2e 100644 --- a/src/java/adecWatt/model/Embedded.java +++ b/src/java/adecWatt/model/Embedded.java @@ -119,7 +119,8 @@ public abstract class Embedded

, T extends Enum, if (visited.contains (this)) return; super.getLocalLink (visited, unitLinks, iconsLinks, imagesLinks); - model.getLocalLink (visited, unitLinks, iconsLinks, imagesLinks); + if (model != null) + model.getLocalLink (visited, unitLinks, iconsLinks, imagesLinks); } public boolean renameUnits (TreeMap translateMap) { diff --git a/src/java/adecWatt/model/unit/Workspace.java b/src/java/adecWatt/model/unit/Workspace.java index 099bb65..946fa0b 100644 --- a/src/java/adecWatt/model/unit/Workspace.java +++ b/src/java/adecWatt/model/unit/Workspace.java @@ -706,7 +706,17 @@ public abstract class Workspace extends Unit> { Circuits.CircuitState circuitState = circuits.getState (plugedComp, acc); if (circuitState == null) continue; - Acc.printCircuit (printGraphics, lineWidth, plugedComp.getAccCenter (acc.getId ()), circuitState); + Point2D c = plugedComp.getAccCenter (acc.getId ()); + // try { + // Comp endComp = (Comp) namedItems.get (acc.getConnectedTo ()); + // Point2D a = plugedComp.getAccCenter (acc.getId ()); + // Point2D b = endComp.getAccCenter (acc.getConnectedOn ()); + // c = new Point2D.Double ((1*a.getX ()+b.getX ())/2, (1*a.getY ()+b.getY ())/2); + // } catch (Exception e) { + // } + // XXX + //Acc.printCircuit (printGraphics, lineWidth, c, circuitState); + Acc.printCircuit (printGraphics, c, circuitState, .4); } }