From e785da40facd3fa6b96feeebeba204897b95e435 Mon Sep 17 00:00:00 2001 From: Lee <irina.lee@etu.upmc.fr> Date: Tue, 17 Jul 2018 22:04:04 +0200 Subject: [PATCH] fixed space (eln) --- .../ui/eln/sca_eln/ELNComponentCapacitor.java | 251 +++--- .../sca_eln/ELNComponentIdealTransformer.java | 614 +++++---------- .../ELNComponentIndependentCurrentSource.java | 390 ++++------ .../ELNComponentIndependentVoltageSource.java | 404 ++++------ .../ui/eln/sca_eln/ELNComponentInductor.java | 239 ++---- .../ui/eln/sca_eln/ELNComponentNodeRef.java | 77 +- .../ui/eln/sca_eln/ELNComponentResistor.java | 244 +++--- .../sca_eln/ELNComponentTransmissionLine.java | 402 ++++------ ...mponentVoltageControlledCurrentSource.java | 731 ++++++------------ ...mponentVoltageControlledVoltageSource.java | 725 ++++++----------- .../ELNComponentCurrentSinkTDF.java | 6 +- .../ELNComponentVoltageSinkTDF.java | 535 +++++-------- 12 files changed, 1589 insertions(+), 3029 deletions(-) diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentCapacitor.java b/src/main/java/ui/eln/sca_eln/ELNComponentCapacitor.java index b88e8d0682..4c85129e24 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentCapacitor.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentCapacitor.java @@ -51,15 +51,14 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** - * Class ELNComponentCapacitor Capacitor to be used in ELN diagrams Creation: - * 12/06/2018 - * + * Class ELNComponentCapacitor + * Capacitor to be used in ELN diagrams + * Creation: 12/06/2018 * @version 1.0 12/06/2018 * @author Irina Kit Yan LEE */ -public class ELNComponentCapacitor extends TGCScalableWithInternalComponent - implements ActionListener, SwallowedTGComponent, ELNComponent { +public class ELNComponentCapacitor extends TGCScalableWithInternalComponent implements ActionListener, SwallowedTGComponent, ELNComponent { protected Color myColor; protected int orientation; private int maxFontSize = 14; @@ -74,14 +73,11 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent private String unit0, unit1; private int position = 0; - private boolean fv_0_2 = false, fv_1_3 = false, fh_0_2 = false, - fh_1_3 = false; + private boolean fv_0_2 = false, fv_1_3 = false, fh_0_2 = false, fh_1_3 = false; private int old; private boolean first; - public ELNComponentCapacitor(int _x, int _y, int _minX, int _maxX, - int _minY, int _maxY, boolean _pos, TGComponent _father, - TDiagramPanel _tdp) { + public ELNComponentCapacitor(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); initScaling(100, 40); @@ -116,10 +112,8 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent public void initPortTerminal(int nb) { nbConnectingPoint = nb; connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "p"); - connectingPoint[1] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "n"); + connectingPoint[0] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "p"); + connectingPoint[1] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "n"); } public Color getMyColor() { @@ -133,10 +127,7 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent if (this.rescaled && !this.tdp.isScaled()) { this.rescaled = false; - int maxCurrentFontSize = Math.max( - 0, - Math.min(this.height, - (int) (this.maxFontSize * this.tdp.getZoom()))); + int maxCurrentFontSize = Math.max(0, Math.min(this.height, (int) (this.maxFontSize * this.tdp.getZoom()))); f = f.deriveFont((float) maxCurrentFontSize); while (maxCurrentFontSize > (this.minFontSize * this.tdp.getZoom() - 1)) { @@ -192,12 +183,10 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + height / 2 + height / 4 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height / 2 + height / 4 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + height / 2 + height / 4 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height / 2 + height / 4 + sh1); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -209,12 +198,10 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + height / 2 + height / 4 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height / 2 + height / 4 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + height / 2 + height / 4 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height / 2 + height / 4 + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -226,12 +213,10 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + height / 2 + height / 4 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height / 2 + height / 4 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + height / 2 + height / 4 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height / 2 + height / 4 + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -243,12 +228,10 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + height / 2 + height / 4 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height / 2 + height / 4 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + height / 2 + height / 4 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height / 2 + height / 4 + sh0); } } } else if (position == 1) { @@ -282,12 +265,9 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 4, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 4, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 4, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 4, + y + height + sh1); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -299,12 +279,9 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(0.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 4, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 4, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 4, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 4, + y + height + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -316,12 +293,9 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 4, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 4, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 4, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 4, + y + height + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -333,12 +307,9 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(0.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 4, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 4, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 4, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 4, + y + height + sh0); } } } else if (position == 2) { @@ -374,12 +345,10 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + height / 2 + height / 4 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height / 2 + height / 4 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + height / 2 + height / 4 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height / 2 + height / 4 + sh0); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -391,12 +360,10 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + height / 2 + height / 4 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height / 2 + height / 4 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + height / 2 + height / 4 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height / 2 + height / 4 + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -408,12 +375,10 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + height / 2 + height / 4 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height / 2 + height / 4 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + height / 2 + height / 4 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height / 2 + height / 4 + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -425,12 +390,10 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + height / 2 + height / 4 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height / 2 + height / 4 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + height / 2 + height / 4 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height / 2 + height / 4 + sh1); } } } else if (position == 3) { @@ -464,12 +427,9 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(0.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 4, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 4, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 4, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 4, + y + height + sh0); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -481,12 +441,9 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 4, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 4, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 4, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 4, + y + height + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -498,12 +455,9 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(0.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 4, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 4, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 4, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 4, + y + height + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -515,12 +469,9 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 4, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 4, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 4, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 4, + y + height + sh1); } } } @@ -530,49 +481,37 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent private void rotateTopBottom(Graphics g) { Color c = g.getColor(); - int[] ptx0 = { x, x + 2 * width / 5, x + 2 * width / 5, - x + 2 * width / 5, x + 2 * width / 5 }; - int[] pty0 = { y + height / 2, y + height / 2, y, y + height, - y + height / 2 }; + int[] ptx0 = { x, x + 2 * width / 5, x + 2 * width / 5, x + 2 * width / 5, x + 2 * width / 5 }; + int[] pty0 = { y + height / 2, y + height / 2, y, y + height, y + height / 2 }; g.drawPolygon(ptx0, pty0, 5); - int[] ptx1 = { x + width, x + 3 * width / 5, x + 3 * width / 5, - x + 3 * width / 5, x + 3 * width / 5 }; - int[] pty1 = { y + height / 2, y + height / 2, y, y + height, - y + height / 2 }; + int[] ptx1 = { x + width, x + 3 * width / 5, x + 3 * width / 5, x + 3 * width / 5, x + 3 * width / 5 }; + int[] pty1 = { y + height / 2, y + height / 2, y, y + height, y + height / 2 }; g.drawPolygon(ptx1, pty1, 5); g.drawOval(x, y + height / 2 - height / 8, width / 10, height / 4); g.setColor(Color.WHITE); g.fillOval(x, y + height / 2 - height / 8, width / 10, height / 4); g.setColor(c); - g.drawOval(x + width - width / 10, y + height / 2 - height / 8, - width / 10, height / 4); + g.drawOval(x + width - width / 10, y + height / 2 - height / 8, width / 10, height / 4); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 10, y + height / 2 - height / 8, - width / 10, height / 4); + g.fillOval(x + width - width / 10, y + height / 2 - height / 8, width / 10, height / 4); g.setColor(c); } private void rotateRightLeft(Graphics g) { Color c = g.getColor(); - int[] ptx0 = { x + width / 2, x + width / 2, x, x + width, - x + width / 2 }; - int[] pty0 = { y, y + 2 * height / 5, y + 2 * height / 5, - y + 2 * height / 5, y + 2 * height / 5 }; + int[] ptx0 = { x + width / 2, x + width / 2, x, x + width, x + width / 2 }; + int[] pty0 = { y, y + 2 * height / 5, y + 2 * height / 5, y + 2 * height / 5, y + 2 * height / 5 }; g.drawPolygon(ptx0, pty0, 5); - int[] ptx1 = { x + width / 2, x + width / 2, x, x + width, - x + width / 2 }; - int[] pty1 = { y + height, y + 3 * height / 5, y + 3 * height / 5, - y + 3 * height / 5, y + 3 * height / 5 }; + int[] ptx1 = { x + width / 2, x + width / 2, x, x + width, x + width / 2 }; + int[] pty1 = { y + height, y + 3 * height / 5, y + 3 * height / 5, y + 3 * height / 5, y + 3 * height / 5 }; g.drawPolygon(ptx1, pty1, 5); g.drawOval(x + width / 2 - width / 8, y, width / 4, height / 10); g.setColor(Color.WHITE); g.fillOval(x + width / 2 - width / 8, y, width / 4, height / 10); g.setColor(c); - g.drawOval(x + width / 2 - width / 8, y + height - height / 10, - width / 4, height / 10); + g.drawOval(x + width / 2 - width / 8, y + height - height / 10, width / 4, height / 10); g.setColor(Color.WHITE); - g.fillOval(x + width / 2 - width / 8, y + height - height / 10, - width / 4, height / 10); + g.fillOval(x + width / 2 - width / 8, y + height - height / 10, width / 4, height / 10); g.setColor(c); } @@ -588,8 +527,7 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent } public boolean editOndoubleClick(JFrame frame) { - JDialogELNComponentCapacitor jde = new JDialogELNComponentCapacitor( - this); + JDialogELNComponentCapacitor jde = new JDialogELNComponentCapacitor(this); jde.setVisible(true); return true; } @@ -630,8 +568,7 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent return new String(sb); } - public void loadExtraParam(NodeList nl, int decX, int decY, int decId) - throws MalformedModelingException { + public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException { try { NodeList nli; Node n1, n2; @@ -651,23 +588,16 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; if (elt.getTagName().equals("attributes")) { - value = Double.parseDouble(elt - .getAttribute("value")); + value = Double.parseDouble(elt.getAttribute("value")); q0 = Double.parseDouble(elt.getAttribute("q0")); unit0 = elt.getAttribute("unit0"); unit1 = elt.getAttribute("unit1"); - position = Integer.parseInt(elt - .getAttribute("position")); - fv_0_2 = Boolean.parseBoolean(elt - .getAttribute("fv_0_2")); - fv_1_3 = Boolean.parseBoolean(elt - .getAttribute("fv_1_3")); - fh_0_2 = Boolean.parseBoolean(elt - .getAttribute("fh_0_2")); - fh_1_3 = Boolean.parseBoolean(elt - .getAttribute("fh_1_3")); - first = Boolean.parseBoolean(elt - .getAttribute("first")); + position = Integer.parseInt(elt.getAttribute("position")); + fv_0_2 = Boolean.parseBoolean(elt.getAttribute("fv_0_2")); + fv_1_3 = Boolean.parseBoolean(elt.getAttribute("fv_1_3")); + fh_0_2 = Boolean.parseBoolean(elt.getAttribute("fh_0_2")); + fh_1_3 = Boolean.parseBoolean(elt.getAttribute("fh_1_3")); + first = Boolean.parseBoolean(elt.getAttribute("first")); setVal(value); setQ0(q0); setUnit0(unit0); @@ -688,8 +618,7 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent } } - public void addActionToPopupMenu(JPopupMenu componentMenu, - ActionListener menuAL, int x, int y) { + public void addActionToPopupMenu(JPopupMenu componentMenu, ActionListener menuAL, int x, int y) { componentMenu.addSeparator(); JMenuItem rotateright = new JMenuItem("Rotate right 90\u00b0"); @@ -844,8 +773,7 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent if ((father != null) && (father instanceof ELNModule)) { resizeToFatherSize(); - setCdRectangle(0, father.getWidth() - getWidth(), 0, - father.getHeight() - getHeight()); + setCdRectangle(0, father.getWidth() - getWidth(), 0, father.getHeight() - getHeight()); setMoveCd(x, y); } } @@ -858,7 +786,6 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent myColor = null; setFather(null); TDiagramPanel tdp = getTDiagramPanel(); - setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), - tdp.getMaxY()); + setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY()); } } \ No newline at end of file diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentIdealTransformer.java b/src/main/java/ui/eln/sca_eln/ELNComponentIdealTransformer.java index 7a613f6be3..bf9eb04dfa 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentIdealTransformer.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentIdealTransformer.java @@ -51,16 +51,14 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** - * Class ELNComponentIdealTransformer Ideal transformer to be used in ELN - * diagrams Creation: 13/06/2018 - * + * Class ELNComponentIdealTransformer + * Ideal transformer to be used in ELN diagrams + * Creation: 13/06/2018 * @version 1.0 13/06/2018 * @author Irina Kit Yan LEE */ -public class ELNComponentIdealTransformer extends - TGCScalableWithInternalComponent implements ActionListener, - SwallowedTGComponent, ELNComponent { +public class ELNComponentIdealTransformer extends TGCScalableWithInternalComponent implements ActionListener, SwallowedTGComponent, ELNComponent { protected Color myColor; protected int orientation; private int maxFontSize = 14; @@ -74,14 +72,11 @@ public class ELNComponentIdealTransformer extends private double ratio; private int position = 0; - private boolean fv_0_2 = false, fv_1_3 = false, fh_0_2 = false, - fh_1_3 = false; + private boolean fv_0_2 = false, fv_1_3 = false, fh_0_2 = false, fh_1_3 = false; private int old; private boolean first; - public ELNComponentIdealTransformer(int _x, int _y, int _minX, int _maxX, - int _minY, int _maxY, boolean _pos, TGComponent _father, - TDiagramPanel _tdp) { + public ELNComponentIdealTransformer(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); initScaling(100, 100); @@ -113,14 +108,10 @@ public class ELNComponentIdealTransformer extends public void initPortTerminal(int nb) { nbConnectingPoint = nb; connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "p1"); - connectingPoint[1] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "p2"); - connectingPoint[2] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "n1"); - connectingPoint[3] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "n2"); + connectingPoint[0] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "p1"); + connectingPoint[1] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "p2"); + connectingPoint[2] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "n1"); + connectingPoint[3] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "n2"); } public Color getMyColor() { @@ -134,10 +125,7 @@ public class ELNComponentIdealTransformer extends if (this.rescaled && !this.tdp.isScaled()) { this.rescaled = false; - int maxCurrentFontSize = Math.max( - 0, - Math.min(this.height, - (int) (this.maxFontSize * this.tdp.getZoom()))); + int maxCurrentFontSize = Math.max(0, Math.min(this.height, (int) (this.maxFontSize * this.tdp.getZoom()))); f = f.deriveFont((float) maxCurrentFontSize); while (maxCurrentFontSize > (this.minFontSize * this.tdp.getZoom() - 1)) { @@ -200,18 +188,12 @@ public class ELNComponentIdealTransformer extends ((ELNPortTerminal) connectingPoint[3]).setW(1.0); ((ELNPortTerminal) connectingPoint[3]).setH(19.0 / 20.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y - height / 20); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y - height / 20); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - sw2, y + height + height / 20 + sh2); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width, y + height + height / 20 + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, y - height / 20); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, y - height / 20); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - sw2, + y + height + height / 20 + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width, + y + height + height / 20 + sh3); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -228,18 +210,12 @@ public class ELNComponentIdealTransformer extends ((ELNPortTerminal) connectingPoint[2]).setW(1.0); ((ELNPortTerminal) connectingPoint[2]).setH(19.0 / 20.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y - height / 20); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y - height / 20); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - sw3, y + height + height / 20 + sh3); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width, y + height + height / 20 + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, y - height / 20); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, y - height / 20); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - sw3, + y + height + height / 20 + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width, + y + height + height / 20 + sh2); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -256,18 +232,12 @@ public class ELNComponentIdealTransformer extends ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(19.0 / 20.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - sw2, y - height / 20); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width, y - height / 20); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + height + height / 20 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height + height / 20 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - sw2, y - height / 20); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width, y - height / 20); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + height + height / 20 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height + height / 20 + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -284,18 +254,12 @@ public class ELNComponentIdealTransformer extends ((ELNPortTerminal) connectingPoint[0]).setW(1.0); ((ELNPortTerminal) connectingPoint[0]).setH(19.0 / 20.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - sw3, y - height / 20); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width, y - height / 20); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + height + height / 20 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height + height / 20 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - sw3, y - height / 20); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width, y - height / 20); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + height + height / 20 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height + height / 20 + sh0); } } } else if (position == 1) { @@ -338,18 +302,12 @@ public class ELNComponentIdealTransformer extends ((ELNPortTerminal) connectingPoint[1]).setW(19.0 / 20.0); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - width / 20 - sw2, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width + width / 20, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - width / 20 - sw3, y + height + sh3); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width + width / 20, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - width / 20 - sw2, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width + width / 20, y); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - width / 20 - sw3, + y + height + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width + width / 20, + y + height + sh1); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -366,18 +324,12 @@ public class ELNComponentIdealTransformer extends ((ELNPortTerminal) connectingPoint[0]).setW(19.0 / 20.0); ((ELNPortTerminal) connectingPoint[0]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - width / 20 - sw3, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width + width / 20, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - width / 20 - sw2, y + height + sh2); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width + width / 20, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - width / 20 - sw3, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width + width / 20, y); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - width / 20 - sw2, + y + height + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width + width / 20, + y + height + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -394,18 +346,12 @@ public class ELNComponentIdealTransformer extends ((ELNPortTerminal) connectingPoint[3]).setW(19.0 / 20.0); ((ELNPortTerminal) connectingPoint[3]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - width / 20 - sw0, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width + width / 20, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - width / 20 - sw1, y + height + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width + width / 20, y + height + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - width / 20 - sw0, y); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width + width / 20, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - width / 20 - sw1, + y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width + width / 20, + y + height + sh3); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -422,18 +368,12 @@ public class ELNComponentIdealTransformer extends ((ELNPortTerminal) connectingPoint[2]).setW(19.0 / 20.0); ((ELNPortTerminal) connectingPoint[2]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - width / 20 - sw1, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width + width / 20, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - width / 20 - sw0, y + height + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width + width / 20, y + height + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - width / 20 - sw1, y); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width + width / 20, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - width / 20 - sw0, + y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width + width / 20, + y + height + sh2); } } } else if (position == 2) { @@ -476,18 +416,12 @@ public class ELNComponentIdealTransformer extends ((ELNPortTerminal) connectingPoint[0]).setW(1.0); ((ELNPortTerminal) connectingPoint[0]).setH(19.0 / 20.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - sw3, y - height / 20); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width, y - height / 20); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + height + height / 20 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height + height / 20 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - sw3, y - height / 20); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width, y - height / 20); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + height + height / 20 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height + height / 20 + sh0); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -504,18 +438,12 @@ public class ELNComponentIdealTransformer extends ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(19.0 / 20.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - sw2, y - height / 20); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width, y - height / 20); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + height + height / 20 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height + height / 20 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - sw2, y - height / 20); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width, y - height / 20); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + height + height / 20 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height + height / 20 + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -532,18 +460,12 @@ public class ELNComponentIdealTransformer extends ((ELNPortTerminal) connectingPoint[2]).setW(1.0); ((ELNPortTerminal) connectingPoint[2]).setH(19.0 / 20.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y - height / 20); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y - height / 20); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - sw3, y + height + height / 20 + sh3); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width, y + height + height / 20 + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, y - height / 20); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, y - height / 20); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - sw3, + y + height + height / 20 + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width, + y + height + height / 20 + sh2); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -560,18 +482,12 @@ public class ELNComponentIdealTransformer extends ((ELNPortTerminal) connectingPoint[3]).setW(1.0); ((ELNPortTerminal) connectingPoint[3]).setH(19.0 / 20.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y - height / 20); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y - height / 20); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - sw2, y + height + height / 20 + sh2); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width, y + height + height / 20 + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, y - height / 20); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, y - height / 20); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - sw2, + y + height + height / 20 + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width, + y + height + height / 20 + sh3); } } } else if (position == 3) { @@ -614,18 +530,12 @@ public class ELNComponentIdealTransformer extends ((ELNPortTerminal) connectingPoint[2]).setW(19.0 / 20.0); ((ELNPortTerminal) connectingPoint[2]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - width / 20 - sw1, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width + width / 20, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - width / 20 - sw0, y + height + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width + width / 20, y + height + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - width / 20 - sw1, y); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width + width / 20, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - width / 20 - sw0, + y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width + width / 20, + y + height + sh2); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -642,18 +552,12 @@ public class ELNComponentIdealTransformer extends ((ELNPortTerminal) connectingPoint[3]).setW(19.0 / 20.0); ((ELNPortTerminal) connectingPoint[3]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - width / 20 - sw0, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width + width / 20, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - width / 20 - sw1, y + height + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width + width / 20, y + height + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - width / 20 - sw0, y); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width + width / 20, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - width / 20 - sw1, + y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width + width / 20, + y + height + sh3); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -670,18 +574,12 @@ public class ELNComponentIdealTransformer extends ((ELNPortTerminal) connectingPoint[0]).setW(19.0 / 20.0); ((ELNPortTerminal) connectingPoint[0]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - width / 20 - sw3, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width + width / 20, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - width / 20 - sw2, y + height + sh2); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width + width / 20, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - width / 20 - sw3, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width + width / 20, y); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - width / 20 - sw2, + y + height + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width + width / 20, + y + height + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -698,18 +596,12 @@ public class ELNComponentIdealTransformer extends ((ELNPortTerminal) connectingPoint[1]).setW(19.0 / 20.0); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - width / 20 - sw2, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width + width / 20, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - width / 20 - sw3, y + height + sh3); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width + width / 20, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - width / 20 - sw2, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width + width / 20, y); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - width / 20 - sw3, + y + height + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width + width / 20, + y + height + sh1); } } } @@ -720,61 +612,45 @@ public class ELNComponentIdealTransformer extends private void rotateTop(Graphics g) { Color c = g.getColor(); int[] ptx0 = { x, x + width / 5, x + width / 5, x + width / 5 }; - int[] pty0 = { y + height / 20, y + height / 20, y + height / 5, - y + height / 20 }; + int[] pty0 = { y + height / 20, y + height / 20, y + height / 5, y + height / 20 }; g.drawPolygon(ptx0, pty0, 4); int[] ptx1 = { x, x + width / 5, x + width / 5, x + width / 5 }; - int[] pty1 = { y + height - height / 20, y + height - height / 20, - y + 4 * height / 5, y + height - height / 20 }; + int[] pty1 = { y + height - height / 20, y + height - height / 20, y + 4 * height / 5, + y + height - height / 20 }; g.drawPolygon(ptx1, pty1, 4); - int[] ptx2 = { x + width, x + 4 * width / 5, x + 4 * width / 5, - x + 4 * width / 5 }; - int[] pty2 = { y + height / 20, y + height / 20, y + height / 5, - y + height / 20 }; + int[] ptx2 = { x + width, x + 4 * width / 5, x + 4 * width / 5, x + 4 * width / 5 }; + int[] pty2 = { y + height / 20, y + height / 20, y + height / 5, y + height / 20 }; g.drawPolygon(ptx2, pty2, 4); - int[] ptx3 = { x + width, x + 4 * width / 5, x + 4 * width / 5, - x + 4 * width / 5 }; - int[] pty3 = { y + height - height / 20, y + height - height / 20, - y + 4 * height / 5, y + height - height / 20 }; + int[] ptx3 = { x + width, x + 4 * width / 5, x + 4 * width / 5, x + 4 * width / 5 }; + int[] pty3 = { y + height - height / 20, y + height - height / 20, y + 4 * height / 5, + y + height - height / 20 }; g.drawPolygon(ptx3, pty3, 4); g.drawArc(x, y + height / 5, 2 * width / 5, height / 5, 270, 180); g.drawArc(x, y + 2 * height / 5, 2 * width / 5, height / 5, 270, 180); g.drawArc(x, y + 3 * height / 5, 2 * width / 5, height / 5, 270, 180); - g.drawArc(x + 3 * width / 5, y + height / 5, 2 * width / 5, height / 5, - 90, 180); - g.drawArc(x + 3 * width / 5, y + 2 * height / 5, 2 * width / 5, - height / 5, 90, 180); - g.drawArc(x + 3 * width / 5, y + 3 * height / 5, 2 * width / 5, - height / 5, 90, 180); - g.drawOval(x + 2 * width / 5 - width / 20, y + width / 20, width / 10, - width / 10); - g.fillOval(x + 2 * width / 5 - width / 20, y + width / 20, width / 10, - width / 10); - g.drawOval(x + 3 * width / 5 - width / 20, y + width / 20, width / 10, - width / 10); - g.fillOval(x + 3 * width / 5 - width / 20, y + width / 20, width / 10, - width / 10); - g.drawArc(x + width / 5 + width / 10, y + 4 * height / 5, - 2 * width / 5, height / 5, 180, 180); + g.drawArc(x + 3 * width / 5, y + height / 5, 2 * width / 5, height / 5, 90, 180); + g.drawArc(x + 3 * width / 5, y + 2 * height / 5, 2 * width / 5, height / 5, 90, 180); + g.drawArc(x + 3 * width / 5, y + 3 * height / 5, 2 * width / 5, height / 5, 90, 180); + g.drawOval(x + 2 * width / 5 - width / 20, y + width / 20, width / 10, width / 10); + g.fillOval(x + 2 * width / 5 - width / 20, y + width / 20, width / 10, width / 10); + g.drawOval(x + 3 * width / 5 - width / 20, y + width / 20, width / 10, width / 10); + g.fillOval(x + 3 * width / 5 - width / 20, y + width / 20, width / 10, width / 10); + g.drawArc(x + width / 5 + width / 10, y + 4 * height / 5, 2 * width / 5, height / 5, 180, 180); int[] ptx4 = { x + width / 5 + width / 10, x + width / 5 + width / 10, x + width / 5 + width / 10 + width / 10 }; - int[] pty4 = { y + 4 * height / 5 + height / 10 + height / 10, - y + 4 * height / 5 + height / 10, + int[] pty4 = { y + 4 * height / 5 + height / 10 + height / 10, y + 4 * height / 5 + height / 10, y + 4 * height / 5 + height / 10 }; g.drawPolygon(ptx4, pty4, 3); g.fillPolygon(ptx4, pty4, 3); - int[] ptx5 = { x + width / 5 + width / 10 + 2 * width / 5, - x + width / 5 + width / 10 + 2 * width / 5, + int[] ptx5 = { x + width / 5 + width / 10 + 2 * width / 5, x + width / 5 + width / 10 + 2 * width / 5, x + width / 5 + width / 10 + 2 * width / 5 - width / 10 }; - int[] pty5 = { y + 4 * height / 5 + height / 10 + height / 10, - y + 4 * height / 5 + height / 10, + int[] pty5 = { y + 4 * height / 5 + height / 10 + height / 10, y + 4 * height / 5 + height / 10, y + 4 * height / 5 + height / 10 }; g.drawPolygon(ptx5, pty5, 3); g.fillPolygon(ptx5, pty5, 3); int w = g.getFontMetrics().stringWidth(Double.toString(ratio)); int h = g.getFontMetrics().getAscent(); - g.drawString(Double.toString(ratio), x + (width - w) / 2, y + height - + height / 10 + h); + g.drawString(Double.toString(ratio), x + (width - w) / 2, y + height + height / 10 + h); g.drawOval(x, y, width / 10, height / 10); g.setColor(Color.WHITE); g.fillOval(x, y, width / 10, height / 10); @@ -787,69 +663,53 @@ public class ELNComponentIdealTransformer extends g.setColor(Color.WHITE); g.fillOval(x, y + height - height / 10, width / 10, height / 10); g.setColor(c); - g.drawOval(x + width - width / 10, y + height - height / 10, - width / 10, height / 10); + g.drawOval(x + width - width / 10, y + height - height / 10, width / 10, height / 10); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 10, y + height - height / 10, - width / 10, height / 10); + g.fillOval(x + width - width / 10, y + height - height / 10, width / 10, height / 10); g.setColor(c); } private void rotateBottom(Graphics g) { Color c = g.getColor(); int[] ptx0 = { x, x + width / 5, x + width / 5, x + width / 5 }; - int[] pty0 = { y + height / 20, y + height / 20, y + height / 5, - y + height / 20 }; + int[] pty0 = { y + height / 20, y + height / 20, y + height / 5, y + height / 20 }; g.drawPolygon(ptx0, pty0, 4); int[] ptx1 = { x, x + width / 5, x + width / 5, x + width / 5 }; - int[] pty1 = { y + height - height / 20, y + height - height / 20, - y + 4 * height / 5, y + height - height / 20 }; + int[] pty1 = { y + height - height / 20, y + height - height / 20, y + 4 * height / 5, + y + height - height / 20 }; g.drawPolygon(ptx1, pty1, 4); - int[] ptx2 = { x + width, x + 4 * width / 5, x + 4 * width / 5, - x + 4 * width / 5 }; - int[] pty2 = { y + height / 20, y + height / 20, y + height / 5, - y + height / 20 }; + int[] ptx2 = { x + width, x + 4 * width / 5, x + 4 * width / 5, x + 4 * width / 5 }; + int[] pty2 = { y + height / 20, y + height / 20, y + height / 5, y + height / 20 }; g.drawPolygon(ptx2, pty2, 4); - int[] ptx3 = { x + width, x + 4 * width / 5, x + 4 * width / 5, - x + 4 * width / 5 }; - int[] pty3 = { y + height - height / 20, y + height - height / 20, - y + 4 * height / 5, y + height - height / 20 }; + int[] ptx3 = { x + width, x + 4 * width / 5, x + 4 * width / 5, x + 4 * width / 5 }; + int[] pty3 = { y + height - height / 20, y + height - height / 20, y + 4 * height / 5, + y + height - height / 20 }; g.drawPolygon(ptx3, pty3, 4); g.drawArc(x, y + height / 5, 2 * width / 5, height / 5, 270, 180); g.drawArc(x, y + 2 * height / 5, 2 * width / 5, height / 5, 270, 180); g.drawArc(x, y + 3 * height / 5, 2 * width / 5, height / 5, 270, 180); - g.drawArc(x + 3 * width / 5, y + height / 5, 2 * width / 5, height / 5, - 90, 180); - g.drawArc(x + 3 * width / 5, y + 2 * height / 5, 2 * width / 5, - height / 5, 90, 180); - g.drawArc(x + 3 * width / 5, y + 3 * height / 5, 2 * width / 5, - height / 5, 90, 180); - g.drawOval(x + 2 * width / 5 - width / 20, y + width - width / 20 - - width / 10, width / 10, width / 10); - g.fillOval(x + 2 * width / 5 - width / 20, y + width - width / 20 - - width / 10, width / 10, width / 10); - g.drawOval(x + 3 * width / 5 - width / 20, y + width - width / 20 - - width / 10, width / 10, width / 10); - g.fillOval(x + 3 * width / 5 - width / 20, y + width - width / 20 - - width / 10, width / 10, width / 10); - g.drawArc(x + width / 5 + width / 10, y, 2 * width / 5, height / 5, 0, - 180); + g.drawArc(x + 3 * width / 5, y + height / 5, 2 * width / 5, height / 5, 90, 180); + g.drawArc(x + 3 * width / 5, y + 2 * height / 5, 2 * width / 5, height / 5, 90, 180); + g.drawArc(x + 3 * width / 5, y + 3 * height / 5, 2 * width / 5, height / 5, 90, 180); + g.drawOval(x + 2 * width / 5 - width / 20, y + width - width / 20 - width / 10, width / 10, width / 10); + g.fillOval(x + 2 * width / 5 - width / 20, y + width - width / 20 - width / 10, width / 10, width / 10); + g.drawOval(x + 3 * width / 5 - width / 20, y + width - width / 20 - width / 10, width / 10, width / 10); + g.fillOval(x + 3 * width / 5 - width / 20, y + width - width / 20 - width / 10, width / 10, width / 10); + g.drawArc(x + width / 5 + width / 10, y, 2 * width / 5, height / 5, 0, 180); int[] ptx4 = { x + width / 5 + width / 10, x + width / 5 + width / 10, x + width / 5 + width / 10 + width / 10 }; - int[] pty4 = { y + height / 5 - height / 10 - height / 10, - y + height / 5 - height / 10, y + height / 5 - height / 10 }; + int[] pty4 = { y + height / 5 - height / 10 - height / 10, y + height / 5 - height / 10, + y + height / 5 - height / 10 }; g.drawPolygon(ptx4, pty4, 3); g.fillPolygon(ptx4, pty4, 3); - int[] ptx5 = { x + width / 5 + width / 10 + 2 * width / 5, - x + width / 5 + width / 10 + 2 * width / 5, + int[] ptx5 = { x + width / 5 + width / 10 + 2 * width / 5, x + width / 5 + width / 10 + 2 * width / 5, x + width / 5 + width / 10 + 2 * width / 5 - width / 10 }; - int[] pty5 = { y + height / 5 - height / 10 - height / 10, - y + height / 5 - height / 10, y + height / 5 - height / 10 }; + int[] pty5 = { y + height / 5 - height / 10 - height / 10, y + height / 5 - height / 10, + y + height / 5 - height / 10 }; g.drawPolygon(ptx5, pty5, 3); g.fillPolygon(ptx5, pty5, 3); int w = g.getFontMetrics().stringWidth(Double.toString(ratio)); - g.drawString(Double.toString(ratio), x + (width - w) / 2, y - height - / 20); + g.drawString(Double.toString(ratio), x + (width - w) / 2, y - height / 20); g.drawOval(x, y, width / 10, height / 10); g.setColor(Color.WHITE); g.fillOval(x, y, width / 10, height / 10); @@ -862,71 +722,52 @@ public class ELNComponentIdealTransformer extends g.setColor(Color.WHITE); g.fillOval(x, y + height - height / 10, width / 10, height / 10); g.setColor(c); - g.drawOval(x + width - width / 10, y + height - height / 10, - width / 10, height / 10); + g.drawOval(x + width - width / 10, y + height - height / 10, width / 10, height / 10); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 10, y + height - height / 10, - width / 10, height / 10); + g.fillOval(x + width - width / 10, y + height - height / 10, width / 10, height / 10); g.setColor(c); } private void rotateRight(Graphics g) { Color c = g.getColor(); - int[] ptx0 = { x + width / 20, x + width / 20, x + width / 5, - x + width / 20 }; + int[] ptx0 = { x + width / 20, x + width / 20, x + width / 5, x + width / 20 }; int[] pty0 = { y, y + height / 5, y + height / 5, y + height / 5 }; g.drawPolygon(ptx0, pty0, 4); - int[] ptx1 = { x + width - width / 20, x + width - width / 20, - x + 4 * width / 5, x + width - width / 20 }; + int[] ptx1 = { x + width - width / 20, x + width - width / 20, x + 4 * width / 5, x + width - width / 20 }; int[] pty1 = { y, y + height / 5, y + height / 5, y + height / 5 }; g.drawPolygon(ptx1, pty1, 4); - int[] ptx2 = { x + width / 20, x + width / 20, x + width / 5, - x + width / 20 }; - int[] pty2 = { y + height, y + 4 * height / 5, y + 4 * height / 5, - y + 4 * height / 5 }; + int[] ptx2 = { x + width / 20, x + width / 20, x + width / 5, x + width / 20 }; + int[] pty2 = { y + height, y + 4 * height / 5, y + 4 * height / 5, y + 4 * height / 5 }; g.drawPolygon(ptx2, pty2, 4); - int[] ptx3 = { x + width - width / 20, x + width - width / 20, - x + 4 * width / 5, x + width - width / 20 }; - int[] pty3 = { y + height, y + 4 * height / 5, y + 4 * height / 5, - y + 4 * height / 5 }; + int[] ptx3 = { x + width - width / 20, x + width - width / 20, x + 4 * width / 5, x + width - width / 20 }; + int[] pty3 = { y + height, y + 4 * height / 5, y + 4 * height / 5, y + 4 * height / 5 }; g.drawPolygon(ptx3, pty3, 4); g.drawArc(x + width / 5, y, width / 5, 2 * height / 5, 180, 180); g.drawArc(x + 2 * width / 5, y, width / 5, 2 * height / 5, 180, 180); g.drawArc(x + 3 * width / 5, y, width / 5, 2 * height / 5, 180, 180); - g.drawArc(x + width / 5, y + 3 * height / 5, width / 5, 2 * height / 5, - 0, 180); - g.drawArc(x + 2 * width / 5, y + 3 * height / 5, width / 5, - 2 * height / 5, 0, 180); - g.drawArc(x + 3 * width / 5, y + 3 * height / 5, width / 5, - 2 * height / 5, 0, 180); - g.drawOval(x + width - width / 10 - width / 20, y + 2 * height / 5 - - height / 20, width / 10, height / 10); - g.fillOval(x + width - width / 10 - width / 20, y + 2 * height / 5 - - height / 20, width / 10, height / 10); - g.drawOval(x + width - width / 10 - width / 20, y + 3 * height / 5 - - height / 20, width / 10, height / 10); - g.fillOval(x + width - width / 10 - width / 20, y + 3 * height / 5 - - height / 20, width / 10, height / 10); - g.drawArc(x, y + height / 5 + height / 10, width / 5, 2 * height / 5, - 90, 180); - int[] ptx4 = { x + width / 5 - width / 10 - width / 10, - x + width / 5 - width / 10, x + width / 5 - width / 10 }; - int[] pty4 = { y + height / 5 + height / 10, - y + height / 5 + height / 10, + g.drawArc(x + width / 5, y + 3 * height / 5, width / 5, 2 * height / 5, 0, 180); + g.drawArc(x + 2 * width / 5, y + 3 * height / 5, width / 5, 2 * height / 5, 0, 180); + g.drawArc(x + 3 * width / 5, y + 3 * height / 5, width / 5, 2 * height / 5, 0, 180); + g.drawOval(x + width - width / 10 - width / 20, y + 2 * height / 5 - height / 20, width / 10, height / 10); + g.fillOval(x + width - width / 10 - width / 20, y + 2 * height / 5 - height / 20, width / 10, height / 10); + g.drawOval(x + width - width / 10 - width / 20, y + 3 * height / 5 - height / 20, width / 10, height / 10); + g.fillOval(x + width - width / 10 - width / 20, y + 3 * height / 5 - height / 20, width / 10, height / 10); + g.drawArc(x, y + height / 5 + height / 10, width / 5, 2 * height / 5, 90, 180); + int[] ptx4 = { x + width / 5 - width / 10 - width / 10, x + width / 5 - width / 10, + x + width / 5 - width / 10 }; + int[] pty4 = { y + height / 5 + height / 10, y + height / 5 + height / 10, y + height / 5 + height / 10 + height / 10 }; g.drawPolygon(ptx4, pty4, 3); g.fillPolygon(ptx4, pty4, 3); - int[] ptx5 = { x + width / 5 - width / 10 - width / 10, - x + width / 5 - width / 10, x + width / 5 - width / 10 }; - int[] pty5 = { y + height / 5 + height / 10 + 2 * height / 5, - y + height / 5 + height / 10 + 2 * height / 5, + int[] ptx5 = { x + width / 5 - width / 10 - width / 10, x + width / 5 - width / 10, + x + width / 5 - width / 10 }; + int[] pty5 = { y + height / 5 + height / 10 + 2 * height / 5, y + height / 5 + height / 10 + 2 * height / 5, y + height / 5 + height / 10 + 2 * height / 5 - height / 10 }; g.drawPolygon(ptx5, pty5, 3); g.fillPolygon(ptx5, pty5, 3); int w = g.getFontMetrics().stringWidth(Double.toString(ratio)); int h = g.getFontMetrics().getAscent(); - g.drawString(Double.toString(ratio), x - width / 10 - w, y + height / 2 - + h / 2); + g.drawString(Double.toString(ratio), x - width / 10 - w, y + height / 2 + h / 2); g.drawOval(x, y, width / 10, height / 10); g.setColor(Color.WHITE); g.fillOval(x, y, width / 10, height / 10); @@ -939,70 +780,51 @@ public class ELNComponentIdealTransformer extends g.setColor(Color.WHITE); g.fillOval(x, y + height - height / 10, width / 10, height / 10); g.setColor(c); - g.drawOval(x + width - width / 10, y + height - height / 10, - width / 10, height / 10); + g.drawOval(x + width - width / 10, y + height - height / 10, width / 10, height / 10); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 10, y + height - height / 10, - width / 10, height / 10); + g.fillOval(x + width - width / 10, y + height - height / 10, width / 10, height / 10); g.setColor(c); } private void rotateLeft(Graphics g) { Color c = g.getColor(); - int[] ptx0 = { x + width / 20, x + width / 20, x + width / 5, - x + width / 20 }; + int[] ptx0 = { x + width / 20, x + width / 20, x + width / 5, x + width / 20 }; int[] pty0 = { y, y + height / 5, y + height / 5, y + height / 5 }; g.drawPolygon(ptx0, pty0, 4); - int[] ptx1 = { x + width - width / 20, x + width - width / 20, - x + 4 * width / 5, x + width - width / 20 }; + int[] ptx1 = { x + width - width / 20, x + width - width / 20, x + 4 * width / 5, x + width - width / 20 }; int[] pty1 = { y, y + height / 5, y + height / 5, y + height / 5 }; g.drawPolygon(ptx1, pty1, 4); - int[] ptx2 = { x + width / 20, x + width / 20, x + width / 5, - x + width / 20 }; - int[] pty2 = { y + height, y + 4 * height / 5, y + 4 * height / 5, - y + 4 * height / 5 }; + int[] ptx2 = { x + width / 20, x + width / 20, x + width / 5, x + width / 20 }; + int[] pty2 = { y + height, y + 4 * height / 5, y + 4 * height / 5, y + 4 * height / 5 }; g.drawPolygon(ptx2, pty2, 4); - int[] ptx3 = { x + width - width / 20, x + width - width / 20, - x + 4 * width / 5, x + width - width / 20 }; - int[] pty3 = { y + height, y + 4 * height / 5, y + 4 * height / 5, - y + 4 * height / 5 }; + int[] ptx3 = { x + width - width / 20, x + width - width / 20, x + 4 * width / 5, x + width - width / 20 }; + int[] pty3 = { y + height, y + 4 * height / 5, y + 4 * height / 5, y + 4 * height / 5 }; g.drawPolygon(ptx3, pty3, 4); g.drawArc(x + width / 5, y, width / 5, 2 * height / 5, 180, 180); g.drawArc(x + 2 * width / 5, y, width / 5, 2 * height / 5, 180, 180); g.drawArc(x + 3 * width / 5, y, width / 5, 2 * height / 5, 180, 180); - g.drawArc(x + width / 5, y + 3 * height / 5, width / 5, 2 * height / 5, - 0, 180); - g.drawArc(x + 2 * width / 5, y + 3 * height / 5, width / 5, - 2 * height / 5, 0, 180); - g.drawArc(x + 3 * width / 5, y + 3 * height / 5, width / 5, - 2 * height / 5, 0, 180); - g.drawOval(x + width / 20, y + 2 * height / 5 - height / 20, - width / 10, height / 10); - g.fillOval(x + width / 20, y + 2 * height / 5 - height / 20, - width / 10, height / 10); - g.drawOval(x + width / 20, y + 3 * height / 5 - height / 20, - width / 10, height / 10); - g.fillOval(x + width / 20, y + 3 * height / 5 - height / 20, - width / 10, height / 10); - g.drawArc(x + 4 * width / 5, y + height / 5 + height / 10, width / 5, - 2 * height / 5, 270, 180); - int[] ptx4 = { x + 4 * width / 5 + width / 10 + width / 10, - x + 4 * width / 5 + width / 10, x + 4 * width / 5 + width / 10 }; - int[] pty4 = { y + height / 5 + height / 10, - y + height / 5 + height / 10, + g.drawArc(x + width / 5, y + 3 * height / 5, width / 5, 2 * height / 5, 0, 180); + g.drawArc(x + 2 * width / 5, y + 3 * height / 5, width / 5, 2 * height / 5, 0, 180); + g.drawArc(x + 3 * width / 5, y + 3 * height / 5, width / 5, 2 * height / 5, 0, 180); + g.drawOval(x + width / 20, y + 2 * height / 5 - height / 20, width / 10, height / 10); + g.fillOval(x + width / 20, y + 2 * height / 5 - height / 20, width / 10, height / 10); + g.drawOval(x + width / 20, y + 3 * height / 5 - height / 20, width / 10, height / 10); + g.fillOval(x + width / 20, y + 3 * height / 5 - height / 20, width / 10, height / 10); + g.drawArc(x + 4 * width / 5, y + height / 5 + height / 10, width / 5, 2 * height / 5, 270, 180); + int[] ptx4 = { x + 4 * width / 5 + width / 10 + width / 10, x + 4 * width / 5 + width / 10, + x + 4 * width / 5 + width / 10 }; + int[] pty4 = { y + height / 5 + height / 10, y + height / 5 + height / 10, y + height / 5 + height / 10 + height / 10 }; g.drawPolygon(ptx4, pty4, 3); g.fillPolygon(ptx4, pty4, 3); - int[] ptx5 = { x + 4 * width / 5 + width / 10 + width / 10, - x + 4 * width / 5 + width / 10, x + 4 * width / 5 + width / 10 }; - int[] pty5 = { y + height / 5 + height / 10 + 2 * height / 5, - y + height / 5 + height / 10 + 2 * height / 5, + int[] ptx5 = { x + 4 * width / 5 + width / 10 + width / 10, x + 4 * width / 5 + width / 10, + x + 4 * width / 5 + width / 10 }; + int[] pty5 = { y + height / 5 + height / 10 + 2 * height / 5, y + height / 5 + height / 10 + 2 * height / 5, y + height / 5 + height / 10 + 2 * height / 5 - height / 10 }; g.drawPolygon(ptx5, pty5, 3); g.fillPolygon(ptx5, pty5, 3); int h = g.getFontMetrics().getAscent(); - g.drawString(Double.toString(ratio), x + width + width / 10, y + height - / 2 + h / 2); + g.drawString(Double.toString(ratio), x + width + width / 10, y + height / 2 + h / 2); g.drawOval(x, y, width / 10, height / 10); g.setColor(Color.WHITE); g.fillOval(x, y, width / 10, height / 10); @@ -1015,11 +837,9 @@ public class ELNComponentIdealTransformer extends g.setColor(Color.WHITE); g.fillOval(x, y + height - height / 10, width / 10, height / 10); g.setColor(c); - g.drawOval(x + width - width / 10, y + height - height / 10, - width / 10, height / 10); + g.drawOval(x + width - width / 10, y + height - height / 10, width / 10, height / 10); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 10, y + height - height / 10, - width / 10, height / 10); + g.fillOval(x + width - width / 10, y + height - height / 10, width / 10, height / 10); g.setColor(c); } @@ -1035,8 +855,7 @@ public class ELNComponentIdealTransformer extends } public boolean editOndoubleClick(JFrame frame) { - JDialogELNComponentIdealTransformer jde = new JDialogELNComponentIdealTransformer( - this); + JDialogELNComponentIdealTransformer jde = new JDialogELNComponentIdealTransformer(this); jde.setVisible(true); return true; } @@ -1055,8 +874,7 @@ public class ELNComponentIdealTransformer extends return new String(sb); } - public void loadExtraParam(NodeList nl, int decX, int decY, int decId) - throws MalformedModelingException { + public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException { try { NodeList nli; Node n1, n2; @@ -1075,20 +893,13 @@ public class ELNComponentIdealTransformer extends if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; if (elt.getTagName().equals("attributes")) { - ratio = Double.parseDouble(elt - .getAttribute("ratio")); - position = Integer.parseInt(elt - .getAttribute("position")); - fv_0_2 = Boolean.parseBoolean(elt - .getAttribute("fv_0_2")); - fv_1_3 = Boolean.parseBoolean(elt - .getAttribute("fv_1_3")); - fh_0_2 = Boolean.parseBoolean(elt - .getAttribute("fh_0_2")); - fh_1_3 = Boolean.parseBoolean(elt - .getAttribute("fh_1_3")); - first = Boolean.parseBoolean(elt - .getAttribute("first")); + ratio = Double.parseDouble(elt.getAttribute("ratio")); + position = Integer.parseInt(elt.getAttribute("position")); + fv_0_2 = Boolean.parseBoolean(elt.getAttribute("fv_0_2")); + fv_1_3 = Boolean.parseBoolean(elt.getAttribute("fv_1_3")); + fh_0_2 = Boolean.parseBoolean(elt.getAttribute("fh_0_2")); + fh_1_3 = Boolean.parseBoolean(elt.getAttribute("fh_1_3")); + first = Boolean.parseBoolean(elt.getAttribute("first")); setRatio(ratio); setPosition(position); setFv_0_2(fv_0_2); @@ -1106,8 +917,7 @@ public class ELNComponentIdealTransformer extends } } - public void addActionToPopupMenu(JPopupMenu componentMenu, - ActionListener menuAL, int x, int y) { + public void addActionToPopupMenu(JPopupMenu componentMenu, ActionListener menuAL, int x, int y) { componentMenu.addSeparator(); JMenuItem rotateright = new JMenuItem("Rotate right 90\u00b0"); @@ -1238,8 +1048,7 @@ public class ELNComponentIdealTransformer extends if ((father != null) && (father instanceof ELNModule)) { resizeToFatherSize(); - setCdRectangle(0, father.getWidth() - getWidth(), 0, - father.getHeight() - getHeight()); + setCdRectangle(0, father.getWidth() - getWidth(), 0, father.getHeight() - getHeight()); setMoveCd(x, y); } } @@ -1252,7 +1061,6 @@ public class ELNComponentIdealTransformer extends myColor = null; setFather(null); TDiagramPanel tdp = getTDiagramPanel(); - setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), - tdp.getMaxY()); + setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY()); } } \ No newline at end of file diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentIndependentCurrentSource.java b/src/main/java/ui/eln/sca_eln/ELNComponentIndependentCurrentSource.java index edfe1b0049..131db85538 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentIndependentCurrentSource.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentIndependentCurrentSource.java @@ -51,16 +51,14 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** - * Class ELNComponentIndependentCurrentSource Independent current source to be - * used in ELN diagrams Creation: 15/06/2018 - * + * Class ELNComponentIndependentCurrentSource + * Independent current source to be used in ELN diagrams + * Creation: 15/06/2018 * @version 1.0 15/06/2018 * @author Irina Kit Yan LEE */ -public class ELNComponentIndependentCurrentSource extends - TGCScalableWithInternalComponent implements ActionListener, - SwallowedTGComponent, ELNComponent { +public class ELNComponentIndependentCurrentSource extends TGCScalableWithInternalComponent implements ActionListener, SwallowedTGComponent, ELNComponent { protected Color myColor; protected int orientation; private int maxFontSize = 14; @@ -71,20 +69,16 @@ public class ELNComponentIndependentCurrentSource extends private double dtextX = 0.0; protected int decPoint = 3; - private double initValue, offset, amplitude, frequency, phase, acAmplitude, - acPhase, acNoiseAmplitude; + private double initValue, offset, amplitude, frequency, phase, acAmplitude, acPhase, acNoiseAmplitude; private String delay; private String unit0; private int position = 0; - private boolean fv_0_2 = false, fv_1_3 = false, fh_0_2 = false, - fh_1_3 = false; + private boolean fv_0_2 = false, fv_1_3 = false, fh_0_2 = false, fh_1_3 = false; private int old; private boolean first; - public ELNComponentIndependentCurrentSource(int _x, int _y, int _minX, - int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, - TDiagramPanel _tdp) { + public ELNComponentIndependentCurrentSource(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); initScaling(60, 80); @@ -125,10 +119,8 @@ public class ELNComponentIndependentCurrentSource extends public void initPortTerminal(int nb) { nbConnectingPoint = nb; connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "p"); - connectingPoint[1] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "n"); + connectingPoint[0] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "p"); + connectingPoint[1] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "n"); } public Color getMyColor() { @@ -142,10 +134,7 @@ public class ELNComponentIndependentCurrentSource extends if (this.rescaled && !this.tdp.isScaled()) { this.rescaled = false; - int maxCurrentFontSize = Math.max( - 0, - Math.min(this.height, - (int) (this.maxFontSize * this.tdp.getZoom()))); + int maxCurrentFontSize = Math.max(0, Math.min(this.height, (int) (this.maxFontSize * this.tdp.getZoom()))); f = f.deriveFont((float) maxCurrentFontSize); while (maxCurrentFontSize > (this.minFontSize * this.tdp.getZoom() - 1)) { @@ -198,12 +187,9 @@ public class ELNComponentIndependentCurrentSource extends ((ELNPortTerminal) connectingPoint[1]).setW(1.0 / 3.0); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 3 + width / 6, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 3 + width / 6, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 3 + width / 6, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 3 + width / 6, + y + height + sh1); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -216,13 +202,9 @@ public class ELNComponentIndependentCurrentSource extends ((ELNPortTerminal) connectingPoint[1]).setW(2.0 / 3.0); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + 2 * width / 3 + width / 6, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + 2 * width / 3 + width / 6, y + height - + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + 2 * width / 3 + width / 6, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + 2 * width / 3 + width / 6, + y + height + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -235,12 +217,9 @@ public class ELNComponentIndependentCurrentSource extends ((ELNPortTerminal) connectingPoint[1]).setW(1.0 / 3.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 3 + width / 6, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 3 + width / 6, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 3 + width / 6, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 3 + width / 6, + y + height + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -253,13 +232,9 @@ public class ELNComponentIndependentCurrentSource extends ((ELNPortTerminal) connectingPoint[1]).setW(2.0 / 3.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + 2 * width / 3 + width / 6, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + 2 * width / 3 + width / 6, y + height - + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + 2 * width / 3 + width / 6, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + 2 * width / 3 + width / 6, + y + height + sh0); } } } else if (position == 1) { @@ -294,12 +269,10 @@ public class ELNComponentIndependentCurrentSource extends ((ELNPortTerminal) connectingPoint[1]).setW(0.0); ((ELNPortTerminal) connectingPoint[1]).setH(1.0 / 3.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + height / 3 + height / 6 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height / 3 + height / 6 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + height / 3 + height / 6 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height / 3 + height / 6 + sh0); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -312,14 +285,10 @@ public class ELNComponentIndependentCurrentSource extends ((ELNPortTerminal) connectingPoint[1]).setW(0.0); ((ELNPortTerminal) connectingPoint[1]).setH(2.0 / 3.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + 2 * height / 3 + height / 6 - + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + 2 * height / 3 + height / 6 - + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + 2 * height / 3 + height / 6 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + 2 * height / 3 + height / 6 + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -332,12 +301,10 @@ public class ELNComponentIndependentCurrentSource extends ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(1.0 / 3.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + height / 3 + height / 6 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height / 3 + height / 6 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + height / 3 + height / 6 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height / 3 + height / 6 + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -350,14 +317,10 @@ public class ELNComponentIndependentCurrentSource extends ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(2.0 / 3.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + 2 * height / 3 + height / 6 - + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + 2 * height / 3 + height / 6 - + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + 2 * height / 3 + height / 6 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + 2 * height / 3 + height / 6 + sh1); } } } else if (position == 2) { @@ -390,13 +353,9 @@ public class ELNComponentIndependentCurrentSource extends ((ELNPortTerminal) connectingPoint[1]).setW(2.0 / 3.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + 2 * width / 3 + width / 6, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + 2 * width / 3 + width / 6, y + height - + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + 2 * width / 3 + width / 6, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + 2 * width / 3 + width / 6, + y + height + sh0); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -409,12 +368,9 @@ public class ELNComponentIndependentCurrentSource extends ((ELNPortTerminal) connectingPoint[1]).setW(1.0 / 3.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 3 + width / 6, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 3 + width / 6, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 3 + width / 6, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 3 + width / 6, + y + height + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -427,13 +383,9 @@ public class ELNComponentIndependentCurrentSource extends ((ELNPortTerminal) connectingPoint[1]).setW(2.0 / 3.0); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + 2 * width / 3 + width / 6, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + 2 * width / 3 + width / 6, y + height - + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + 2 * width / 3 + width / 6, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + 2 * width / 3 + width / 6, + y + height + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -446,12 +398,9 @@ public class ELNComponentIndependentCurrentSource extends ((ELNPortTerminal) connectingPoint[1]).setW(1.0 / 3.0); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 3 + width / 6, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 3 + width / 6, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 3 + width / 6, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 3 + width / 6, + y + height + sh1); } } } else if (position == 3) { @@ -486,14 +435,10 @@ public class ELNComponentIndependentCurrentSource extends ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(2.0 / 3.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + 2 * height / 3 + height / 6 - + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + 2 * height / 3 + height / 6 - + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + 2 * height / 3 + height / 6 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + 2 * height / 3 + height / 6 + sh1); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -506,12 +451,10 @@ public class ELNComponentIndependentCurrentSource extends ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(1.0 / 3.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + height / 3 + height / 6 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height / 3 + height / 6 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + height / 3 + height / 6 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height / 3 + height / 6 + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -524,14 +467,10 @@ public class ELNComponentIndependentCurrentSource extends ((ELNPortTerminal) connectingPoint[1]).setW(0.0); ((ELNPortTerminal) connectingPoint[1]).setH(2.0 / 3.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + 2 * height / 3 + height / 6 - + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + 2 * height / 3 + height / 6 - + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + 2 * height / 3 + height / 6 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + 2 * height / 3 + height / 6 + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -544,12 +483,10 @@ public class ELNComponentIndependentCurrentSource extends ((ELNPortTerminal) connectingPoint[1]).setW(0.0); ((ELNPortTerminal) connectingPoint[1]).setH(1.0 / 3.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + height / 3 + height / 6 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height / 3 + height / 6 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + height / 3 + height / 6 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height / 3 + height / 6 + sh0); } } } @@ -569,27 +506,20 @@ public class ELNComponentIndependentCurrentSource extends int[] pty2 = { y + height / 2, y + height / 2 }; g.drawPolygon(ptx2, pty2, 2); g.drawOval(x, y + height / 4, 2 * width / 3, height / 2); - int[] ptx3 = { x + 2 * width / 3 + width / 6, - x + 2 * width / 3 + width / 6, - x + 2 * width / 3 + width / 6 - width / 12, - x + 2 * width / 3 + width / 6, - x + 2 * width / 3 + width / 6 + width / 12, - x + 2 * width / 3 + width / 6 }; - int[] pty3 = { y + height / 4, y + 3 * height / 4 - height / 8, - y + 3 * height / 4 - height / 8, y + 3 * height / 4, - y + 3 * height / 4 - height / 8, - y + 3 * height / 4 - height / 8 }; + int[] ptx3 = { x + 2 * width / 3 + width / 6, x + 2 * width / 3 + width / 6, + x + 2 * width / 3 + width / 6 - width / 12, x + 2 * width / 3 + width / 6, + x + 2 * width / 3 + width / 6 + width / 12, x + 2 * width / 3 + width / 6 }; + int[] pty3 = { y + height / 4, y + 3 * height / 4 - height / 8, y + 3 * height / 4 - height / 8, + y + 3 * height / 4, y + 3 * height / 4 - height / 8, y + 3 * height / 4 - height / 8 }; g.drawPolygon(ptx3, pty3, 6); g.fillPolygon(ptx3, pty3, 6); g.drawOval(x + width / 3 - width / 12, y, width / 6, height / 8); g.setColor(Color.WHITE); g.fillOval(x + width / 3 - width / 12, y, width / 6, height / 8); g.setColor(c); - g.drawOval(x + width / 3 - width / 12, y + height - height / 8, - width / 6, height / 8); + g.drawOval(x + width / 3 - width / 12, y + height - height / 8, width / 6, height / 8); g.setColor(Color.WHITE); - g.fillOval(x + width / 3 - width / 12, y + height - height / 8, - width / 6, height / 8); + g.fillOval(x + width / 3 - width / 12, y + height - height / 8, width / 6, height / 8); g.setColor(c); } @@ -605,14 +535,10 @@ public class ELNComponentIndependentCurrentSource extends int[] pty2 = { y + height / 2, y + height / 2 }; g.drawPolygon(ptx2, pty2, 2); g.drawOval(x, y + height / 4, 2 * width / 3, height / 2); - int[] ptx3 = { x + 2 * width / 3 + width / 6, - x + 2 * width / 3 + width / 6, - x + 2 * width / 3 + width / 6 - width / 12, - x + 2 * width / 3 + width / 6, - x + 2 * width / 3 + width / 6 + width / 12, - x + 2 * width / 3 + width / 6 }; - int[] pty3 = { y + 3 * height / 4, y + height / 4 + height / 8, - y + height / 4 + height / 8, y + height / 4, + int[] ptx3 = { x + 2 * width / 3 + width / 6, x + 2 * width / 3 + width / 6, + x + 2 * width / 3 + width / 6 - width / 12, x + 2 * width / 3 + width / 6, + x + 2 * width / 3 + width / 6 + width / 12, x + 2 * width / 3 + width / 6 }; + int[] pty3 = { y + 3 * height / 4, y + height / 4 + height / 8, y + height / 4 + height / 8, y + height / 4, y + height / 4 + height / 8, y + height / 4 + height / 8 }; g.drawPolygon(ptx3, pty3, 6); g.fillPolygon(ptx3, pty3, 6); @@ -620,11 +546,9 @@ public class ELNComponentIndependentCurrentSource extends g.setColor(Color.WHITE); g.fillOval(x + width / 3 - width / 12, y, width / 6, height / 8); g.setColor(c); - g.drawOval(x + width / 3 - width / 12, y + height - height / 8, - width / 6, height / 8); + g.drawOval(x + width / 3 - width / 12, y + height - height / 8, width / 6, height / 8); g.setColor(Color.WHITE); - g.fillOval(x + width / 3 - width / 12, y + height - height / 8, - width / 6, height / 8); + g.fillOval(x + width / 3 - width / 12, y + height - height / 8, width / 6, height / 8); g.setColor(c); } @@ -640,11 +564,9 @@ public class ELNComponentIndependentCurrentSource extends int[] pty2 = { y + height / 2, y + height / 2 }; g.drawPolygon(ptx2, pty2, 2); g.drawOval(x + width / 3, y + height / 4, 2 * width / 3, height / 2); - int[] ptx3 = { x + width / 6, x + width / 6, - x + width / 6 - width / 12, x + width / 6, + int[] ptx3 = { x + width / 6, x + width / 6, x + width / 6 - width / 12, x + width / 6, x + width / 6 + width / 12, x + width / 6 }; - int[] pty3 = { y + 3 * height / 4, y + height / 4 + height / 8, - y + height / 4 + height / 8, y + height / 4, + int[] pty3 = { y + 3 * height / 4, y + height / 4 + height / 8, y + height / 4 + height / 8, y + height / 4, y + height / 4 + height / 8, y + height / 4 + height / 8 }; g.drawPolygon(ptx3, pty3, 6); g.fillPolygon(ptx3, pty3, 6); @@ -652,11 +574,9 @@ public class ELNComponentIndependentCurrentSource extends g.setColor(Color.WHITE); g.fillOval(x + 2 * width / 3 - width / 12, y, width / 6, height / 8); g.setColor(c); - g.drawOval(x + 2 * width / 3 - width / 12, y + height - height / 8, - width / 6, height / 8); + g.drawOval(x + 2 * width / 3 - width / 12, y + height - height / 8, width / 6, height / 8); g.setColor(Color.WHITE); - g.fillOval(x + 2 * width / 3 - width / 12, y + height - height / 8, - width / 6, height / 8); + g.fillOval(x + 2 * width / 3 - width / 12, y + height - height / 8, width / 6, height / 8); g.setColor(c); } @@ -672,24 +592,19 @@ public class ELNComponentIndependentCurrentSource extends int[] pty2 = { y + height / 2, y + height / 2 }; g.drawPolygon(ptx2, pty2, 2); g.drawOval(x + width / 3, y + height / 4, 2 * width / 3, height / 2); - int[] ptx3 = { x + width / 6, x + width / 6, - x + width / 6 - width / 12, x + width / 6, + int[] ptx3 = { x + width / 6, x + width / 6, x + width / 6 - width / 12, x + width / 6, x + width / 6 + width / 12, x + width / 6 }; - int[] pty3 = { y + height / 4, y + 3 * height / 4 - height / 8, - y + 3 * height / 4 - height / 8, y + 3 * height / 4, - y + 3 * height / 4 - height / 8, - y + 3 * height / 4 - height / 8 }; + int[] pty3 = { y + height / 4, y + 3 * height / 4 - height / 8, y + 3 * height / 4 - height / 8, + y + 3 * height / 4, y + 3 * height / 4 - height / 8, y + 3 * height / 4 - height / 8 }; g.drawPolygon(ptx3, pty3, 6); g.fillPolygon(ptx3, pty3, 6); g.drawOval(x + 2 * width / 3 - width / 12, y, width / 6, height / 8); g.setColor(Color.WHITE); g.fillOval(x + 2 * width / 3 - width / 12, y, width / 6, height / 8); g.setColor(c); - g.drawOval(x + 2 * width / 3 - width / 12, y + height - height / 8, - width / 6, height / 8); + g.drawOval(x + 2 * width / 3 - width / 12, y + height - height / 8, width / 6, height / 8); g.setColor(Color.WHITE); - g.fillOval(x + 2 * width / 3 - width / 12, y + height - height / 8, - width / 6, height / 8); + g.fillOval(x + 2 * width / 3 - width / 12, y + height - height / 8, width / 6, height / 8); g.setColor(c); } @@ -705,26 +620,20 @@ public class ELNComponentIndependentCurrentSource extends int[] pty2 = { y, y + 2 * height / 3 }; g.drawPolygon(ptx2, pty2, 2); g.drawOval(x + width / 4, y, width / 2, 2 * height / 3); - int[] ptx3 = { x + 3 * width / 4, x + width / 4 + width / 8, - x + width / 4 + width / 8, x + width / 4, + int[] ptx3 = { x + 3 * width / 4, x + width / 4 + width / 8, x + width / 4 + width / 8, x + width / 4, x + width / 4 + width / 8, x + width / 4 + width / 8 }; - int[] pty3 = { y + 2 * height / 3 + height / 6, - y + 2 * height / 3 + height / 6, - y + 2 * height / 3 + height / 6 - height / 12, - y + 2 * height / 3 + height / 6, - y + 2 * height / 3 + height / 6 + height / 12, - y + 2 * height / 3 + height / 6 }; + int[] pty3 = { y + 2 * height / 3 + height / 6, y + 2 * height / 3 + height / 6, + y + 2 * height / 3 + height / 6 - height / 12, y + 2 * height / 3 + height / 6, + y + 2 * height / 3 + height / 6 + height / 12, y + 2 * height / 3 + height / 6 }; g.drawPolygon(ptx3, pty3, 6); g.fillPolygon(ptx3, pty3, 6); g.drawOval(x, y + height / 3 - height / 12, width / 8, height / 6); g.setColor(Color.WHITE); g.fillOval(x, y + height / 3 - height / 12, width / 8, height / 6); g.setColor(c); - g.drawOval(x + width - width / 8, y + height / 3 - height / 12, - width / 8, height / 6); + g.drawOval(x + width - width / 8, y + height / 3 - height / 12, width / 8, height / 6); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 8, y + height / 3 - height / 12, - width / 8, height / 6); + g.fillOval(x + width - width / 8, y + height / 3 - height / 12, width / 8, height / 6); g.setColor(c); } @@ -740,26 +649,20 @@ public class ELNComponentIndependentCurrentSource extends int[] pty2 = { y + height / 3, y + height }; g.drawPolygon(ptx2, pty2, 2); g.drawOval(x + width / 4, y + height / 3, width / 2, 2 * height / 3); - int[] ptx3 = { x + 3 * width / 4, x + width / 4 + width / 8, - x + width / 4 + width / 8, x + width / 4, + int[] ptx3 = { x + 3 * width / 4, x + width / 4 + width / 8, x + width / 4 + width / 8, x + width / 4, x + width / 4 + width / 8, x + width / 4 + width / 8 }; - int[] pty3 = { y + height / 3 - height / 6, - y + height / 3 - height / 6, - y + height / 3 - height / 6 - height / 12, - y + height / 3 - height / 6, - y + height / 3 - height / 6 + height / 12, - y + height / 3 - height / 6 }; + int[] pty3 = { y + height / 3 - height / 6, y + height / 3 - height / 6, + y + height / 3 - height / 6 - height / 12, y + height / 3 - height / 6, + y + height / 3 - height / 6 + height / 12, y + height / 3 - height / 6 }; g.drawPolygon(ptx3, pty3, 6); g.fillPolygon(ptx3, pty3, 6); g.drawOval(x, y + 2 * height / 3 - height / 12, width / 8, height / 6); g.setColor(Color.WHITE); g.fillOval(x, y + 2 * height / 3 - height / 12, width / 8, height / 6); g.setColor(c); - g.drawOval(x + width - width / 8, y + 2 * height / 3 - height / 12, - width / 8, height / 6); + g.drawOval(x + width - width / 8, y + 2 * height / 3 - height / 12, width / 8, height / 6); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 8, y + 2 * height / 3 - height / 12, - width / 8, height / 6); + g.fillOval(x + width - width / 8, y + 2 * height / 3 - height / 12, width / 8, height / 6); g.setColor(c); } @@ -775,26 +678,20 @@ public class ELNComponentIndependentCurrentSource extends int[] pty2 = { y + height / 3, y + height }; g.drawPolygon(ptx2, pty2, 2); g.drawOval(x + width / 4, y + height / 3, width / 2, 2 * height / 3); - int[] ptx3 = { x + width / 4, x + 3 * width / 4 - width / 8, - x + 3 * width / 4 - width / 8, x + 3 * width / 4, + int[] ptx3 = { x + width / 4, x + 3 * width / 4 - width / 8, x + 3 * width / 4 - width / 8, x + 3 * width / 4, x + 3 * width / 4 - width / 8, x + 3 * width / 4 - width / 8 }; - int[] pty3 = { y + height / 3 - height / 6, - y + height / 3 - height / 6, - y + height / 3 - height / 6 - height / 12, - y + height / 3 - height / 6, - y + height / 3 - height / 6 + height / 12, - y + height / 3 - height / 6 }; + int[] pty3 = { y + height / 3 - height / 6, y + height / 3 - height / 6, + y + height / 3 - height / 6 - height / 12, y + height / 3 - height / 6, + y + height / 3 - height / 6 + height / 12, y + height / 3 - height / 6 }; g.drawPolygon(ptx3, pty3, 6); g.fillPolygon(ptx3, pty3, 6); g.drawOval(x, y + 2 * height / 3 - height / 12, width / 8, height / 6); g.setColor(Color.WHITE); g.fillOval(x, y + 2 * height / 3 - height / 12, width / 8, height / 6); g.setColor(c); - g.drawOval(x + width - width / 8, y + 2 * height / 3 - height / 12, - width / 8, height / 6); + g.drawOval(x + width - width / 8, y + 2 * height / 3 - height / 12, width / 8, height / 6); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 8, y + 2 * height / 3 - height / 12, - width / 8, height / 6); + g.fillOval(x + width - width / 8, y + 2 * height / 3 - height / 12, width / 8, height / 6); g.setColor(c); } @@ -810,26 +707,20 @@ public class ELNComponentIndependentCurrentSource extends int[] pty2 = { y, y + 2 * height / 3 }; g.drawPolygon(ptx2, pty2, 2); g.drawOval(x + width / 4, y, width / 2, 2 * height / 3); - int[] ptx3 = { x + width / 4, x + 3 * width / 4 - width / 8, - x + 3 * width / 4 - width / 8, x + 3 * width / 4, + int[] ptx3 = { x + width / 4, x + 3 * width / 4 - width / 8, x + 3 * width / 4 - width / 8, x + 3 * width / 4, x + 3 * width / 4 - width / 8, x + 3 * width / 4 - width / 8 }; - int[] pty3 = { y + 2 * height / 3 + height / 6, - y + 2 * height / 3 + height / 6, - y + 2 * height / 3 + height / 6 - height / 12, - y + 2 * height / 3 + height / 6, - y + 2 * height / 3 + height / 6 + height / 12, - y + 2 * height / 3 + height / 6 }; + int[] pty3 = { y + 2 * height / 3 + height / 6, y + 2 * height / 3 + height / 6, + y + 2 * height / 3 + height / 6 - height / 12, y + 2 * height / 3 + height / 6, + y + 2 * height / 3 + height / 6 + height / 12, y + 2 * height / 3 + height / 6 }; g.drawPolygon(ptx3, pty3, 6); g.fillPolygon(ptx3, pty3, 6); g.drawOval(x, y + height / 3 - height / 12, width / 8, height / 6); g.setColor(Color.WHITE); g.fillOval(x, y + height / 3 - height / 12, width / 8, height / 6); g.setColor(c); - g.drawOval(x + width - width / 8, y + height / 3 - height / 12, - width / 8, height / 6); + g.drawOval(x + width - width / 8, y + height / 3 - height / 12, width / 8, height / 6); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 8, y + height / 3 - height / 12, - width / 8, height / 6); + g.fillOval(x + width - width / 8, y + height / 3 - height / 12, width / 8, height / 6); g.setColor(c); } @@ -845,8 +736,7 @@ public class ELNComponentIndependentCurrentSource extends } public boolean editOndoubleClick(JFrame frame) { - JDialogELNComponentIndependentCurrentSource jde = new JDialogELNComponentIndependentCurrentSource( - this); + JDialogELNComponentIndependentCurrentSource jde = new JDialogELNComponentIndependentCurrentSource(this); jde.setVisible(true); return true; } @@ -891,8 +781,7 @@ public class ELNComponentIndependentCurrentSource extends return new String(sb); } - public void loadExtraParam(NodeList nl, int decX, int decY, int decId) - throws MalformedModelingException { + public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException { try { NodeList nli; Node n1, n2; @@ -913,36 +802,22 @@ public class ELNComponentIndependentCurrentSource extends if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; if (elt.getTagName().equals("attributes")) { - initValue = Double.parseDouble(elt - .getAttribute("init_value")); - offset = Double.parseDouble(elt - .getAttribute("offset")); - amplitude = Double.parseDouble(elt - .getAttribute("amplitude")); - frequency = Double.parseDouble(elt - .getAttribute("frequency")); + initValue = Double.parseDouble(elt.getAttribute("init_value")); + offset = Double.parseDouble(elt.getAttribute("offset")); + amplitude = Double.parseDouble(elt.getAttribute("amplitude")); + frequency = Double.parseDouble(elt.getAttribute("frequency")); unit0 = elt.getAttribute("unit0"); - phase = Double.parseDouble(elt - .getAttribute("phase")); + phase = Double.parseDouble(elt.getAttribute("phase")); delay = elt.getAttribute("delay"); - acAmplitude = Double.parseDouble(elt - .getAttribute("ac_amplitude")); - acPhase = Double.parseDouble(elt - .getAttribute("ac_phase")); - acNoiseAmplitude = Double.parseDouble(elt - .getAttribute("ac_noise_amplitude")); - position = Integer.parseInt(elt - .getAttribute("position")); - fv_0_2 = Boolean.parseBoolean(elt - .getAttribute("fv_0_2")); - fv_1_3 = Boolean.parseBoolean(elt - .getAttribute("fv_1_3")); - fh_0_2 = Boolean.parseBoolean(elt - .getAttribute("fh_0_2")); - fh_1_3 = Boolean.parseBoolean(elt - .getAttribute("fh_1_3")); - first = Boolean.parseBoolean(elt - .getAttribute("first")); + acAmplitude = Double.parseDouble(elt.getAttribute("ac_amplitude")); + acPhase = Double.parseDouble(elt.getAttribute("ac_phase")); + acNoiseAmplitude = Double.parseDouble(elt.getAttribute("ac_noise_amplitude")); + position = Integer.parseInt(elt.getAttribute("position")); + fv_0_2 = Boolean.parseBoolean(elt.getAttribute("fv_0_2")); + fv_1_3 = Boolean.parseBoolean(elt.getAttribute("fv_1_3")); + fh_0_2 = Boolean.parseBoolean(elt.getAttribute("fh_0_2")); + fh_1_3 = Boolean.parseBoolean(elt.getAttribute("fh_1_3")); + first = Boolean.parseBoolean(elt.getAttribute("first")); setInitValue(initValue); setOffset(offset); setAmplitude(amplitude); @@ -969,8 +844,7 @@ public class ELNComponentIndependentCurrentSource extends } } - public void addActionToPopupMenu(JPopupMenu componentMenu, - ActionListener menuAL, int x, int y) { + public void addActionToPopupMenu(JPopupMenu componentMenu, ActionListener menuAL, int x, int y) { componentMenu.addSeparator(); JMenuItem rotateright = new JMenuItem("Rotate right 90\u00b0"); @@ -1173,8 +1047,7 @@ public class ELNComponentIndependentCurrentSource extends if ((father != null) && (father instanceof ELNModule)) { resizeToFatherSize(); - setCdRectangle(0, father.getWidth() - getWidth(), 0, - father.getHeight() - getHeight()); + setCdRectangle(0, father.getWidth() - getWidth(), 0, father.getHeight() - getHeight()); setMoveCd(x, y); } } @@ -1187,7 +1060,6 @@ public class ELNComponentIndependentCurrentSource extends myColor = null; setFather(null); TDiagramPanel tdp = getTDiagramPanel(); - setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), - tdp.getMaxY()); + setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY()); } } \ No newline at end of file diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentIndependentVoltageSource.java b/src/main/java/ui/eln/sca_eln/ELNComponentIndependentVoltageSource.java index 859d15414a..8ba943f6f7 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentIndependentVoltageSource.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentIndependentVoltageSource.java @@ -51,16 +51,14 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** - * Class ELNComponentIndependentVoltageSource Independent voltage source to be - * used in ELN diagrams Creation: 15/06/2018 - * + * Class ELNComponentIndependentVoltageSource + * Independent voltage source to be used in ELN diagrams + * Creation: 15/06/2018 * @version 1.0 15/06/2018 * @author Irina Kit Yan LEE */ -public class ELNComponentIndependentVoltageSource extends - TGCScalableWithInternalComponent implements ActionListener, - SwallowedTGComponent, ELNComponent { +public class ELNComponentIndependentVoltageSource extends TGCScalableWithInternalComponent implements ActionListener, SwallowedTGComponent, ELNComponent { protected Color myColor; protected int orientation; private int maxFontSize = 14; @@ -71,20 +69,16 @@ public class ELNComponentIndependentVoltageSource extends private double dtextX = 0.0; protected int decPoint = 3; - private double initValue, offset, amplitude, frequency, phase, acAmplitude, - acPhase, acNoiseAmplitude; + private double initValue, offset, amplitude, frequency, phase, acAmplitude, acPhase, acNoiseAmplitude; private String delay; private String unit0; private int position = 0; - private boolean fv_0_2 = false, fv_1_3 = false, fh_0_2 = false, - fh_1_3 = false; + private boolean fv_0_2 = false, fv_1_3 = false, fh_0_2 = false, fh_1_3 = false; private int old; private boolean first; - public ELNComponentIndependentVoltageSource(int _x, int _y, int _minX, - int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, - TDiagramPanel _tdp) { + public ELNComponentIndependentVoltageSource(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); initScaling(40, 80); @@ -125,10 +119,8 @@ public class ELNComponentIndependentVoltageSource extends public void initPortTerminal(int nb) { nbConnectingPoint = nb; connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "p"); - connectingPoint[1] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "n"); + connectingPoint[0] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "p"); + connectingPoint[1] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "n"); } public Color getMyColor() { @@ -142,10 +134,7 @@ public class ELNComponentIndependentVoltageSource extends if (this.rescaled && !this.tdp.isScaled()) { this.rescaled = false; - int maxCurrentFontSize = Math.max( - 0, - Math.min(this.height, - (int) (this.maxFontSize * this.tdp.getZoom()))); + int maxCurrentFontSize = Math.max(0, Math.min(this.height, (int) (this.maxFontSize * this.tdp.getZoom()))); f = f.deriveFont((float) maxCurrentFontSize); while (maxCurrentFontSize > (this.minFontSize * this.tdp.getZoom() - 1)) { @@ -198,12 +187,9 @@ public class ELNComponentIndependentVoltageSource extends ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 4, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 4, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 4, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 4, + y + height + sh1); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -216,12 +202,9 @@ public class ELNComponentIndependentVoltageSource extends ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 4, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 4, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 4, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 4, + y + height + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -234,12 +217,9 @@ public class ELNComponentIndependentVoltageSource extends ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(0.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 4, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 4, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 4, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 4, + y + height + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -252,12 +232,9 @@ public class ELNComponentIndependentVoltageSource extends ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(0.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 4, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 4, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 4, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 4, + y + height + sh0); } } } else if (position == 1) { @@ -292,12 +269,10 @@ public class ELNComponentIndependentVoltageSource extends ((ELNPortTerminal) connectingPoint[1]).setW(0.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw0, y + height / 2 + height / 4 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height / 2 + height / 4 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw0, + y + height / 2 + height / 4 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height / 2 + height / 4 + sh1); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -310,12 +285,10 @@ public class ELNComponentIndependentVoltageSource extends ((ELNPortTerminal) connectingPoint[1]).setW(0.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw0, y + height / 2 + height / 4 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height / 2 + height / 4 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw0, + y + height / 2 + height / 4 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height / 2 + height / 4 + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -328,12 +301,10 @@ public class ELNComponentIndependentVoltageSource extends ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw1, y + height / 2 + height / 4 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height / 2 + height / 4 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw1, + y + height / 2 + height / 4 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height / 2 + height / 4 + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -346,12 +317,10 @@ public class ELNComponentIndependentVoltageSource extends ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw1, y + height / 2 + height / 4 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height / 2 + height / 4 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw1, + y + height / 2 + height / 4 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height / 2 + height / 4 + sh0); } } } else if (position == 2) { @@ -384,12 +353,9 @@ public class ELNComponentIndependentVoltageSource extends ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(0.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 4, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 4, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 4, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 4, + y + height + sh0); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -402,12 +368,9 @@ public class ELNComponentIndependentVoltageSource extends ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(0.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 4, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 4, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 4, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 4, + y + height + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -420,12 +383,9 @@ public class ELNComponentIndependentVoltageSource extends ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 4, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 4, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 4, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 4, + y + height + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -438,12 +398,9 @@ public class ELNComponentIndependentVoltageSource extends ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 4, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 4, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 4, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 4, + y + height + sh1); } } } else if (position == 3) { @@ -478,12 +435,10 @@ public class ELNComponentIndependentVoltageSource extends ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw1, y + height / 2 + height / 4 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height / 2 + height / 4 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw1, + y + height / 2 + height / 4 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height / 2 + height / 4 + sh0); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -496,12 +451,10 @@ public class ELNComponentIndependentVoltageSource extends ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw1, y + height / 2 + height / 4 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height / 2 + height / 4 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw1, + y + height / 2 + height / 4 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height / 2 + height / 4 + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -514,12 +467,10 @@ public class ELNComponentIndependentVoltageSource extends ((ELNPortTerminal) connectingPoint[1]).setW(0.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw0, y + height / 2 + height / 4 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height / 2 + height / 4 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw0, + y + height / 2 + height / 4 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height / 2 + height / 4 + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -532,12 +483,10 @@ public class ELNComponentIndependentVoltageSource extends ((ELNPortTerminal) connectingPoint[1]).setW(0.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw0, y + height / 2 + height / 4 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height / 2 + height / 4 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw0, + y + height / 2 + height / 4 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height / 2 + height / 4 + sh1); } } } @@ -550,31 +499,24 @@ public class ELNComponentIndependentVoltageSource extends int[] ptx0 = { x + width / 2, x + width / 2 }; int[] pty0 = { y, y + height }; g.drawPolygon(ptx0, pty0, 2); - int[] ptx1 = { x + width / 2 + width / 4, - x + width / 2 + width / 4 + width / 8, - x + width / 2 + width / 4 + width / 8, - x + width / 2 + width / 4 + width / 8, + int[] ptx1 = { x + width / 2 + width / 4, x + width / 2 + width / 4 + width / 8, + x + width / 2 + width / 4 + width / 8, x + width / 2 + width / 4 + width / 8, x + width / 2 + width / 4 + width / 8, x + width }; - int[] pty1 = { y + height / 4 - height / 8, - y + height / 4 - height / 8, - y + height / 4 - height / 8 - width / 8, - y + height / 4 - height / 8 + width / 8, + int[] pty1 = { y + height / 4 - height / 8, y + height / 4 - height / 8, + y + height / 4 - height / 8 - width / 8, y + height / 4 - height / 8 + width / 8, y + height / 4 - height / 8, y + height / 4 - height / 8 }; g.drawPolygon(ptx1, pty1, 6); int[] ptx2 = { x + width / 2 + width / 4, x + width }; - int[] pty2 = { y + 3 * height / 4 + height / 8, - y + 3 * height / 4 + height / 8 }; + int[] pty2 = { y + 3 * height / 4 + height / 8, y + 3 * height / 4 + height / 8 }; g.drawPolygon(ptx2, pty2, 2); g.drawOval(x, y + height / 4, width, height / 2); g.drawOval(x + width / 2 - width / 8, y, width / 4, height / 8); g.setColor(Color.WHITE); g.fillOval(x + width / 2 - width / 8, y, width / 4, height / 8); g.setColor(c); - g.drawOval(x + width / 2 - width / 8, y + height - height / 8, - width / 4, height / 8); + g.drawOval(x + width / 2 - width / 8, y + height - height / 8, width / 4, height / 8); g.setColor(Color.WHITE); - g.fillOval(x + width / 2 - width / 8, y + height - height / 8, - width / 4, height / 8); + g.fillOval(x + width / 2 - width / 8, y + height - height / 8, width / 4, height / 8); g.setColor(c); } @@ -583,17 +525,12 @@ public class ELNComponentIndependentVoltageSource extends int[] ptx0 = { x + width / 2, x + width / 2 }; int[] pty0 = { y, y + height }; g.drawPolygon(ptx0, pty0, 2); - int[] ptx1 = { x + width / 2 + width / 4, - x + width / 2 + width / 4 + width / 8, - x + width / 2 + width / 4 + width / 8, - x + width / 2 + width / 4 + width / 8, + int[] ptx1 = { x + width / 2 + width / 4, x + width / 2 + width / 4 + width / 8, + x + width / 2 + width / 4 + width / 8, x + width / 2 + width / 4 + width / 8, x + width / 2 + width / 4 + width / 8, x + width }; - int[] pty1 = { y + 3 * height / 4 + height / 8, - y + 3 * height / 4 + height / 8, - y + 3 * height / 4 + height / 8 + width / 8, - y + 3 * height / 4 + height / 8 - width / 8, - y + 3 * height / 4 + height / 8, - y + 3 * height / 4 + height / 8 }; + int[] pty1 = { y + 3 * height / 4 + height / 8, y + 3 * height / 4 + height / 8, + y + 3 * height / 4 + height / 8 + width / 8, y + 3 * height / 4 + height / 8 - width / 8, + y + 3 * height / 4 + height / 8, y + 3 * height / 4 + height / 8 }; g.drawPolygon(ptx1, pty1, 6); int[] ptx2 = { x + width / 2 + width / 4, x + width }; int[] pty2 = { y + height / 8, y + height / 8 }; @@ -603,11 +540,9 @@ public class ELNComponentIndependentVoltageSource extends g.setColor(Color.WHITE); g.fillOval(x + width / 2 - width / 8, y, width / 4, height / 8); g.setColor(c); - g.drawOval(x + width / 2 - width / 8, y + height - height / 8, - width / 4, height / 8); + g.drawOval(x + width / 2 - width / 8, y + height - height / 8, width / 4, height / 8); g.setColor(Color.WHITE); - g.fillOval(x + width / 2 - width / 8, y + height - height / 8, - width / 4, height / 8); + g.fillOval(x + width / 2 - width / 8, y + height - height / 8, width / 4, height / 8); g.setColor(c); } @@ -616,17 +551,12 @@ public class ELNComponentIndependentVoltageSource extends int[] ptx0 = { x + width / 2, x + width / 2 }; int[] pty0 = { y, y + height }; g.drawPolygon(ptx0, pty0, 2); - int[] ptx1 = { x + width / 2 - width / 4, - x + width / 2 - width / 4 - width / 8, - x + width / 2 - width / 4 - width / 8, - x + width / 2 - width / 4 - width / 8, + int[] ptx1 = { x + width / 2 - width / 4, x + width / 2 - width / 4 - width / 8, + x + width / 2 - width / 4 - width / 8, x + width / 2 - width / 4 - width / 8, x + width / 2 - width / 4 - width / 8, x }; - int[] pty1 = { y + 3 * height / 4 + height / 8, - y + 3 * height / 4 + height / 8, - y + 3 * height / 4 + height / 8 + width / 8, - y + 3 * height / 4 + height / 8 - width / 8, - y + 3 * height / 4 + height / 8, - y + 3 * height / 4 + height / 8 }; + int[] pty1 = { y + 3 * height / 4 + height / 8, y + 3 * height / 4 + height / 8, + y + 3 * height / 4 + height / 8 + width / 8, y + 3 * height / 4 + height / 8 - width / 8, + y + 3 * height / 4 + height / 8, y + 3 * height / 4 + height / 8 }; g.drawPolygon(ptx1, pty1, 6); int[] ptx2 = { x + width / 2 - width / 4, x }; int[] pty2 = { y + height / 4 - height / 8, y + height / 4 - height / 8 }; @@ -636,11 +566,9 @@ public class ELNComponentIndependentVoltageSource extends g.setColor(Color.WHITE); g.fillOval(x + width / 2 - width / 8, y, width / 4, height / 8); g.setColor(c); - g.drawOval(x + width / 2 - width / 8, y + height - height / 8, - width / 4, height / 8); + g.drawOval(x + width / 2 - width / 8, y + height - height / 8, width / 4, height / 8); g.setColor(Color.WHITE); - g.fillOval(x + width / 2 - width / 8, y + height - height / 8, - width / 4, height / 8); + g.fillOval(x + width / 2 - width / 8, y + height - height / 8, width / 4, height / 8); g.setColor(c); } @@ -649,29 +577,23 @@ public class ELNComponentIndependentVoltageSource extends int[] ptx0 = { x + width / 2, x + width / 2 }; int[] pty0 = { y, y + height }; g.drawPolygon(ptx0, pty0, 2); - int[] ptx1 = { x + width / 2 - width / 4, - x + width / 2 - width / 4 - width / 8, - x + width / 2 - width / 4 - width / 8, - x + width / 2 - width / 4 - width / 8, + int[] ptx1 = { x + width / 2 - width / 4, x + width / 2 - width / 4 - width / 8, + x + width / 2 - width / 4 - width / 8, x + width / 2 - width / 4 - width / 8, x + width / 2 - width / 4 - width / 8, x }; - int[] pty1 = { y + height / 8, y + height / 8, - y + height / 8 + width / 8, y + height / 8 - width / 8, + int[] pty1 = { y + height / 8, y + height / 8, y + height / 8 + width / 8, y + height / 8 - width / 8, y + height / 8, y + height / 8 }; g.drawPolygon(ptx1, pty1, 6); int[] ptx2 = { x + width / 2 - width / 4, x }; - int[] pty2 = { y + 3 * height / 4 + height / 8, - y + 3 * height / 4 + height / 8 }; + int[] pty2 = { y + 3 * height / 4 + height / 8, y + 3 * height / 4 + height / 8 }; g.drawPolygon(ptx2, pty2, 2); g.drawOval(x, y + height / 4, width, height / 2); g.drawOval(x + width / 2 - width / 8, y, width / 4, height / 8); g.setColor(Color.WHITE); g.fillOval(x + width / 2 - width / 8, y, width / 4, height / 8); g.setColor(c); - g.drawOval(x + width / 2 - width / 8, y + height - height / 8, - width / 4, height / 8); + g.drawOval(x + width / 2 - width / 8, y + height - height / 8, width / 4, height / 8); g.setColor(Color.WHITE); - g.fillOval(x + width / 2 - width / 8, y + height - height / 8, - width / 4, height / 8); + g.fillOval(x + width / 2 - width / 8, y + height - height / 8, width / 4, height / 8); g.setColor(c); } @@ -680,14 +602,10 @@ public class ELNComponentIndependentVoltageSource extends int[] ptx0 = { x, x + width }; int[] pty0 = { y + height / 2, y + height / 2 }; g.drawPolygon(ptx0, pty0, 2); - int[] ptx1 = { x + width - width / 8, x + width - width / 8, - x + width - width / 8 - height / 8, - x + width - width / 8 + height / 8, x + width - width / 8, - x + width - width / 8 }; - int[] pty1 = { y + height / 2 + height / 4, - y + height / 2 + height / 4 + height / 8, - y + height / 2 + height / 4 + height / 8, - y + height / 2 + height / 4 + height / 8, + int[] ptx1 = { x + width - width / 8, x + width - width / 8, x + width - width / 8 - height / 8, + x + width - width / 8 + height / 8, x + width - width / 8, x + width - width / 8 }; + int[] pty1 = { y + height / 2 + height / 4, y + height / 2 + height / 4 + height / 8, + y + height / 2 + height / 4 + height / 8, y + height / 2 + height / 4 + height / 8, y + height / 2 + height / 4 + height / 8, y + height }; g.drawPolygon(ptx1, pty1, 6); int[] ptx2 = { x + width / 8, x + width / 8 }; @@ -698,11 +616,9 @@ public class ELNComponentIndependentVoltageSource extends g.setColor(Color.WHITE); g.fillOval(x, y + height / 2 - height / 8, width / 8, height / 4); g.setColor(c); - g.drawOval(x + width - width / 8, y + height / 2 - height / 8, - width / 8, height / 4); + g.drawOval(x + width - width / 8, y + height / 2 - height / 8, width / 8, height / 4); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 8, y + height / 2 - height / 8, - width / 8, height / 4); + g.fillOval(x + width - width / 8, y + height / 2 - height / 8, width / 8, height / 4); g.setColor(c); } @@ -711,13 +627,10 @@ public class ELNComponentIndependentVoltageSource extends int[] ptx0 = { x, x + width }; int[] pty0 = { y + height / 2, y + height / 2 }; g.drawPolygon(ptx0, pty0, 2); - int[] ptx1 = { x + width - width / 8, x + width - width / 8, - x + width - width / 8 - height / 8, - x + width - width / 8 + height / 8, x + width - width / 8, - x + width - width / 8 }; - int[] pty1 = { y + height / 4, y + height / 4 - height / 8, - y + height / 4 - height / 8, y + height / 4 - height / 8, - y + height / 4 - height / 8, y }; + int[] ptx1 = { x + width - width / 8, x + width - width / 8, x + width - width / 8 - height / 8, + x + width - width / 8 + height / 8, x + width - width / 8, x + width - width / 8 }; + int[] pty1 = { y + height / 4, y + height / 4 - height / 8, y + height / 4 - height / 8, + y + height / 4 - height / 8, y + height / 4 - height / 8, y }; g.drawPolygon(ptx1, pty1, 6); int[] ptx2 = { x + width / 8, x + width / 8 }; int[] pty2 = { y + height / 4, y }; @@ -727,11 +640,9 @@ public class ELNComponentIndependentVoltageSource extends g.setColor(Color.WHITE); g.fillOval(x, y + height / 2 - height / 8, width / 8, height / 4); g.setColor(c); - g.drawOval(x + width - width / 8, y + height / 2 - height / 8, - width / 8, height / 4); + g.drawOval(x + width - width / 8, y + height / 2 - height / 8, width / 8, height / 4); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 8, y + height / 2 - height / 8, - width / 8, height / 4); + g.fillOval(x + width - width / 8, y + height / 2 - height / 8, width / 8, height / 4); g.setColor(c); } @@ -740,18 +651,13 @@ public class ELNComponentIndependentVoltageSource extends int[] ptx0 = { x, x + width }; int[] pty0 = { y + height / 2, y + height / 2 }; g.drawPolygon(ptx0, pty0, 2); - int[] ptx1 = { x + width / 4 - width / 8, x + width / 4 - width / 8, - x + width / 4 - width / 8 - height / 8, - x + width / 4 - width / 8 + height / 8, - x + width / 4 - width / 8, x + width / 4 - width / 8 }; - int[] pty1 = { y + height / 2 - height / 4, - y + height / 2 - height / 4 - height / 8, - y + height / 2 - height / 4 - height / 8, - y + height / 2 - height / 4 - height / 8, + int[] ptx1 = { x + width / 4 - width / 8, x + width / 4 - width / 8, x + width / 4 - width / 8 - height / 8, + x + width / 4 - width / 8 + height / 8, x + width / 4 - width / 8, x + width / 4 - width / 8 }; + int[] pty1 = { y + height / 2 - height / 4, y + height / 2 - height / 4 - height / 8, + y + height / 2 - height / 4 - height / 8, y + height / 2 - height / 4 - height / 8, y + height / 2 - height / 4 - height / 8, y }; g.drawPolygon(ptx1, pty1, 6); - int[] ptx2 = { x + 3 * width / 4 + width / 8, - x + 3 * width / 4 + width / 8 }; + int[] ptx2 = { x + 3 * width / 4 + width / 8, x + 3 * width / 4 + width / 8 }; int[] pty2 = { y + height / 2 - height / 4, y }; g.drawPolygon(ptx2, pty2, 2); g.drawOval(x + width / 4, y, width / 2, height); @@ -759,11 +665,9 @@ public class ELNComponentIndependentVoltageSource extends g.setColor(Color.WHITE); g.fillOval(x, y + height / 2 - height / 8, width / 8, height / 4); g.setColor(c); - g.drawOval(x + width - width / 8, y + height / 2 - height / 8, - width / 8, height / 4); + g.drawOval(x + width - width / 8, y + height / 2 - height / 8, width / 8, height / 4); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 8, y + height / 2 - height / 8, - width / 8, height / 4); + g.fillOval(x + width - width / 8, y + height / 2 - height / 8, width / 8, height / 4); g.setColor(c); } @@ -772,18 +676,13 @@ public class ELNComponentIndependentVoltageSource extends int[] ptx0 = { x, x + width }; int[] pty0 = { y + height / 2, y + height / 2 }; g.drawPolygon(ptx0, pty0, 2); - int[] ptx1 = { x + width / 4 - width / 8, x + width / 4 - width / 8, - x + width / 4 - width / 8 - height / 8, - x + width / 4 - width / 8 + height / 8, - x + width / 4 - width / 8, x + width / 4 - width / 8 }; - int[] pty1 = { y + height / 2 + height / 4, - y + height / 2 + height / 4 + height / 8, - y + height / 2 + height / 4 + height / 8, - y + height / 2 + height / 4 + height / 8, + int[] ptx1 = { x + width / 4 - width / 8, x + width / 4 - width / 8, x + width / 4 - width / 8 - height / 8, + x + width / 4 - width / 8 + height / 8, x + width / 4 - width / 8, x + width / 4 - width / 8 }; + int[] pty1 = { y + height / 2 + height / 4, y + height / 2 + height / 4 + height / 8, + y + height / 2 + height / 4 + height / 8, y + height / 2 + height / 4 + height / 8, y + height / 2 + height / 4 + height / 8, y + height }; g.drawPolygon(ptx1, pty1, 6); - int[] ptx2 = { x + 3 * width / 4 + width / 8, - x + 3 * width / 4 + width / 8 }; + int[] ptx2 = { x + 3 * width / 4 + width / 8, x + 3 * width / 4 + width / 8 }; int[] pty2 = { y + height / 2 + height / 4, y + height }; g.drawPolygon(ptx2, pty2, 2); g.drawOval(x + width / 4, y, width / 2, height); @@ -791,11 +690,9 @@ public class ELNComponentIndependentVoltageSource extends g.setColor(Color.WHITE); g.fillOval(x, y + height / 2 - height / 8, width / 8, height / 4); g.setColor(c); - g.drawOval(x + width - width / 8, y + height / 2 - height / 8, - width / 8, height / 4); + g.drawOval(x + width - width / 8, y + height / 2 - height / 8, width / 8, height / 4); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 8, y + height / 2 - height / 8, - width / 8, height / 4); + g.fillOval(x + width - width / 8, y + height / 2 - height / 8, width / 8, height / 4); g.setColor(c); } @@ -811,8 +708,7 @@ public class ELNComponentIndependentVoltageSource extends } public boolean editOndoubleClick(JFrame frame) { - JDialogELNComponentIndependentVoltageSource jde = new JDialogELNComponentIndependentVoltageSource( - this); + JDialogELNComponentIndependentVoltageSource jde = new JDialogELNComponentIndependentVoltageSource(this); jde.setVisible(true); return true; } @@ -859,8 +755,7 @@ public class ELNComponentIndependentVoltageSource extends return new String(sb); } - public void loadExtraParam(NodeList nl, int decX, int decY, int decId) - throws MalformedModelingException { + public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException { try { NodeList nli; Node n1, n2; @@ -881,40 +776,24 @@ public class ELNComponentIndependentVoltageSource extends if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; if (elt.getTagName().equals("attributes")) { - initValue = Double.parseDouble(elt - .getAttribute("init_value")); - offset = Double.parseDouble(elt - .getAttribute("offset")); - amplitude = Double.parseDouble(elt - .getAttribute("amplitude")); - frequency = Double.parseDouble(elt - .getAttribute("frequency")); + initValue = Double.parseDouble(elt.getAttribute("init_value")); + offset = Double.parseDouble(elt.getAttribute("offset")); + amplitude = Double.parseDouble(elt.getAttribute("amplitude")); + frequency = Double.parseDouble(elt.getAttribute("frequency")); unit0 = elt.getAttribute("unit0"); - phase = Double.parseDouble(elt - .getAttribute("phase")); + phase = Double.parseDouble(elt.getAttribute("phase")); delay = elt.getAttribute("delay"); - acAmplitude = Double.parseDouble(elt - .getAttribute("ac_amplitude")); - acPhase = Double.parseDouble(elt - .getAttribute("ac_phase")); - acNoiseAmplitude = Double.parseDouble(elt - .getAttribute("ac_noise_amplitude")); - position = Integer.parseInt(elt - .getAttribute("position")); - width = Integer.parseInt(elt - .getAttribute("width")); - height = Integer.parseInt(elt - .getAttribute("height")); - fv_0_2 = Boolean.parseBoolean(elt - .getAttribute("fv_0_2")); - fv_1_3 = Boolean.parseBoolean(elt - .getAttribute("fv_1_3")); - fh_0_2 = Boolean.parseBoolean(elt - .getAttribute("fh_0_2")); - fh_1_3 = Boolean.parseBoolean(elt - .getAttribute("fh_1_3")); - first = Boolean.parseBoolean(elt - .getAttribute("first")); + acAmplitude = Double.parseDouble(elt.getAttribute("ac_amplitude")); + acPhase = Double.parseDouble(elt.getAttribute("ac_phase")); + acNoiseAmplitude = Double.parseDouble(elt.getAttribute("ac_noise_amplitude")); + position = Integer.parseInt(elt.getAttribute("position")); + width = Integer.parseInt(elt.getAttribute("width")); + height = Integer.parseInt(elt.getAttribute("height")); + fv_0_2 = Boolean.parseBoolean(elt.getAttribute("fv_0_2")); + fv_1_3 = Boolean.parseBoolean(elt.getAttribute("fv_1_3")); + fh_0_2 = Boolean.parseBoolean(elt.getAttribute("fh_0_2")); + fh_1_3 = Boolean.parseBoolean(elt.getAttribute("fh_1_3")); + first = Boolean.parseBoolean(elt.getAttribute("first")); setInitValue(initValue); setOffset(offset); setAmplitude(amplitude); @@ -943,8 +822,7 @@ public class ELNComponentIndependentVoltageSource extends } } - public void addActionToPopupMenu(JPopupMenu componentMenu, - ActionListener menuAL, int x, int y) { + public void addActionToPopupMenu(JPopupMenu componentMenu, ActionListener menuAL, int x, int y) { componentMenu.addSeparator(); JMenuItem rotateright = new JMenuItem("Rotate right 90\u00b0"); @@ -1147,8 +1025,7 @@ public class ELNComponentIndependentVoltageSource extends if ((father != null) && (father instanceof ELNModule)) { resizeToFatherSize(); - setCdRectangle(0, father.getWidth() - getWidth(), 0, - father.getHeight() - getHeight()); + setCdRectangle(0, father.getWidth() - getWidth(), 0, father.getHeight() - getHeight()); setMoveCd(x, y); } } @@ -1161,7 +1038,6 @@ public class ELNComponentIndependentVoltageSource extends myColor = null; setFather(null); TDiagramPanel tdp = getTDiagramPanel(); - setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), - tdp.getMaxY()); + setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY()); } } \ No newline at end of file diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentInductor.java b/src/main/java/ui/eln/sca_eln/ELNComponentInductor.java index 17837dbea5..456ac441c1 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentInductor.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentInductor.java @@ -52,15 +52,14 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** - * Class ELNComponentInductor Inductor to be used in ELN diagrams Creation: - * 12/06/2018 - * + * Class ELNComponentInductor + * Inductor to be used in ELN diagrams + * Creation: 12/06/2018 * @version 1.0 12/06/2018 * @author Irina Kit Yan LEE */ -public class ELNComponentInductor extends TGCScalableWithInternalComponent - implements ActionListener, SwallowedTGComponent, ELNComponent { +public class ELNComponentInductor extends TGCScalableWithInternalComponent implements ActionListener, SwallowedTGComponent, ELNComponent { protected Color myColor; protected int orientation; private int maxFontSize = 14; @@ -75,14 +74,11 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent private String unit0, unit1; private int position = 0; - private boolean fv_0_2 = false, fv_1_3 = false, fh_0_2 = false, - fh_1_3 = false; + private boolean fv_0_2 = false, fv_1_3 = false, fh_0_2 = false, fh_1_3 = false; private int old; private boolean first; - public ELNComponentInductor(int _x, int _y, int _minX, int _maxX, - int _minY, int _maxY, boolean _pos, TGComponent _father, - TDiagramPanel _tdp) { + public ELNComponentInductor(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); initScaling(100, 20); @@ -117,10 +113,8 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent public void initPortTerminal(int nb) { nbConnectingPoint = nb; connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "p"); - connectingPoint[1] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "n"); + connectingPoint[0] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "p"); + connectingPoint[1] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "n"); } public Color getMyColor() { @@ -134,10 +128,7 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent if (this.rescaled && !this.tdp.isScaled()) { this.rescaled = false; - int maxCurrentFontSize = Math.max( - 0, - Math.min(this.height, - (int) (this.maxFontSize * this.tdp.getZoom()))); + int maxCurrentFontSize = Math.max(0, Math.min(this.height, (int) (this.maxFontSize * this.tdp.getZoom()))); f = f.deriveFont((float) maxCurrentFontSize); while (maxCurrentFontSize > (this.minFontSize * this.tdp.getZoom() - 1)) { @@ -192,12 +183,10 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + height / 2 + height / 2 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height / 2 + height / 2 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + height / 2 + height / 2 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height / 2 + height / 2 + sh1); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -210,12 +199,10 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + height / 2 + height / 2 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height / 2 + height / 2 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + height / 2 + height / 2 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height / 2 + height / 2 + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -228,12 +215,10 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + height / 2 + height / 2 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height / 2 + height / 2 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + height / 2 + height / 2 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height / 2 + height / 2 + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -246,12 +231,10 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + height / 2 + height / 2 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height / 2 + height / 2 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + height / 2 + height / 2 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height / 2 + height / 2 + sh0); } } } else if (position == 1) { @@ -284,12 +267,9 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 2, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 2, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 2, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 2, + y + height + sh1); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -302,12 +282,9 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(0.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 2, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 2, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 2, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 2, + y + height + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -320,12 +297,9 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 2, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 2, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 2, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 2, + y + height + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -338,12 +312,9 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(0.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 2, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 2, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 2, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 2, + y + height + sh0); } } } else if (position == 2) { @@ -378,12 +349,10 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + height / 2 + height / 2 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height / 2 + height / 2 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + height / 2 + height / 2 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height / 2 + height / 2 + sh0); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -396,12 +365,10 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + height / 2 + height / 2 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height / 2 + height / 2 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + height / 2 + height / 2 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height / 2 + height / 2 + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -414,12 +381,10 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + height / 2 + height / 2 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height / 2 + height / 2 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + height / 2 + height / 2 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height / 2 + height / 2 + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -432,12 +397,10 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + height / 2 + height / 2 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height / 2 + height / 2 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + height / 2 + height / 2 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height / 2 + height / 2 + sh1); } } } else if (position == 3) { @@ -470,12 +433,9 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(0.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 2, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 2, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 2, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 2, + y + height + sh0); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -488,12 +448,9 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 2, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 2, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 2, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 2, + y + height + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -506,12 +463,9 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(0.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 2, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 2, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 2, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 2, + y + height + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -525,12 +479,9 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 2, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 2, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 2, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 2, + y + height + sh1); } } } @@ -549,11 +500,9 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent g.setColor(Color.WHITE); g.fillOval(x, y + height / 2 - height / 4, width / 10, height / 2); g.setColor(c); - g.drawOval(x + width - width / 10, y + height / 2 - height / 4, - width / 10, height / 2); + g.drawOval(x + width - width / 10, y + height / 2 - height / 4, width / 10, height / 2); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 10, y + height / 2 - height / 4, - width / 10, height / 2); + g.fillOval(x + width - width / 10, y + height / 2 - height / 4, width / 10, height / 2); g.setColor(c); } @@ -568,11 +517,9 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent g.setColor(Color.WHITE); g.fillOval(x, y + height / 2 - height / 4, width / 10, height / 2); g.setColor(c); - g.drawOval(x + width - width / 10, y + height / 2 - height / 4, - width / 10, height / 2); + g.drawOval(x + width - width / 10, y + height / 2 - height / 4, width / 10, height / 2); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 10, y + height / 2 - height / 4, - width / 10, height / 2); + g.fillOval(x + width - width / 10, y + height / 2 - height / 4, width / 10, height / 2); g.setColor(c); } @@ -587,11 +534,9 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent g.setColor(Color.WHITE); g.fillOval(x + width / 2 - width / 4, y, width / 2, height / 10); g.setColor(c); - g.drawOval(x + width / 2 - width / 4, y + height - height / 10, - width / 2, height / 10); + g.drawOval(x + width / 2 - width / 4, y + height - height / 10, width / 2, height / 10); g.setColor(Color.WHITE); - g.fillOval(x + width / 2 - width / 4, y + height - height / 10, - width / 2, height / 10); + g.fillOval(x + width / 2 - width / 4, y + height - height / 10, width / 2, height / 10); g.setColor(c); } @@ -606,11 +551,9 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent g.setColor(Color.WHITE); g.fillOval(x + width / 2 - width / 4, y, width / 2, height / 10); g.setColor(c); - g.drawOval(x + width / 2 - width / 4, y + height - height / 10, - width / 2, height / 10); + g.drawOval(x + width / 2 - width / 4, y + height - height / 10, width / 2, height / 10); g.setColor(Color.WHITE); - g.fillOval(x + width / 2 - width / 4, y + height - height / 10, - width / 2, height / 10); + g.fillOval(x + width / 2 - width / 4, y + height - height / 10, width / 2, height / 10); g.setColor(c); } @@ -667,8 +610,7 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent return new String(sb); } - public void loadExtraParam(NodeList nl, int decX, int decY, int decId) - throws MalformedModelingException { + public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException { try { NodeList nli; Node n1, n2; @@ -688,24 +630,16 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; if (elt.getTagName().equals("attributes")) { - value = Double.parseDouble(elt - .getAttribute("value")); - phi0 = Double.parseDouble(elt - .getAttribute("phi0")); + value = Double.parseDouble(elt.getAttribute("value")); + phi0 = Double.parseDouble(elt.getAttribute("phi0")); unit0 = elt.getAttribute("unit0"); unit1 = elt.getAttribute("unit1"); - position = Integer.parseInt(elt - .getAttribute("position")); - fv_0_2 = Boolean.parseBoolean(elt - .getAttribute("fv_0_2")); - fv_1_3 = Boolean.parseBoolean(elt - .getAttribute("fv_1_3")); - fh_0_2 = Boolean.parseBoolean(elt - .getAttribute("fh_0_2")); - fh_1_3 = Boolean.parseBoolean(elt - .getAttribute("fh_1_3")); - first = Boolean.parseBoolean(elt - .getAttribute("first")); + position = Integer.parseInt(elt.getAttribute("position")); + fv_0_2 = Boolean.parseBoolean(elt.getAttribute("fv_0_2")); + fv_1_3 = Boolean.parseBoolean(elt.getAttribute("fv_1_3")); + fh_0_2 = Boolean.parseBoolean(elt.getAttribute("fh_0_2")); + fh_1_3 = Boolean.parseBoolean(elt.getAttribute("fh_1_3")); + first = Boolean.parseBoolean(elt.getAttribute("first")); setVal(value); setPhi0(phi0); setUnit0(unit0); @@ -726,8 +660,7 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent } } - public void addActionToPopupMenu(JPopupMenu componentMenu, - ActionListener menuAL, int x, int y) { + public void addActionToPopupMenu(JPopupMenu componentMenu, ActionListener menuAL, int x, int y) { componentMenu.addSeparator(); JMenuItem rotateright = new JMenuItem("Rotate right 90\u00b0"); @@ -882,8 +815,7 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent if ((father != null) && (father instanceof ELNModule)) { resizeToFatherSize(); - setCdRectangle(0, father.getWidth() - getWidth(), 0, - father.getHeight() - getHeight()); + setCdRectangle(0, father.getWidth() - getWidth(), 0, father.getHeight() - getHeight()); setMoveCd(x, y); } } @@ -896,7 +828,6 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent myColor = null; setFather(null); TDiagramPanel tdp = getTDiagramPanel(); - setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), - tdp.getMaxY()); + setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY()); } } \ No newline at end of file diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentNodeRef.java b/src/main/java/ui/eln/sca_eln/ELNComponentNodeRef.java index 563075d077..2bd837b8f3 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentNodeRef.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentNodeRef.java @@ -53,15 +53,14 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** - * Class ELNComponentNodeRef Reference node to be used in ELN diagrams Creation: - * 27/06/2018 - * + * Class ELNComponentNodeRef + * Reference node to be used in ELN diagrams + * Creation: 27/06/2018 * @version 1.0 27/06/2018 * @author Irina Kit Yan LEE */ -public class ELNComponentNodeRef extends TGCScalableWithInternalComponent - implements ActionListener, SwallowedTGComponent { +public class ELNComponentNodeRef extends TGCScalableWithInternalComponent implements ActionListener, SwallowedTGComponent { protected Color myColor; protected int orientation; private int maxFontSize = 14; @@ -73,13 +72,11 @@ public class ELNComponentNodeRef extends TGCScalableWithInternalComponent protected int decPoint = 3; private int position = 0; - private boolean fv_0_2 = false, fv_1_3 = false, fh_0_2 = false, - fh_1_3 = false; + private boolean fv_0_2 = false, fv_1_3 = false, fh_0_2 = false, fh_1_3 = false; private int old; private boolean first; - public ELNComponentNodeRef(int _x, int _y, int _minX, int _maxX, int _minY, - int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { + public ELNComponentNodeRef(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); initScaling(40, 40); @@ -109,8 +106,7 @@ public class ELNComponentNodeRef extends TGCScalableWithInternalComponent public void initConnectingPoint(int nb) { nbConnectingPoint = nb; connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, true, - 0.0, 0.0); + connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, true, 0.0, 0.0); } public Color getMyColor() { @@ -124,10 +120,7 @@ public class ELNComponentNodeRef extends TGCScalableWithInternalComponent if (this.rescaled && !this.tdp.isScaled()) { this.rescaled = false; - int maxCurrentFontSize = Math.max( - 0, - Math.min(this.height, - (int) (this.maxFontSize * this.tdp.getZoom()))); + int maxCurrentFontSize = Math.max(0, Math.min(this.height, (int) (this.maxFontSize * this.tdp.getZoom()))); f = f.deriveFont((float) maxCurrentFontSize); while (maxCurrentFontSize > (this.minFontSize * this.tdp.getZoom() - 1)) { @@ -354,37 +347,29 @@ public class ELNComponentNodeRef extends TGCScalableWithInternalComponent } private void rotateTop(Graphics g) { - int[] ptx = { x + width / 2, x + width / 2, x, x, x + width, x + width, - x + width / 2 }; - int[] pty = { y, y + height / 2, y + height / 2, y + height, - y + height, y + height / 2, y + height / 2 }; + int[] ptx = { x + width / 2, x + width / 2, x, x, x + width, x + width, x + width / 2 }; + int[] pty = { y, y + height / 2, y + height / 2, y + height, y + height, y + height / 2, y + height / 2 }; g.drawPolygon(ptx, pty, 7); g.fillPolygon(ptx, pty, 7); } private void rotateBottom(Graphics g) { - int[] ptx = { x + width / 2, x + width / 2, x, x, x + width, x + width, - x + width / 2 }; - int[] pty = { y + height, y + height / 2, y + height / 2, y, y, - y + height / 2, y + height / 2 }; + int[] ptx = { x + width / 2, x + width / 2, x, x, x + width, x + width, x + width / 2 }; + int[] pty = { y + height, y + height / 2, y + height / 2, y, y, y + height / 2, y + height / 2 }; g.drawPolygon(ptx, pty, 7); g.fillPolygon(ptx, pty, 7); } private void rotateRight(Graphics g) { - int[] ptx = { x + width, x + width / 2, x + width / 2, x, x, - x + width / 2, x + width / 2 }; - int[] pty = { y + height / 2, y + height / 2, y, y, y + height, - y + height, y + height / 2 }; + int[] ptx = { x + width, x + width / 2, x + width / 2, x, x, x + width / 2, x + width / 2 }; + int[] pty = { y + height / 2, y + height / 2, y, y, y + height, y + height, y + height / 2 }; g.drawPolygon(ptx, pty, 7); g.fillPolygon(ptx, pty, 7); } private void rotateLeft(Graphics g) { - int[] ptx = { x, x + width / 2, x + width / 2, x + width, x + width, - x + width / 2, x + width / 2 }; - int[] pty = { y + height / 2, y + height / 2, y, y, y + height, - y + height, y + height / 2 }; + int[] ptx = { x, x + width / 2, x + width / 2, x + width, x + width, x + width / 2, x + width / 2 }; + int[] pty = { y + height / 2, y + height / 2, y, y, y + height, y + height, y + height / 2 }; g.drawPolygon(ptx, pty, 7); g.fillPolygon(ptx, pty, 7); } @@ -419,8 +404,7 @@ public class ELNComponentNodeRef extends TGCScalableWithInternalComponent return new String(sb); } - public void loadExtraParam(NodeList nl, int decX, int decY, int decId) - throws MalformedModelingException { + public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException { try { NodeList nli; Node n1, n2; @@ -438,18 +422,12 @@ public class ELNComponentNodeRef extends TGCScalableWithInternalComponent if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; if (elt.getTagName().equals("attributes")) { - position = Integer.parseInt(elt - .getAttribute("position")); - fv_0_2 = Boolean.parseBoolean(elt - .getAttribute("fv_0_2")); - fv_1_3 = Boolean.parseBoolean(elt - .getAttribute("fv_1_3")); - fh_0_2 = Boolean.parseBoolean(elt - .getAttribute("fh_0_2")); - fh_1_3 = Boolean.parseBoolean(elt - .getAttribute("fh_1_3")); - first = Boolean.parseBoolean(elt - .getAttribute("first")); + position = Integer.parseInt(elt.getAttribute("position")); + fv_0_2 = Boolean.parseBoolean(elt.getAttribute("fv_0_2")); + fv_1_3 = Boolean.parseBoolean(elt.getAttribute("fv_1_3")); + fh_0_2 = Boolean.parseBoolean(elt.getAttribute("fh_0_2")); + fh_1_3 = Boolean.parseBoolean(elt.getAttribute("fh_1_3")); + first = Boolean.parseBoolean(elt.getAttribute("first")); setPosition(position); setFv_0_2(fv_0_2); setFv_1_3(fv_1_3); @@ -466,8 +444,7 @@ public class ELNComponentNodeRef extends TGCScalableWithInternalComponent } } - public void addActionToPopupMenu(JPopupMenu componentMenu, - ActionListener menuAL, int x, int y) { + public void addActionToPopupMenu(JPopupMenu componentMenu, ActionListener menuAL, int x, int y) { componentMenu.addSeparator(); JMenuItem rotateright = new JMenuItem("Rotate right 90\u00b0"); @@ -590,8 +567,7 @@ public class ELNComponentNodeRef extends TGCScalableWithInternalComponent if ((father != null) && (father instanceof ELNModule)) { resizeToFatherSize(); - setCdRectangle(0, father.getWidth() - getWidth(), 0, - father.getHeight() - getHeight()); + setCdRectangle(0, father.getWidth() - getWidth(), 0, father.getHeight() - getHeight()); setMoveCd(x, y); } } @@ -604,7 +580,6 @@ public class ELNComponentNodeRef extends TGCScalableWithInternalComponent myColor = null; setFather(null); TDiagramPanel tdp = getTDiagramPanel(); - setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), - tdp.getMaxY()); + setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY()); } } \ No newline at end of file diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentResistor.java b/src/main/java/ui/eln/sca_eln/ELNComponentResistor.java index 4e1ee9799b..0ccf10ab14 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentResistor.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentResistor.java @@ -51,15 +51,14 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** - * Class ELNComponentResistor Resistor to be used in ELN diagrams Creation: - * 12/06/2018 - * + * Class ELNComponentResistor + * Resistor to be used in ELN diagrams + * Creation: 12/06/2018 * @version 1.0 12/06/2018 * @author Irina Kit Yan LEE */ -public class ELNComponentResistor extends TGCScalableWithInternalComponent - implements ActionListener, SwallowedTGComponent, ELNComponent { +public class ELNComponentResistor extends TGCScalableWithInternalComponent implements ActionListener, SwallowedTGComponent, ELNComponent { protected Color myColor; protected int orientation; private int maxFontSize = 14; @@ -74,14 +73,11 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent private String unit; private int position = 0; - private boolean fv_0_2 = false, fv_1_3 = false, fh_0_2 = false, - fh_1_3 = false; + private boolean fv_0_2 = false, fv_1_3 = false, fh_0_2 = false, fh_1_3 = false; private int old; private boolean first; - public ELNComponentResistor(int _x, int _y, int _minX, int _maxX, - int _minY, int _maxY, boolean _pos, TGComponent _father, - TDiagramPanel _tdp) { + public ELNComponentResistor(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); initScaling(100, 20); @@ -114,10 +110,8 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent public void initPortTerminal(int nb) { nbConnectingPoint = nb; connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "p"); - connectingPoint[1] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "n"); + connectingPoint[0] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "p"); + connectingPoint[1] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "n"); } public Color getMyColor() { @@ -131,10 +125,7 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent if (this.rescaled && !this.tdp.isScaled()) { this.rescaled = false; - int maxCurrentFontSize = Math.max( - 0, - Math.min(this.height, - (int) (this.maxFontSize * this.tdp.getZoom()))); + int maxCurrentFontSize = Math.max(0, Math.min(this.height, (int) (this.maxFontSize * this.tdp.getZoom()))); f = f.deriveFont((float) maxCurrentFontSize); while (maxCurrentFontSize > (this.minFontSize * this.tdp.getZoom() - 1)) { @@ -190,12 +181,10 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + height / 2 + height / 2 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height / 2 + height / 2 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + height / 2 + height / 2 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height / 2 + height / 2 + sh1); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -207,12 +196,10 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + height / 2 + height / 2 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height / 2 + height / 2 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + height / 2 + height / 2 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height / 2 + height / 2 + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -224,12 +211,10 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + height / 2 + height / 2 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height / 2 + height / 2 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + height / 2 + height / 2 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height / 2 + height / 2 + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -241,12 +226,10 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + height / 2 + height / 2 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height / 2 + height / 2 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + height / 2 + height / 2 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height / 2 + height / 2 + sh0); } } } else if (position == 1) { @@ -280,12 +263,9 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 2, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 2, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 2, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 2, + y + height + sh1); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -297,12 +277,9 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(0.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 2, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 2, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 2, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 2, + y + height + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -314,12 +291,9 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 2, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 2, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 2, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 2, + y + height + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -331,12 +305,9 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(0.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 2, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 2, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 2, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 2, + y + height + sh0); } } @@ -373,12 +344,10 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + height / 2 + height / 2 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height / 2 + height / 2 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + height / 2 + height / 2 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height / 2 + height / 2 + sh0); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -390,12 +359,10 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + height / 2 + height / 2 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height / 2 + height / 2 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + height / 2 + height / 2 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height / 2 + height / 2 + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -407,12 +374,10 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + height / 2 + height / 2 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height / 2 + height / 2 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + height / 2 + height / 2 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height / 2 + height / 2 + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -424,12 +389,10 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + height / 2 + height / 2 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height / 2 + height / 2 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + height / 2 + height / 2 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height / 2 + height / 2 + sh1); } } } else if (position == 3) { @@ -463,12 +426,9 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(0.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 2, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 2, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 2, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 2, + y + height + sh0); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -480,12 +440,9 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 2, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 2, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 2, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 2, + y + height + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -497,12 +454,9 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(0.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 2, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 2, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 2, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 2, + y + height + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -514,12 +468,9 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent ((ELNPortTerminal) connectingPoint[1]).setW(0.5); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width / 2 + width / 2, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width / 2 + width / 2, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width / 2 + width / 2, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width / 2 + width / 2, + y + height + sh1); } } } @@ -529,43 +480,35 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent private void rotateTopBottom(Graphics g) { Color c = g.getColor(); - int[] ptx = { x, x + width / 5, x + width / 5, x + 4 * width / 5, - x + 4 * width / 5, x + width, x + 4 * width / 5, - x + 4 * width / 5, x + width / 5, x + width / 5 }; - int[] pty = { y + height / 2, y + height / 2, y, y, y + height / 2, - y + height / 2, y + height / 2, y + height, y + height, - y + height / 2 }; + int[] ptx = { x, x + width / 5, x + width / 5, x + 4 * width / 5, x + 4 * width / 5, x + width, + x + 4 * width / 5, x + 4 * width / 5, x + width / 5, x + width / 5 }; + int[] pty = { y + height / 2, y + height / 2, y, y, y + height / 2, y + height / 2, y + height / 2, y + height, + y + height, y + height / 2 }; g.drawPolygon(ptx, pty, 10); g.drawOval(x, y + height / 2 - height / 4, width / 10, height / 2); g.setColor(Color.WHITE); g.fillOval(x, y + height / 2 - height / 4, width / 10, height / 2); g.setColor(c); - g.drawOval(x + width - width / 10, y + height / 2 - height / 4, - width / 10, height / 2); + g.drawOval(x + width - width / 10, y + height / 2 - height / 4, width / 10, height / 2); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 10, y + height / 2 - height / 4, - width / 10, height / 2); + g.fillOval(x + width - width / 10, y + height / 2 - height / 4, width / 10, height / 2); g.setColor(c); } private void rotateRightLeft(Graphics g) { Color c = g.getColor(); - int[] ptx = { x + width / 2, x + width / 2, x, x, x + width / 2, - x + width / 2, x + width / 2, x + width, x + width, - x + width / 2 }; - int[] pty = { y, y + height / 5, y + height / 5, y + 4 * height / 5, - y + 4 * height / 5, y + height, y + 4 * height / 5, - y + 4 * height / 5, y + height / 5, y + height / 5 }; + int[] ptx = { x + width / 2, x + width / 2, x, x, x + width / 2, x + width / 2, x + width / 2, x + width, + x + width, x + width / 2 }; + int[] pty = { y, y + height / 5, y + height / 5, y + 4 * height / 5, y + 4 * height / 5, y + height, + y + 4 * height / 5, y + 4 * height / 5, y + height / 5, y + height / 5 }; g.drawPolygon(ptx, pty, 10); g.drawOval(x + width / 2 - width / 4, y, width / 2, height / 10); g.setColor(Color.WHITE); g.fillOval(x + width / 2 - width / 4, y, width / 2, height / 10); g.setColor(c); - g.drawOval(x + width / 2 - width / 4, y + height - height / 10, - width / 2, height / 10); + g.drawOval(x + width / 2 - width / 4, y + height - height / 10, width / 2, height / 10); g.setColor(Color.WHITE); - g.fillOval(x + width / 2 - width / 4, y + height - height / 10, - width / 2, height / 10); + g.fillOval(x + width / 2 - width / 4, y + height - height / 10, width / 2, height / 10); g.setColor(c); } @@ -622,8 +565,7 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent return new String(sb); } - public void loadExtraParam(NodeList nl, int decX, int decY, int decId) - throws MalformedModelingException { + public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException { try { NodeList nli; Node n1, n2; @@ -643,21 +585,14 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; if (elt.getTagName().equals("attributes")) { - value = Double.parseDouble(elt - .getAttribute("value")); + value = Double.parseDouble(elt.getAttribute("value")); unit = elt.getAttribute("unit"); - position = Integer.parseInt(elt - .getAttribute("position")); - fv_0_2 = Boolean.parseBoolean(elt - .getAttribute("fv_0_2")); - fv_1_3 = Boolean.parseBoolean(elt - .getAttribute("fv_1_3")); - fh_0_2 = Boolean.parseBoolean(elt - .getAttribute("fh_0_2")); - fh_1_3 = Boolean.parseBoolean(elt - .getAttribute("fh_1_3")); - first = Boolean.parseBoolean(elt - .getAttribute("first")); + position = Integer.parseInt(elt.getAttribute("position")); + fv_0_2 = Boolean.parseBoolean(elt.getAttribute("fv_0_2")); + fv_1_3 = Boolean.parseBoolean(elt.getAttribute("fv_1_3")); + fh_0_2 = Boolean.parseBoolean(elt.getAttribute("fh_0_2")); + fh_1_3 = Boolean.parseBoolean(elt.getAttribute("fh_1_3")); + first = Boolean.parseBoolean(elt.getAttribute("first")); setVal(value); setUnit(unit); setPosition(position); @@ -676,8 +611,7 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent } } - public void addActionToPopupMenu(JPopupMenu componentMenu, - ActionListener menuAL, int x, int y) { + public void addActionToPopupMenu(JPopupMenu componentMenu, ActionListener menuAL, int x, int y) { componentMenu.addSeparator(); JMenuItem rotateright = new JMenuItem("Rotate right 90\u00b0"); @@ -816,8 +750,7 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent if ((father != null) && (father instanceof ELNModule)) { resizeToFatherSize(); - setCdRectangle(0, father.getWidth() - getWidth(), 0, - father.getHeight() - getHeight()); + setCdRectangle(0, father.getWidth() - getWidth(), 0, father.getHeight() - getHeight()); setMoveCd(x, y); } } @@ -830,7 +763,6 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent myColor = null; setFather(null); TDiagramPanel tdp = getTDiagramPanel(); - setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), - tdp.getMaxY()); + setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY()); } } \ No newline at end of file diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentTransmissionLine.java b/src/main/java/ui/eln/sca_eln/ELNComponentTransmissionLine.java index 9c774cc53d..6f7ceb339d 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentTransmissionLine.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentTransmissionLine.java @@ -51,16 +51,14 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** - * Class ELNComponentTransmissionLine Transmission line to be used in ELN - * diagrams Creation: 15/06/2018 - * + * Class ELNComponentTransmissionLine + * Transmission line to be used in ELN diagrams + * Creation: 15/06/2018 * @version 1.0 15/06/2018 * @author Irina Kit Yan LEE */ -public class ELNComponentTransmissionLine extends - TGCScalableWithInternalComponent implements ActionListener, - SwallowedTGComponent, ELNComponent { +public class ELNComponentTransmissionLine extends TGCScalableWithInternalComponent implements ActionListener, SwallowedTGComponent, ELNComponent { protected Color myColor; protected int orientation; private int maxFontSize = 14; @@ -76,14 +74,11 @@ public class ELNComponentTransmissionLine extends private String unit0, unit2; private int position = 0; - private boolean fv_0_2 = false, fv_1_3 = false, fh_0_2 = false, - fh_1_3 = false; + private boolean fv_0_2 = false, fv_1_3 = false, fh_0_2 = false, fh_1_3 = false; private int old; private boolean first; - public ELNComponentTransmissionLine(int _x, int _y, int _minX, int _maxX, - int _minY, int _maxY, boolean _pos, TGComponent _father, - TDiagramPanel _tdp) { + public ELNComponentTransmissionLine(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); initScaling(120, 80); @@ -119,14 +114,10 @@ public class ELNComponentTransmissionLine extends public void initPortTerminal(int nb) { nbConnectingPoint = nb; connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "a1"); - connectingPoint[1] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "a2"); - connectingPoint[2] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "b1"); - connectingPoint[3] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "b2"); + connectingPoint[0] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "a1"); + connectingPoint[1] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "a2"); + connectingPoint[2] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "b1"); + connectingPoint[3] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "b2"); } public Color getMyColor() { @@ -140,10 +131,7 @@ public class ELNComponentTransmissionLine extends if (this.rescaled && !this.tdp.isScaled()) { this.rescaled = false; - int maxCurrentFontSize = Math.max( - 0, - Math.min(this.height, - (int) (this.maxFontSize * this.tdp.getZoom()))); + int maxCurrentFontSize = Math.max(0, Math.min(this.height, (int) (this.maxFontSize * this.tdp.getZoom()))); f = f.deriveFont((float) maxCurrentFontSize); while (maxCurrentFontSize > (this.minFontSize * this.tdp.getZoom() - 1)) { @@ -207,18 +195,12 @@ public class ELNComponentTransmissionLine extends ((ELNPortTerminal) connectingPoint[3]).setW(1.0); ((ELNPortTerminal) connectingPoint[3]).setH(15.0 / 16.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - sw2, y + height + height / 16 + sh2); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width, y + height + height / 16 + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - sw2, + y + height + height / 16 + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width, + y + height + height / 16 + sh3); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -234,18 +216,12 @@ public class ELNComponentTransmissionLine extends ((ELNPortTerminal) connectingPoint[2]).setW(1.0); ((ELNPortTerminal) connectingPoint[2]).setH(15.0 / 16.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - sw3, y + height + height / 16 + sh3); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width, y + height + height / 16 + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - sw3, + y + height + height / 16 + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width, + y + height + height / 16 + sh2); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -261,18 +237,12 @@ public class ELNComponentTransmissionLine extends ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(15.0 / 16.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - sw2, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + height + height / 16 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height + height / 16 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - sw2, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + height + height / 16 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height + height / 16 + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -288,18 +258,12 @@ public class ELNComponentTransmissionLine extends ((ELNPortTerminal) connectingPoint[0]).setW(1.0); ((ELNPortTerminal) connectingPoint[0]).setH(15.0 / 16.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - sw3, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + height + height / 16 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height + height / 16 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - sw3, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + height + height / 16 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height + height / 16 + sh0); } } } else if (position == 1) { @@ -343,18 +307,12 @@ public class ELNComponentTransmissionLine extends ((ELNPortTerminal) connectingPoint[1]).setW(15.0 / 16.0); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - width / 16 - sw2, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width + width / 16, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - width / 16 - sw3, y + height + sh3); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width + width / 16, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - width / 16 - sw2, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width + width / 16, y); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - width / 16 - sw3, + y + height + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width + width / 16, + y + height + sh1); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -370,18 +328,12 @@ public class ELNComponentTransmissionLine extends ((ELNPortTerminal) connectingPoint[0]).setW(15.0 / 16.0); ((ELNPortTerminal) connectingPoint[0]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - width / 16 - sw3, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width + width / 16, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - width / 16 - sw2, y + height + sh2); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width + width / 16, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - width / 16 - sw3, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width + width / 16, y); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - width / 16 - sw2, + y + height + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width + width / 16, + y + height + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -397,18 +349,12 @@ public class ELNComponentTransmissionLine extends ((ELNPortTerminal) connectingPoint[3]).setW(15.0 / 16.0); ((ELNPortTerminal) connectingPoint[3]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - width / 16 - sw0, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width + width / 16, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - width / 16 - sw1, y + height + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width + width / 16, y + height + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - width / 16 - sw0, y); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width + width / 16, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - width / 16 - sw1, + y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width + width / 16, + y + height + sh3); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -424,18 +370,12 @@ public class ELNComponentTransmissionLine extends ((ELNPortTerminal) connectingPoint[2]).setW(15.0 / 16.0); ((ELNPortTerminal) connectingPoint[2]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - width / 16 - sw1, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width + width / 16, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - width / 16 - sw0, y + height + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width + width / 16, y + height + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - width / 16 - sw1, y); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width + width / 16, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - width / 16 - sw0, + y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width + width / 16, + y + height + sh2); } } } else if (position == 2) { @@ -479,18 +419,12 @@ public class ELNComponentTransmissionLine extends ((ELNPortTerminal) connectingPoint[0]).setW(1.0); ((ELNPortTerminal) connectingPoint[0]).setH(15.0 / 16.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - sw3, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + height + height / 16 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height + height / 16 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - sw3, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + height + height / 16 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height + height / 16 + sh0); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -506,18 +440,12 @@ public class ELNComponentTransmissionLine extends ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(15.0 / 16.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - sw2, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + height + height / 16 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height + height / 16 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - sw2, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + height + height / 16 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height + height / 16 + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -533,18 +461,12 @@ public class ELNComponentTransmissionLine extends ((ELNPortTerminal) connectingPoint[2]).setW(1.0); ((ELNPortTerminal) connectingPoint[2]).setH(15.0 / 16.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - sw3, y + height + height / 16 + sh3); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width, y + height + height / 16 + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - sw3, + y + height + height / 16 + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width, + y + height + height / 16 + sh2); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -560,18 +482,12 @@ public class ELNComponentTransmissionLine extends ((ELNPortTerminal) connectingPoint[3]).setW(1.0); ((ELNPortTerminal) connectingPoint[3]).setH(15.0 / 16.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - sw2, y + height + height / 16 + sh2); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width, y + height + height / 16 + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - sw2, + y + height + height / 16 + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width, + y + height + height / 16 + sh3); } } } else if (position == 3) { @@ -615,18 +531,12 @@ public class ELNComponentTransmissionLine extends ((ELNPortTerminal) connectingPoint[2]).setW(15.0 / 16.0); ((ELNPortTerminal) connectingPoint[2]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - width / 16 - sw1, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width + width / 16, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - width / 16 - sw0, y + height + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width + width / 16, y + height + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - width / 16 - sw1, y); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width + width / 16, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - width / 16 - sw0, + y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width + width / 16, + y + height + sh2); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -642,18 +552,12 @@ public class ELNComponentTransmissionLine extends ((ELNPortTerminal) connectingPoint[3]).setW(15.0 / 16.0); ((ELNPortTerminal) connectingPoint[3]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - width / 16 - sw0, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width + width / 16, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - width / 16 - sw1, y + height + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width + width / 16, y + height + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - width / 16 - sw0, y); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width + width / 16, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - width / 16 - sw1, + y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width + width / 16, + y + height + sh3); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -669,18 +573,12 @@ public class ELNComponentTransmissionLine extends ((ELNPortTerminal) connectingPoint[0]).setW(15.0 / 16.0); ((ELNPortTerminal) connectingPoint[0]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - width / 16 - sw3, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width + width / 16, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - width / 16 - sw2, y + height + sh2); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width + width / 16, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - width / 16 - sw3, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width + width / 16, y); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - width / 16 - sw2, + y + height + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width + width / 16, + y + height + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -696,18 +594,12 @@ public class ELNComponentTransmissionLine extends ((ELNPortTerminal) connectingPoint[1]).setW(15.0 / 16.0); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - width / 16 - sw2, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width + width / 16, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - width / 16 - sw3, y + height + sh3); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width + width / 16, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - width / 16 - sw2, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width + width / 16, y); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - width / 16 - sw3, + y + height + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width + width / 16, + y + height + sh1); } } } @@ -717,17 +609,15 @@ public class ELNComponentTransmissionLine extends private void rotateTopBottom(Graphics g) { Color c = g.getColor(); - int[] ptx0 = { x + width / 24, x + width / 6, x + 5 * width / 6, - x + width - width / 24, x + 5 * width / 6, x + width / 6 }; - int[] pty0 = { y + height / 16, y + height / 2 - height / 8, - y + height / 2 - height / 8, y + height / 16, + int[] ptx0 = { x + width / 24, x + width / 6, x + 5 * width / 6, x + width - width / 24, x + 5 * width / 6, + x + width / 6 }; + int[] pty0 = { y + height / 16, y + height / 2 - height / 8, y + height / 2 - height / 8, y + height / 16, y + height / 2 - height / 8, y + height / 2 - height / 8 }; g.drawPolygon(ptx0, pty0, 6); - int[] ptx1 = { x + width / 24, x + width / 6, x + 5 * width / 6, - x + width - width / 24, x + 5 * width / 6, x + width / 6 }; - int[] pty1 = { y + height - height / 16, y + height / 2 + height / 8, - y + height / 2 + height / 8, y + height - height / 16, - y + height / 2 + height / 8, y + height / 2 + height / 8 }; + int[] ptx1 = { x + width / 24, x + width / 6, x + 5 * width / 6, x + width - width / 24, x + 5 * width / 6, + x + width / 6 }; + int[] pty1 = { y + height - height / 16, y + height / 2 + height / 8, y + height / 2 + height / 8, + y + height - height / 16, y + height / 2 + height / 8, y + height / 2 + height / 8 }; g.drawPolygon(ptx1, pty1, 6); g.drawOval(x, y, width / 12, height / 8); g.setColor(Color.WHITE); @@ -741,27 +631,23 @@ public class ELNComponentTransmissionLine extends g.setColor(Color.WHITE); g.fillOval(x, y + height - height / 8, width / 12, height / 8); g.setColor(c); - g.drawOval(x + width - width / 12, y + height - height / 8, width / 12, - height / 8); + g.drawOval(x + width - width / 12, y + height - height / 8, width / 12, height / 8); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 12, y + height - height / 8, width / 12, - height / 8); + g.fillOval(x + width - width / 12, y + height - height / 8, width / 12, height / 8); g.setColor(c); } private void rotateRightLeft(Graphics g) { Color c = g.getColor(); - int[] ptx0 = { x + width / 16, x + width / 2 - width / 8, - x + width / 2 - width / 8, x + width / 16, + int[] ptx0 = { x + width / 16, x + width / 2 - width / 8, x + width / 2 - width / 8, x + width / 16, x + width / 2 - width / 8, x + width / 2 - width / 8 }; - int[] pty0 = { y + height / 24, y + height / 6, y + 5 * height / 6, - y + height - height / 24, y + 5 * height / 6, y + height / 6 }; + int[] pty0 = { y + height / 24, y + height / 6, y + 5 * height / 6, y + height - height / 24, + y + 5 * height / 6, y + height / 6 }; g.drawPolygon(ptx0, pty0, 6); - int[] ptx1 = { x + width - width / 16, x + width / 2 + width / 8, - x + width / 2 + width / 8, x + width - width / 16, - x + width / 2 + width / 8, x + width / 2 + width / 8 }; - int[] pty1 = { y + height / 24, y + height / 6, y + 5 * height / 6, - y + height - height / 24, y + 5 * height / 6, y + height / 6 }; + int[] ptx1 = { x + width - width / 16, x + width / 2 + width / 8, x + width / 2 + width / 8, + x + width - width / 16, x + width / 2 + width / 8, x + width / 2 + width / 8 }; + int[] pty1 = { y + height / 24, y + height / 6, y + 5 * height / 6, y + height - height / 24, + y + 5 * height / 6, y + height / 6 }; g.drawPolygon(ptx1, pty1, 6); g.drawOval(x, y, width / 8, height / 12); g.setColor(Color.WHITE); @@ -775,11 +661,9 @@ public class ELNComponentTransmissionLine extends g.setColor(Color.WHITE); g.fillOval(x, y + height - height / 12, width / 8, height / 12); g.setColor(c); - g.drawOval(x + width - width / 8, y + height - height / 12, width / 8, - height / 12); + g.drawOval(x + width - width / 8, y + height - height / 12, width / 8, height / 12); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 8, y + height - height / 12, width / 8, - height / 12); + g.fillOval(x + width - width / 8, y + height - height / 12, width / 8, height / 12); g.setColor(c); } @@ -795,8 +679,7 @@ public class ELNComponentTransmissionLine extends } public boolean editOndoubleClick(JFrame frame) { - JDialogELNComponentTransmissionLine jde = new JDialogELNComponentTransmissionLine( - this); + JDialogELNComponentTransmissionLine jde = new JDialogELNComponentTransmissionLine(this); jde.setVisible(true); return true; } @@ -839,8 +722,7 @@ public class ELNComponentTransmissionLine extends return new String(sb); } - public void loadExtraParam(NodeList nl, int decX, int decY, int decId) - throws MalformedModelingException { + public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException { try { NodeList nli; Node n1, n2; @@ -864,21 +746,14 @@ public class ELNComponentTransmissionLine extends z0 = Double.parseDouble(elt.getAttribute("z0")); unit0 = elt.getAttribute("unit0"); delay = elt.getAttribute("delay"); - delta0 = Double.parseDouble(elt - .getAttribute("delta0")); + delta0 = Double.parseDouble(elt.getAttribute("delta0")); unit2 = elt.getAttribute("unit2"); - position = Integer.parseInt(elt - .getAttribute("position")); - fv_0_2 = Boolean.parseBoolean(elt - .getAttribute("fv_0_2")); - fv_1_3 = Boolean.parseBoolean(elt - .getAttribute("fv_1_3")); - fh_0_2 = Boolean.parseBoolean(elt - .getAttribute("fh_0_2")); - fh_1_3 = Boolean.parseBoolean(elt - .getAttribute("fh_1_3")); - first = Boolean.parseBoolean(elt - .getAttribute("first")); + position = Integer.parseInt(elt.getAttribute("position")); + fv_0_2 = Boolean.parseBoolean(elt.getAttribute("fv_0_2")); + fv_1_3 = Boolean.parseBoolean(elt.getAttribute("fv_1_3")); + fh_0_2 = Boolean.parseBoolean(elt.getAttribute("fh_0_2")); + fh_1_3 = Boolean.parseBoolean(elt.getAttribute("fh_1_3")); + first = Boolean.parseBoolean(elt.getAttribute("first")); setZ0(z0); setUnit0(unit0); setDelay(delay); @@ -900,8 +775,7 @@ public class ELNComponentTransmissionLine extends } } - public void addActionToPopupMenu(JPopupMenu componentMenu, - ActionListener menuAL, int x, int y) { + public void addActionToPopupMenu(JPopupMenu componentMenu, ActionListener menuAL, int x, int y) { componentMenu.addSeparator(); JMenuItem rotateright = new JMenuItem("Rotate right 90\u00b0"); @@ -1064,8 +938,7 @@ public class ELNComponentTransmissionLine extends if ((father != null) && (father instanceof ELNModule)) { resizeToFatherSize(); - setCdRectangle(0, father.getWidth() - getWidth(), 0, - father.getHeight() - getHeight()); + setCdRectangle(0, father.getWidth() - getWidth(), 0, father.getHeight() - getHeight()); setMoveCd(x, y); } } @@ -1078,7 +951,6 @@ public class ELNComponentTransmissionLine extends myColor = null; setFather(null); TDiagramPanel tdp = getTDiagramPanel(); - setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), - tdp.getMaxY()); + setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY()); } } \ No newline at end of file diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledCurrentSource.java b/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledCurrentSource.java index f018abd886..6057dabc14 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledCurrentSource.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledCurrentSource.java @@ -51,16 +51,14 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** - * Class ELNComponentVoltageControlledCurrentSource Voltage controlled current - * source to be used in ELN diagrams Creation: 13/06/2018 - * + * Class ELNComponentVoltageControlledCurrentSource + * Voltage controlled current source to be used in ELN diagrams + * Creation: 13/06/2018 * @version 1.0 13/06/2018 * @author Irina Kit Yan LEE */ -public class ELNComponentVoltageControlledCurrentSource extends - TGCScalableWithInternalComponent implements ActionListener, - SwallowedTGComponent, ELNComponent { +public class ELNComponentVoltageControlledCurrentSource extends TGCScalableWithInternalComponent implements ActionListener, SwallowedTGComponent, ELNComponent { protected Color myColor; protected int orientation; private int maxFontSize = 14; @@ -75,14 +73,11 @@ public class ELNComponentVoltageControlledCurrentSource extends private String unit; private int position = 0; - private boolean fv_0_2 = false, fv_1_3 = false, fh_0_2 = false, - fh_1_3 = false; + private boolean fv_0_2 = false, fv_1_3 = false, fh_0_2 = false, fh_1_3 = false; private int old; private boolean first; - public ELNComponentVoltageControlledCurrentSource(int _x, int _y, - int _minX, int _maxX, int _minY, int _maxY, boolean _pos, - TGComponent _father, TDiagramPanel _tdp) { + public ELNComponentVoltageControlledCurrentSource(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); initScaling(120, 80); @@ -115,14 +110,10 @@ public class ELNComponentVoltageControlledCurrentSource extends public void initPortTerminal(int nb) { nbConnectingPoint = nb; connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "ncp"); - connectingPoint[1] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "np"); - connectingPoint[2] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "ncn"); - connectingPoint[3] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "nn"); + connectingPoint[0] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "ncp"); + connectingPoint[1] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "np"); + connectingPoint[2] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "ncn"); + connectingPoint[3] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "nn"); } public Color getMyColor() { @@ -136,10 +127,7 @@ public class ELNComponentVoltageControlledCurrentSource extends if (this.rescaled && !this.tdp.isScaled()) { this.rescaled = false; - int maxCurrentFontSize = Math.max( - 0, - Math.min(this.height, - (int) (this.maxFontSize * this.tdp.getZoom()))); + int maxCurrentFontSize = Math.max(0, Math.min(this.height, (int) (this.maxFontSize * this.tdp.getZoom()))); f = f.deriveFont((float) maxCurrentFontSize); while (maxCurrentFontSize > (this.minFontSize * this.tdp.getZoom() - 1)) { @@ -202,18 +190,12 @@ public class ELNComponentVoltageControlledCurrentSource extends ((ELNPortTerminal) connectingPoint[3]).setW(1.0); ((ELNPortTerminal) connectingPoint[3]).setH(15.0 / 16.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - sw2, y + height + height / 16 + sh2); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width, y + height + height / 16 + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - sw2, + y + height + height / 16 + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width, + y + height + height / 16 + sh3); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -230,18 +212,12 @@ public class ELNComponentVoltageControlledCurrentSource extends ((ELNPortTerminal) connectingPoint[2]).setW(1.0); ((ELNPortTerminal) connectingPoint[2]).setH(15.0 / 16.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - sw3, y + height + height / 16 + sh3); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width, y + height + height / 16 + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - sw3, + y + height + height / 16 + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width, + y + height + height / 16 + sh2); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -258,18 +234,12 @@ public class ELNComponentVoltageControlledCurrentSource extends ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(15.0 / 16.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - sw2, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + height + height / 16 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height + height / 16 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - sw2, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + height + height / 16 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height + height / 16 + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -286,18 +256,12 @@ public class ELNComponentVoltageControlledCurrentSource extends ((ELNPortTerminal) connectingPoint[0]).setW(1.0); ((ELNPortTerminal) connectingPoint[0]).setH(15.0 / 16.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - sw3, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + height + height / 16 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height + height / 16 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - sw3, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + height + height / 16 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height + height / 16 + sh0); } } } else if (position == 1) { @@ -340,18 +304,12 @@ public class ELNComponentVoltageControlledCurrentSource extends ((ELNPortTerminal) connectingPoint[1]).setW(15.0 / 16.0); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - width / 16 - sw2, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width + width / 16, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - width / 16 - sw3, y + height + sh3); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width + width / 16, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - width / 16 - sw2, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width + width / 16, y); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - width / 16 - sw3, + y + height + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width + width / 16, + y + height + sh1); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -368,18 +326,12 @@ public class ELNComponentVoltageControlledCurrentSource extends ((ELNPortTerminal) connectingPoint[0]).setW(15.0 / 16.0); ((ELNPortTerminal) connectingPoint[0]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - width / 16 - sw3, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width + width / 16, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - width / 16 - sw2, y + height + sh2); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width + width / 16, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - width / 16 - sw3, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width + width / 16, y); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - width / 16 - sw2, + y + height + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width + width / 16, + y + height + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -396,18 +348,12 @@ public class ELNComponentVoltageControlledCurrentSource extends ((ELNPortTerminal) connectingPoint[3]).setW(15.0 / 16.0); ((ELNPortTerminal) connectingPoint[3]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - width / 16 - sw0, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width + width / 16, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - width / 16 - sw1, y + height + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width + width / 16, y + height + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - width / 16 - sw0, y); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width + width / 16, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - width / 16 - sw1, + y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width + width / 16, + y + height + sh3); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -424,18 +370,12 @@ public class ELNComponentVoltageControlledCurrentSource extends ((ELNPortTerminal) connectingPoint[2]).setW(15.0 / 16.0); ((ELNPortTerminal) connectingPoint[2]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - width / 16 - sw1, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width + width / 16, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - width / 16 - sw0, y + height + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width + width / 16, y + height + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - width / 16 - sw1, y); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width + width / 16, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - width / 16 - sw0, + y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width + width / 16, + y + height + sh2); } } } else if (position == 2) { @@ -478,18 +418,12 @@ public class ELNComponentVoltageControlledCurrentSource extends ((ELNPortTerminal) connectingPoint[0]).setW(1.0); ((ELNPortTerminal) connectingPoint[0]).setH(15.0 / 16.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - sw3, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + height + height / 16 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height + height / 16 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - sw3, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + height + height / 16 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height + height / 16 + sh0); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -506,18 +440,12 @@ public class ELNComponentVoltageControlledCurrentSource extends ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(15.0 / 16.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - sw2, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + height + height / 16 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height + height / 16 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - sw2, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + height + height / 16 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height + height / 16 + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -534,18 +462,12 @@ public class ELNComponentVoltageControlledCurrentSource extends ((ELNPortTerminal) connectingPoint[2]).setW(1.0); ((ELNPortTerminal) connectingPoint[2]).setH(15.0 / 16.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - sw3, y + height + height / 16 + sh3); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width, y + height + height / 16 + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - sw3, + y + height + height / 16 + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width, + y + height + height / 16 + sh2); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -562,18 +484,12 @@ public class ELNComponentVoltageControlledCurrentSource extends ((ELNPortTerminal) connectingPoint[3]).setW(1.0); ((ELNPortTerminal) connectingPoint[3]).setH(15.0 / 16.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - sw2, y + height + height / 16 + sh2); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width, y + height + height / 16 + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - sw2, + y + height + height / 16 + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width, + y + height + height / 16 + sh3); } } } else if (position == 3) { @@ -616,18 +532,12 @@ public class ELNComponentVoltageControlledCurrentSource extends ((ELNPortTerminal) connectingPoint[2]).setW(15.0 / 16.0); ((ELNPortTerminal) connectingPoint[2]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - width / 16 - sw1, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width + width / 16, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - width / 16 - sw0, y + height + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width + width / 16, y + height + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - width / 16 - sw1, y); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width + width / 16, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - width / 16 - sw0, + y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width + width / 16, + y + height + sh2); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -644,18 +554,12 @@ public class ELNComponentVoltageControlledCurrentSource extends ((ELNPortTerminal) connectingPoint[3]).setW(15.0 / 16.0); ((ELNPortTerminal) connectingPoint[3]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - width / 16 - sw0, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width + width / 16, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - width / 16 - sw1, y + height + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width + width / 16, y + height + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - width / 16 - sw0, y); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width + width / 16, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - width / 16 - sw1, + y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width + width / 16, + y + height + sh3); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -672,18 +576,12 @@ public class ELNComponentVoltageControlledCurrentSource extends ((ELNPortTerminal) connectingPoint[0]).setW(15.0 / 16.0); ((ELNPortTerminal) connectingPoint[0]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - width / 16 - sw3, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width + width / 16, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - width / 16 - sw2, y + height + sh2); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width + width / 16, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - width / 16 - sw3, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width + width / 16, y); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - width / 16 - sw2, + y + height + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width + width / 16, + y + height + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -700,18 +598,12 @@ public class ELNComponentVoltageControlledCurrentSource extends ((ELNPortTerminal) connectingPoint[1]).setW(15.0 / 16.0); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - width / 16 - sw2, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width + width / 16, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - width / 16 - sw3, y + height + sh3); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width + width / 16, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - width / 16 - sw2, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width + width / 16, y); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - width / 16 - sw3, + y + height + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width + width / 16, + y + height + sh1); } } } @@ -727,40 +619,27 @@ public class ELNComponentVoltageControlledCurrentSource extends int[] ptx1 = { x, x + 2 * width / 6 }; int[] pty1 = { y + height - height / 16, y + height - height / 16 }; g.drawPolygon(ptx1, pty1, 2); - int[] ptx2 = { x + width, x + 4 * width / 6, x + 4 * width / 6, - x + 3 * width / 6, x + 4 * width / 6, x + 4 * width / 6, - x + width, x + 4 * width / 6, x + 4 * width / 6, - x + 5 * width / 6, x + 3 * width / 6, x + 5 * width / 6, - x + 4 * width / 6, x + 4 * width / 6 }; - int[] pty2 = { y + height / 16, y + height / 16, y + height / 4, - y + 2 * height / 4, y + 3 * height / 4, - y + height - height / 16, y + height - height / 16, - y + height - height / 16, y + 3 * height / 4, - y + 2 * height / 4, y + 2 * height / 4, y + 2 * height / 4, - y + height / 4, y + height / 16 }; + int[] ptx2 = { x + width, x + 4 * width / 6, x + 4 * width / 6, x + 3 * width / 6, x + 4 * width / 6, + x + 4 * width / 6, x + width, x + 4 * width / 6, x + 4 * width / 6, x + 5 * width / 6, + x + 3 * width / 6, x + 5 * width / 6, x + 4 * width / 6, x + 4 * width / 6 }; + int[] pty2 = { y + height / 16, y + height / 16, y + height / 4, y + 2 * height / 4, y + 3 * height / 4, + y + height - height / 16, y + height - height / 16, y + height - height / 16, y + 3 * height / 4, + y + 2 * height / 4, y + 2 * height / 4, y + 2 * height / 4, y + height / 4, y + height / 16 }; g.drawPolygon(ptx2, pty2, 14); - int[] ptx3 = { x + 2 * width / 6 - width / 12 - width / 24, - x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 12, - x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 12, + int[] ptx3 = { x + 2 * width / 6 - width / 12 - width / 24, x + 2 * width / 6 - width / 12, + x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 24 }; - int[] pty3 = { y + height / 4, y + height / 4, - y + height / 4 - height / 16, y + height / 4 + height / 16, + int[] pty3 = { y + height / 4, y + height / 4, y + height / 4 - height / 16, y + height / 4 + height / 16, y + height / 4, y + height / 4 }; g.drawPolygon(ptx3, pty3, 6); - int[] ptx4 = { x + 2 * width / 6 - width / 12 - width / 24, - x + 2 * width / 6 - width / 24 }; + int[] ptx4 = { x + 2 * width / 6 - width / 12 - width / 24, x + 2 * width / 6 - width / 24 }; int[] pty4 = { y + height - height / 4, y + height - height / 4 }; g.drawPolygon(ptx4, pty4, 2); - int[] ptx5 = { x + 5 * width / 6 + width / 12 + width / 24, - x + 5 * width / 6 + width / 12 + width / 24, - x + 5 * width / 6 + width / 12, - x + 5 * width / 6 + width / 12 + width / 24, - x + 5 * width / 6 + width / 6, - x + 5 * width / 6 + width / 12 + width / 24 }; - int[] pty5 = { y + height / 4, y + 3 * height / 4 - height / 8, - y + 3 * height / 4 - height / 8, y + 3 * height / 4, - y + 3 * height / 4 - height / 8, - y + 3 * height / 4 - height / 8 }; + int[] ptx5 = { x + 5 * width / 6 + width / 12 + width / 24, x + 5 * width / 6 + width / 12 + width / 24, + x + 5 * width / 6 + width / 12, x + 5 * width / 6 + width / 12 + width / 24, + x + 5 * width / 6 + width / 6, x + 5 * width / 6 + width / 12 + width / 24 }; + int[] pty5 = { y + height / 4, y + 3 * height / 4 - height / 8, y + 3 * height / 4 - height / 8, + y + 3 * height / 4, y + 3 * height / 4 - height / 8, y + 3 * height / 4 - height / 8 }; g.drawPolygon(ptx5, pty5, 6); g.fillPolygon(ptx5, pty5, 6); g.drawOval(x, y, width / 12, height / 8); @@ -775,11 +654,9 @@ public class ELNComponentVoltageControlledCurrentSource extends g.setColor(Color.WHITE); g.fillOval(x, y + height - height / 8, width / 12, height / 8); g.setColor(c); - g.drawOval(x + width - width / 12, y + height - height / 8, width / 12, - height / 8); + g.drawOval(x + width - width / 12, y + height - height / 8, width / 12, height / 8); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 12, y + height - height / 8, width / 12, - height / 8); + g.fillOval(x + width - width / 12, y + height - height / 8, width / 12, height / 8); g.setColor(c); } @@ -791,39 +668,26 @@ public class ELNComponentVoltageControlledCurrentSource extends int[] ptx1 = { x, x + 2 * width / 6 }; int[] pty1 = { y + height - height / 16, y + height - height / 16 }; g.drawPolygon(ptx1, pty1, 2); - int[] ptx2 = { x + width, x + 4 * width / 6, x + 4 * width / 6, - x + 3 * width / 6, x + 4 * width / 6, x + 4 * width / 6, - x + width, x + 4 * width / 6, x + 4 * width / 6, - x + 5 * width / 6, x + 3 * width / 6, x + 5 * width / 6, - x + 4 * width / 6, x + 4 * width / 6 }; - int[] pty2 = { y + height / 16, y + height / 16, y + height / 4, - y + 2 * height / 4, y + 3 * height / 4, - y + height - height / 16, y + height - height / 16, - y + height - height / 16, y + 3 * height / 4, - y + 2 * height / 4, y + 2 * height / 4, y + 2 * height / 4, - y + height / 4, y + height / 16 }; + int[] ptx2 = { x + width, x + 4 * width / 6, x + 4 * width / 6, x + 3 * width / 6, x + 4 * width / 6, + x + 4 * width / 6, x + width, x + 4 * width / 6, x + 4 * width / 6, x + 5 * width / 6, + x + 3 * width / 6, x + 5 * width / 6, x + 4 * width / 6, x + 4 * width / 6 }; + int[] pty2 = { y + height / 16, y + height / 16, y + height / 4, y + 2 * height / 4, y + 3 * height / 4, + y + height - height / 16, y + height - height / 16, y + height - height / 16, y + 3 * height / 4, + y + 2 * height / 4, y + 2 * height / 4, y + 2 * height / 4, y + height / 4, y + height / 16 }; g.drawPolygon(ptx2, pty2, 14); - int[] ptx3 = { x + 2 * width / 6 - width / 12 - width / 24, - x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 12, - x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 12, + int[] ptx3 = { x + 2 * width / 6 - width / 12 - width / 24, x + 2 * width / 6 - width / 12, + x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 24 }; - int[] pty3 = { y + height - height / 4, y + height - height / 4, - y + height - height / 4 + height / 16, - y + height - height / 4 - height / 16, y + height - height / 4, - y + height - height / 4 }; + int[] pty3 = { y + height - height / 4, y + height - height / 4, y + height - height / 4 + height / 16, + y + height - height / 4 - height / 16, y + height - height / 4, y + height - height / 4 }; g.drawPolygon(ptx3, pty3, 6); - int[] ptx4 = { x + 2 * width / 6 - width / 12 - width / 24, - x + 2 * width / 6 - width / 24 }; + int[] ptx4 = { x + 2 * width / 6 - width / 12 - width / 24, x + 2 * width / 6 - width / 24 }; int[] pty4 = { y + height / 4, y + height / 4 }; g.drawPolygon(ptx4, pty4, 2); - int[] ptx5 = { x + 5 * width / 6 + width / 12 + width / 24, - x + 5 * width / 6 + width / 12 + width / 24, - x + 5 * width / 6 + width / 12, - x + 5 * width / 6 + width / 12 + width / 24, - x + 5 * width / 6 + width / 6, - x + 5 * width / 6 + width / 12 + width / 24 }; - int[] pty5 = { y + 3 * height / 4, y + height / 4 + height / 8, - y + height / 4 + height / 8, y + height / 4, + int[] ptx5 = { x + 5 * width / 6 + width / 12 + width / 24, x + 5 * width / 6 + width / 12 + width / 24, + x + 5 * width / 6 + width / 12, x + 5 * width / 6 + width / 12 + width / 24, + x + 5 * width / 6 + width / 6, x + 5 * width / 6 + width / 12 + width / 24 }; + int[] pty5 = { y + 3 * height / 4, y + height / 4 + height / 8, y + height / 4 + height / 8, y + height / 4, y + height / 4 + height / 8, y + height / 4 + height / 8 }; g.drawPolygon(ptx5, pty5, 6); g.fillPolygon(ptx5, pty5, 6); @@ -839,11 +703,9 @@ public class ELNComponentVoltageControlledCurrentSource extends g.setColor(Color.WHITE); g.fillOval(x, y + height - height / 8, width / 12, height / 8); g.setColor(c); - g.drawOval(x + width - width / 12, y + height - height / 8, width / 12, - height / 8); + g.drawOval(x + width - width / 12, y + height - height / 8, width / 12, height / 8); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 12, y + height - height / 8, width / 12, - height / 8); + g.fillOval(x + width - width / 12, y + height - height / 8, width / 12, height / 8); g.setColor(c); } @@ -855,38 +717,26 @@ public class ELNComponentVoltageControlledCurrentSource extends int[] ptx1 = { x + 4 * width / 6, x + width }; int[] pty1 = { y + height - height / 16, y + height - height / 16 }; g.drawPolygon(ptx1, pty1, 2); - int[] ptx2 = { x, x + 2 * width / 6, x + 2 * width / 6, x + width / 6, - x + 2 * width / 6, x + 2 * width / 6, x, x + 2 * width / 6, - x + 2 * width / 6, x + 3 * width / 6, x + width / 6, - x + 3 * width / 6, x + 2 * width / 6, x + 2 * width / 6 }; - int[] pty2 = { y + height / 16, y + height / 16, y + height / 4, - y + 2 * height / 4, y + 3 * height / 4, - y + height - height / 16, y + height - height / 16, - y + height - height / 16, y + 3 * height / 4, - y + 2 * height / 4, y + 2 * height / 4, y + 2 * height / 4, - y + height / 4, y + height / 16 }; + int[] ptx2 = { x, x + 2 * width / 6, x + 2 * width / 6, x + width / 6, x + 2 * width / 6, x + 2 * width / 6, x, + x + 2 * width / 6, x + 2 * width / 6, x + 3 * width / 6, x + width / 6, x + 3 * width / 6, + x + 2 * width / 6, x + 2 * width / 6 }; + int[] pty2 = { y + height / 16, y + height / 16, y + height / 4, y + 2 * height / 4, y + 3 * height / 4, + y + height - height / 16, y + height - height / 16, y + height - height / 16, y + 3 * height / 4, + y + 2 * height / 4, y + 2 * height / 4, y + 2 * height / 4, y + height / 4, y + height / 16 }; g.drawPolygon(ptx2, pty2, 14); - int[] ptx3 = { x + 4 * width / 6 + width / 24, - x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12, + int[] ptx3 = { x + 4 * width / 6 + width / 24, x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12 + width / 24 }; - int[] pty3 = { y + height - height / 4, y + height - height / 4, - y + height - height / 4 + height / 16, - y + height - height / 4 - height / 16, y + height - height / 4, - y + height - height / 4 }; + int[] pty3 = { y + height - height / 4, y + height - height / 4, y + height - height / 4 + height / 16, + y + height - height / 4 - height / 16, y + height - height / 4, y + height - height / 4 }; g.drawPolygon(ptx3, pty3, 6); - int[] ptx4 = { x + 4 * width / 6 + width / 24, - x + 4 * width / 6 + width / 12 + width / 24 }; + int[] ptx4 = { x + 4 * width / 6 + width / 24, x + 4 * width / 6 + width / 12 + width / 24 }; int[] pty4 = { y + height / 4, y + height / 4 }; g.drawPolygon(ptx4, pty4, 2); - int[] ptx5 = { x + width / 6 - width / 12 - width / 24, - x + width / 6 - width / 12 - width / 24, - x + width / 6 - width / 12, - x + width / 6 - width / 12 - width / 24, - x + width / 6 - width / 6, + int[] ptx5 = { x + width / 6 - width / 12 - width / 24, x + width / 6 - width / 12 - width / 24, + x + width / 6 - width / 12, x + width / 6 - width / 12 - width / 24, x + width / 6 - width / 6, x + width / 6 - width / 12 - width / 24 }; - int[] pty5 = { y + 3 * height / 4, y + height / 4 + height / 8, - y + height / 4 + height / 8, y + height / 4, + int[] pty5 = { y + 3 * height / 4, y + height / 4 + height / 8, y + height / 4 + height / 8, y + height / 4, y + height / 4 + height / 8, y + height / 4 + height / 8 }; g.drawPolygon(ptx5, pty5, 6); g.fillPolygon(ptx5, pty5, 6); @@ -902,11 +752,9 @@ public class ELNComponentVoltageControlledCurrentSource extends g.setColor(Color.WHITE); g.fillOval(x, y + height - height / 8, width / 12, height / 8); g.setColor(c); - g.drawOval(x + width - width / 12, y + height - height / 8, width / 12, - height / 8); + g.drawOval(x + width - width / 12, y + height - height / 8, width / 12, height / 8); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 12, y + height - height / 8, width / 12, - height / 8); + g.fillOval(x + width - width / 12, y + height - height / 8, width / 12, height / 8); g.setColor(c); } @@ -918,39 +766,27 @@ public class ELNComponentVoltageControlledCurrentSource extends int[] ptx1 = { x + 4 * width / 6, x + width }; int[] pty1 = { y + height - height / 16, y + height - height / 16 }; g.drawPolygon(ptx1, pty1, 2); - int[] ptx2 = { x, x + 2 * width / 6, x + 2 * width / 6, x + width / 6, - x + 2 * width / 6, x + 2 * width / 6, x, x + 2 * width / 6, - x + 2 * width / 6, x + 3 * width / 6, x + width / 6, - x + 3 * width / 6, x + 2 * width / 6, x + 2 * width / 6 }; - int[] pty2 = { y + height / 16, y + height / 16, y + height / 4, - y + 2 * height / 4, y + 3 * height / 4, - y + height - height / 16, y + height - height / 16, - y + height - height / 16, y + 3 * height / 4, - y + 2 * height / 4, y + 2 * height / 4, y + 2 * height / 4, - y + height / 4, y + height / 16 }; + int[] ptx2 = { x, x + 2 * width / 6, x + 2 * width / 6, x + width / 6, x + 2 * width / 6, x + 2 * width / 6, x, + x + 2 * width / 6, x + 2 * width / 6, x + 3 * width / 6, x + width / 6, x + 3 * width / 6, + x + 2 * width / 6, x + 2 * width / 6 }; + int[] pty2 = { y + height / 16, y + height / 16, y + height / 4, y + 2 * height / 4, y + 3 * height / 4, + y + height - height / 16, y + height - height / 16, y + height - height / 16, y + 3 * height / 4, + y + 2 * height / 4, y + 2 * height / 4, y + 2 * height / 4, y + height / 4, y + height / 16 }; g.drawPolygon(ptx2, pty2, 14); - int[] ptx3 = { x + 4 * width / 6 + width / 24, - x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12, + int[] ptx3 = { x + 4 * width / 6 + width / 24, x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12 + width / 24 }; - int[] pty3 = { y + height / 4, y + height / 4, - y + height / 4 - height / 16, y + height / 4 + height / 16, + int[] pty3 = { y + height / 4, y + height / 4, y + height / 4 - height / 16, y + height / 4 + height / 16, y + height / 4, y + height / 4 }; g.drawPolygon(ptx3, pty3, 6); - int[] ptx4 = { x + 4 * width / 6 + width / 24, - x + 4 * width / 6 + width / 12 + width / 24 }; + int[] ptx4 = { x + 4 * width / 6 + width / 24, x + 4 * width / 6 + width / 12 + width / 24 }; int[] pty4 = { y + height - height / 4, y + height - height / 4 }; g.drawPolygon(ptx4, pty4, 2); - int[] ptx5 = { x + width / 6 - width / 12 - width / 24, - x + width / 6 - width / 12 - width / 24, - x + width / 6 - width / 12, - x + width / 6 - width / 12 - width / 24, - x + width / 6 - width / 6, + int[] ptx5 = { x + width / 6 - width / 12 - width / 24, x + width / 6 - width / 12 - width / 24, + x + width / 6 - width / 12, x + width / 6 - width / 12 - width / 24, x + width / 6 - width / 6, x + width / 6 - width / 12 - width / 24 }; - int[] pty5 = { y + height / 4, y + 3 * height / 4 - height / 8, - y + 3 * height / 4 - height / 8, y + 3 * height / 4, - y + 3 * height / 4 - height / 8, - y + 3 * height / 4 - height / 8 }; + int[] pty5 = { y + height / 4, y + 3 * height / 4 - height / 8, y + 3 * height / 4 - height / 8, + y + 3 * height / 4, y + 3 * height / 4 - height / 8, y + 3 * height / 4 - height / 8 }; g.drawPolygon(ptx5, pty5, 6); g.fillPolygon(ptx5, pty5, 6); g.drawOval(x, y, width / 12, height / 8); @@ -965,11 +801,9 @@ public class ELNComponentVoltageControlledCurrentSource extends g.setColor(Color.WHITE); g.fillOval(x, y + height - height / 8, width / 12, height / 8); g.setColor(c); - g.drawOval(x + width - width / 12, y + height - height / 8, width / 12, - height / 8); + g.drawOval(x + width - width / 12, y + height - height / 8, width / 12, height / 8); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 12, y + height - height / 8, width / 12, - height / 8); + g.fillOval(x + width - width / 12, y + height - height / 8, width / 12, height / 8); g.setColor(c); } @@ -981,41 +815,27 @@ public class ELNComponentVoltageControlledCurrentSource extends int[] ptx1 = { x + width - width / 16, x + width - width / 16 }; int[] pty1 = { y, y + 2 * height / 6 }; g.drawPolygon(ptx1, pty1, 2); - int[] ptx2 = { x + width / 16, x + width / 16, x + width / 4, - x + 2 * width / 4, x + 3 * width / 4, x + width - width / 16, - x + width - width / 16, x + width - width / 16, - x + 3 * width / 4, x + 2 * width / 4, x + 2 * width / 4, - x + 2 * width / 4, x + width / 4, x + width / 16 }; - int[] pty2 = { y + height, y + 4 * height / 6, y + 4 * height / 6, - y + 3 * height / 6, y + 4 * height / 6, y + 4 * height / 6, - y + height, y + 4 * height / 6, y + 4 * height / 6, - y + 5 * height / 6, y + 3 * height / 6, y + 5 * height / 6, - y + 4 * height / 6, y + 4 * height / 6 }; + int[] ptx2 = { x + width / 16, x + width / 16, x + width / 4, x + 2 * width / 4, x + 3 * width / 4, + x + width - width / 16, x + width - width / 16, x + width - width / 16, x + 3 * width / 4, + x + 2 * width / 4, x + 2 * width / 4, x + 2 * width / 4, x + width / 4, x + width / 16 }; + int[] pty2 = { y + height, y + 4 * height / 6, y + 4 * height / 6, y + 3 * height / 6, y + 4 * height / 6, + y + 4 * height / 6, y + height, y + 4 * height / 6, y + 4 * height / 6, y + 5 * height / 6, + y + 3 * height / 6, y + 5 * height / 6, y + 4 * height / 6, y + 4 * height / 6 }; g.drawPolygon(ptx2, pty2, 14); - int[] ptx3 = { x + width - width / 4, x + width - width / 4, - x + width - width / 4 + width / 16, - x + width - width / 4 - width / 16, x + width - width / 4, - x + width - width / 4 }; - int[] pty3 = { y + 2 * height / 6 - height / 12 - height / 24, - y + 2 * height / 6 - height / 12, - y + 2 * height / 6 - height / 12, - y + 2 * height / 6 - height / 12, - y + 2 * height / 6 - height / 12, + int[] ptx3 = { x + width - width / 4, x + width - width / 4, x + width - width / 4 + width / 16, + x + width - width / 4 - width / 16, x + width - width / 4, x + width - width / 4 }; + int[] pty3 = { y + 2 * height / 6 - height / 12 - height / 24, y + 2 * height / 6 - height / 12, + y + 2 * height / 6 - height / 12, y + 2 * height / 6 - height / 12, y + 2 * height / 6 - height / 12, y + 2 * height / 6 - height / 24 }; g.drawPolygon(ptx3, pty3, 6); int[] ptx4 = { x + width / 4, x + width / 4 }; - int[] pty4 = { y + 2 * height / 6 - height / 12 - height / 24, - y + 2 * height / 6 - height / 24 }; + int[] pty4 = { y + 2 * height / 6 - height / 12 - height / 24, y + 2 * height / 6 - height / 24 }; g.drawPolygon(ptx4, pty4, 2); - int[] ptx5 = { x + 3 * width / 4, x + width / 4 + width / 8, - x + width / 4 + width / 8, x + width / 4, + int[] ptx5 = { x + 3 * width / 4, x + width / 4 + width / 8, x + width / 4 + width / 8, x + width / 4, x + width / 4 + width / 8, x + width / 4 + width / 8 }; - int[] pty5 = { y + 5 * height / 6 + height / 12 + height / 24, - y + 5 * height / 6 + height / 12 + height / 24, - y + 5 * height / 6 + height / 12, - y + 5 * height / 6 + height / 12 + height / 24, - y + 5 * height / 6 + height / 6, - y + 5 * height / 6 + height / 12 + height / 24 }; + int[] pty5 = { y + 5 * height / 6 + height / 12 + height / 24, y + 5 * height / 6 + height / 12 + height / 24, + y + 5 * height / 6 + height / 12, y + 5 * height / 6 + height / 12 + height / 24, + y + 5 * height / 6 + height / 6, y + 5 * height / 6 + height / 12 + height / 24 }; g.drawPolygon(ptx5, pty5, 6); g.fillPolygon(ptx5, pty5, 6); g.drawOval(x, y, width / 8, height / 12); @@ -1030,11 +850,9 @@ public class ELNComponentVoltageControlledCurrentSource extends g.setColor(Color.WHITE); g.fillOval(x, y + height - height / 12, width / 8, height / 12); g.setColor(c); - g.drawOval(x + width - width / 8, y + height - height / 12, width / 8, - height / 12); + g.drawOval(x + width - width / 8, y + height - height / 12, width / 8, height / 12); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 8, y + height - height / 12, width / 8, - height / 12); + g.fillOval(x + width - width / 8, y + height - height / 12, width / 8, height / 12); g.setColor(c); } @@ -1046,40 +864,26 @@ public class ELNComponentVoltageControlledCurrentSource extends int[] ptx1 = { x + width - width / 16, x + width - width / 16 }; int[] pty1 = { y + 4 * height / 6, y + height }; g.drawPolygon(ptx1, pty1, 2); - int[] ptx2 = { x + width / 16, x + width / 16, x + width / 4, - x + 2 * width / 4, x + 3 * width / 4, x + width - width / 16, - x + width - width / 16, x + width - width / 16, - x + 3 * width / 4, x + 2 * width / 4, x + 2 * width / 4, - x + 2 * width / 4, x + width / 4, x + width / 16 }; - int[] pty2 = { y, y + 2 * height / 6, y + 2 * height / 6, - y + height / 6, y + 2 * height / 6, y + 2 * height / 6, y, - y + 2 * height / 6, y + 2 * height / 6, y + 3 * height / 6, - y + height / 6, y + 3 * height / 6, y + 2 * height / 6, - y + 2 * height / 6 }; + int[] ptx2 = { x + width / 16, x + width / 16, x + width / 4, x + 2 * width / 4, x + 3 * width / 4, + x + width - width / 16, x + width - width / 16, x + width - width / 16, x + 3 * width / 4, + x + 2 * width / 4, x + 2 * width / 4, x + 2 * width / 4, x + width / 4, x + width / 16 }; + int[] pty2 = { y, y + 2 * height / 6, y + 2 * height / 6, y + height / 6, y + 2 * height / 6, + y + 2 * height / 6, y, y + 2 * height / 6, y + 2 * height / 6, y + 3 * height / 6, y + height / 6, + y + 3 * height / 6, y + 2 * height / 6, y + 2 * height / 6 }; g.drawPolygon(ptx2, pty2, 14); - int[] ptx3 = { x + width - width / 4, x + width - width / 4, - x + width - width / 4 + width / 16, - x + width - width / 4 - width / 16, x + width - width / 4, - x + width - width / 4 }; - int[] pty3 = { y + 4 * height / 6 + height / 24, - y + 4 * height / 6 + height / 12, - y + 4 * height / 6 + height / 12, - y + 4 * height / 6 + height / 12, - y + 4 * height / 6 + height / 12, + int[] ptx3 = { x + width - width / 4, x + width - width / 4, x + width - width / 4 + width / 16, + x + width - width / 4 - width / 16, x + width - width / 4, x + width - width / 4 }; + int[] pty3 = { y + 4 * height / 6 + height / 24, y + 4 * height / 6 + height / 12, + y + 4 * height / 6 + height / 12, y + 4 * height / 6 + height / 12, y + 4 * height / 6 + height / 12, y + 4 * height / 6 + height / 12 + height / 24 }; g.drawPolygon(ptx3, pty3, 6); int[] ptx4 = { x + width / 4, x + width / 4 }; - int[] pty4 = { y + 4 * height / 6 + height / 24, - y + 4 * height / 6 + height / 12 + height / 24 }; + int[] pty4 = { y + 4 * height / 6 + height / 24, y + 4 * height / 6 + height / 12 + height / 24 }; g.drawPolygon(ptx4, pty4, 2); - int[] ptx5 = { x + 3 * width / 4, x + width / 4 + width / 8, - x + width / 4 + width / 8, x + width / 4, + int[] ptx5 = { x + 3 * width / 4, x + width / 4 + width / 8, x + width / 4 + width / 8, x + width / 4, x + width / 4 + width / 8, x + width / 4 + width / 8 }; - int[] pty5 = { y + height / 6 - height / 12 - height / 24, - y + height / 6 - height / 12 - height / 24, - y + height / 6 - height / 12, - y + height / 6 - height / 12 - height / 24, - y + height / 6 - height / 6, + int[] pty5 = { y + height / 6 - height / 12 - height / 24, y + height / 6 - height / 12 - height / 24, + y + height / 6 - height / 12, y + height / 6 - height / 12 - height / 24, y + height / 6 - height / 6, y + height / 6 - height / 12 - height / 24 }; g.drawPolygon(ptx5, pty5, 6); g.fillPolygon(ptx5, pty5, 6); @@ -1095,11 +899,9 @@ public class ELNComponentVoltageControlledCurrentSource extends g.setColor(Color.WHITE); g.fillOval(x, y + height - height / 12, width / 8, height / 12); g.setColor(c); - g.drawOval(x + width - width / 8, y + height - height / 12, width / 8, - height / 12); + g.drawOval(x + width - width / 8, y + height - height / 12, width / 8, height / 12); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 8, y + height - height / 12, width / 8, - height / 12); + g.fillOval(x + width - width / 8, y + height - height / 12, width / 8, height / 12); g.setColor(c); } @@ -1111,39 +913,26 @@ public class ELNComponentVoltageControlledCurrentSource extends int[] ptx1 = { x + width - width / 16, x + width - width / 16 }; int[] pty1 = { y + 4 * height / 6, y + height }; g.drawPolygon(ptx1, pty1, 2); - int[] ptx2 = { x + width / 16, x + width / 16, x + width / 4, - x + 2 * width / 4, x + 3 * width / 4, x + width - width / 16, - x + width - width / 16, x + width - width / 16, - x + 3 * width / 4, x + 2 * width / 4, x + 2 * width / 4, - x + 2 * width / 4, x + width / 4, x + width / 16 }; - int[] pty2 = { y, y + 2 * height / 6, y + 2 * height / 6, - y + height / 6, y + 2 * height / 6, y + 2 * height / 6, y, - y + 2 * height / 6, y + 2 * height / 6, y + 3 * height / 6, - y + height / 6, y + 3 * height / 6, y + 2 * height / 6, - y + 2 * height / 6 }; + int[] ptx2 = { x + width / 16, x + width / 16, x + width / 4, x + 2 * width / 4, x + 3 * width / 4, + x + width - width / 16, x + width - width / 16, x + width - width / 16, x + 3 * width / 4, + x + 2 * width / 4, x + 2 * width / 4, x + 2 * width / 4, x + width / 4, x + width / 16 }; + int[] pty2 = { y, y + 2 * height / 6, y + 2 * height / 6, y + height / 6, y + 2 * height / 6, + y + 2 * height / 6, y, y + 2 * height / 6, y + 2 * height / 6, y + 3 * height / 6, y + height / 6, + y + 3 * height / 6, y + 2 * height / 6, y + 2 * height / 6 }; g.drawPolygon(ptx2, pty2, 14); - int[] ptx3 = { x + width / 4, x + width / 4, - x + width / 4 - width / 16, x + width / 4 + width / 16, + int[] ptx3 = { x + width / 4, x + width / 4, x + width / 4 - width / 16, x + width / 4 + width / 16, x + width / 4, x + width / 4 }; - int[] pty3 = { y + 4 * height / 6 + height / 24, - y + 4 * height / 6 + height / 12, - y + 4 * height / 6 + height / 12, - y + 4 * height / 6 + height / 12, - y + 4 * height / 6 + height / 12, + int[] pty3 = { y + 4 * height / 6 + height / 24, y + 4 * height / 6 + height / 12, + y + 4 * height / 6 + height / 12, y + 4 * height / 6 + height / 12, y + 4 * height / 6 + height / 12, y + 4 * height / 6 + height / 12 + height / 24 }; g.drawPolygon(ptx3, pty3, 6); int[] ptx4 = { x + width - width / 4, x + width - width / 4 }; - int[] pty4 = { y + 4 * height / 6 + height / 24, - y + 4 * height / 6 + height / 12 + height / 24 }; + int[] pty4 = { y + 4 * height / 6 + height / 24, y + 4 * height / 6 + height / 12 + height / 24 }; g.drawPolygon(ptx4, pty4, 2); - int[] ptx5 = { x + width / 4, x + 3 * width / 4 - width / 8, - x + 3 * width / 4 - width / 8, x + 3 * width / 4, + int[] ptx5 = { x + width / 4, x + 3 * width / 4 - width / 8, x + 3 * width / 4 - width / 8, x + 3 * width / 4, x + 3 * width / 4 - width / 8, x + 3 * width / 4 - width / 8 }; - int[] pty5 = { y + height / 6 - height / 12 - height / 24, - y + height / 6 - height / 12 - height / 24, - y + height / 6 - height / 12, - y + height / 6 - height / 12 - height / 24, - y + height / 6 - height / 6, + int[] pty5 = { y + height / 6 - height / 12 - height / 24, y + height / 6 - height / 12 - height / 24, + y + height / 6 - height / 12, y + height / 6 - height / 12 - height / 24, y + height / 6 - height / 6, y + height / 6 - height / 12 - height / 24 }; g.drawPolygon(ptx5, pty5, 6); g.fillPolygon(ptx5, pty5, 6); @@ -1159,11 +948,9 @@ public class ELNComponentVoltageControlledCurrentSource extends g.setColor(Color.WHITE); g.fillOval(x, y + height - height / 12, width / 8, height / 12); g.setColor(c); - g.drawOval(x + width - width / 8, y + height - height / 12, width / 8, - height / 12); + g.drawOval(x + width - width / 8, y + height - height / 12, width / 8, height / 12); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 8, y + height - height / 12, width / 8, - height / 12); + g.fillOval(x + width - width / 8, y + height - height / 12, width / 8, height / 12); g.setColor(c); } @@ -1175,40 +962,27 @@ public class ELNComponentVoltageControlledCurrentSource extends int[] ptx1 = { x + width - width / 16, x + width - width / 16 }; int[] pty1 = { y, y + 2 * height / 6 }; g.drawPolygon(ptx1, pty1, 2); - int[] ptx2 = { x + width / 16, x + width / 16, x + width / 4, - x + 2 * width / 4, x + 3 * width / 4, x + width - width / 16, - x + width - width / 16, x + width - width / 16, - x + 3 * width / 4, x + 2 * width / 4, x + 2 * width / 4, - x + 2 * width / 4, x + width / 4, x + width / 16 }; - int[] pty2 = { y + height, y + 4 * height / 6, y + 4 * height / 6, - y + 3 * height / 6, y + 4 * height / 6, y + 4 * height / 6, - y + height, y + 4 * height / 6, y + 4 * height / 6, - y + 5 * height / 6, y + 3 * height / 6, y + 5 * height / 6, - y + 4 * height / 6, y + 4 * height / 6 }; + int[] ptx2 = { x + width / 16, x + width / 16, x + width / 4, x + 2 * width / 4, x + 3 * width / 4, + x + width - width / 16, x + width - width / 16, x + width - width / 16, x + 3 * width / 4, + x + 2 * width / 4, x + 2 * width / 4, x + 2 * width / 4, x + width / 4, x + width / 16 }; + int[] pty2 = { y + height, y + 4 * height / 6, y + 4 * height / 6, y + 3 * height / 6, y + 4 * height / 6, + y + 4 * height / 6, y + height, y + 4 * height / 6, y + 4 * height / 6, y + 5 * height / 6, + y + 3 * height / 6, y + 5 * height / 6, y + 4 * height / 6, y + 4 * height / 6 }; g.drawPolygon(ptx2, pty2, 14); - int[] ptx3 = { x + width / 4, x + width / 4, - x + width / 4 - width / 16, x + width / 4 + width / 16, + int[] ptx3 = { x + width / 4, x + width / 4, x + width / 4 - width / 16, x + width / 4 + width / 16, x + width / 4, x + width / 4 }; - int[] pty3 = { y + 2 * height / 6 - height / 12 - height / 24, - y + 2 * height / 6 - height / 12, - y + 2 * height / 6 - height / 12, - y + 2 * height / 6 - height / 12, - y + 2 * height / 6 - height / 12, + int[] pty3 = { y + 2 * height / 6 - height / 12 - height / 24, y + 2 * height / 6 - height / 12, + y + 2 * height / 6 - height / 12, y + 2 * height / 6 - height / 12, y + 2 * height / 6 - height / 12, y + 2 * height / 6 - height / 24 }; g.drawPolygon(ptx3, pty3, 6); int[] ptx4 = { x + width - width / 4, x + width - width / 4 }; - int[] pty4 = { y + 2 * height / 6 - height / 12 - height / 24, - y + 2 * height / 6 - height / 24 }; + int[] pty4 = { y + 2 * height / 6 - height / 12 - height / 24, y + 2 * height / 6 - height / 24 }; g.drawPolygon(ptx4, pty4, 2); - int[] ptx5 = { x + width / 4, x + 3 * width / 4 - width / 8, - x + 3 * width / 4 - width / 8, x + 3 * width / 4, + int[] ptx5 = { x + width / 4, x + 3 * width / 4 - width / 8, x + 3 * width / 4 - width / 8, x + 3 * width / 4, x + 3 * width / 4 - width / 8, x + 3 * width / 4 - width / 8 }; - int[] pty5 = { y + 5 * height / 6 + height / 12 + height / 24, - y + 5 * height / 6 + height / 12 + height / 24, - y + 5 * height / 6 + height / 12, - y + 5 * height / 6 + height / 12 + height / 24, - y + 5 * height / 6 + height / 6, - y + 5 * height / 6 + height / 12 + height / 24 }; + int[] pty5 = { y + 5 * height / 6 + height / 12 + height / 24, y + 5 * height / 6 + height / 12 + height / 24, + y + 5 * height / 6 + height / 12, y + 5 * height / 6 + height / 12 + height / 24, + y + 5 * height / 6 + height / 6, y + 5 * height / 6 + height / 12 + height / 24 }; g.drawPolygon(ptx5, pty5, 6); g.fillPolygon(ptx5, pty5, 6); g.drawOval(x, y, width / 8, height / 12); @@ -1223,11 +997,9 @@ public class ELNComponentVoltageControlledCurrentSource extends g.setColor(Color.WHITE); g.fillOval(x, y + height - height / 12, width / 8, height / 12); g.setColor(c); - g.drawOval(x + width - width / 8, y + height - height / 12, width / 8, - height / 12); + g.drawOval(x + width - width / 8, y + height - height / 12, width / 8, height / 12); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 8, y + height - height / 12, width / 8, - height / 12); + g.fillOval(x + width - width / 8, y + height - height / 12, width / 8, height / 12); g.setColor(c); } @@ -1281,8 +1053,7 @@ public class ELNComponentVoltageControlledCurrentSource extends return new String(sb); } - public void loadExtraParam(NodeList nl, int decX, int decY, int decId) - throws MalformedModelingException { + public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException { try { NodeList nli; Node n1, n2; @@ -1302,21 +1073,14 @@ public class ELNComponentVoltageControlledCurrentSource extends if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; if (elt.getTagName().equals("attributes")) { - value = Double.parseDouble(elt - .getAttribute("value")); + value = Double.parseDouble(elt.getAttribute("value")); unit = elt.getAttribute("unit"); - position = Integer.parseInt(elt - .getAttribute("position")); - fv_0_2 = Boolean.parseBoolean(elt - .getAttribute("fv_0_2")); - fv_1_3 = Boolean.parseBoolean(elt - .getAttribute("fv_1_3")); - fh_0_2 = Boolean.parseBoolean(elt - .getAttribute("fh_0_2")); - fh_1_3 = Boolean.parseBoolean(elt - .getAttribute("fh_1_3")); - first = Boolean.parseBoolean(elt - .getAttribute("first")); + position = Integer.parseInt(elt.getAttribute("position")); + fv_0_2 = Boolean.parseBoolean(elt.getAttribute("fv_0_2")); + fv_1_3 = Boolean.parseBoolean(elt.getAttribute("fv_1_3")); + fh_0_2 = Boolean.parseBoolean(elt.getAttribute("fh_0_2")); + fh_1_3 = Boolean.parseBoolean(elt.getAttribute("fh_1_3")); + first = Boolean.parseBoolean(elt.getAttribute("first")); setVal(value); setUnit(unit); setPosition(position); @@ -1335,8 +1099,7 @@ public class ELNComponentVoltageControlledCurrentSource extends } } - public void addActionToPopupMenu(JPopupMenu componentMenu, - ActionListener menuAL, int x, int y) { + public void addActionToPopupMenu(JPopupMenu componentMenu, ActionListener menuAL, int x, int y) { componentMenu.addSeparator(); JMenuItem rotateright = new JMenuItem("Rotate right 90\u00b0"); @@ -1475,8 +1238,7 @@ public class ELNComponentVoltageControlledCurrentSource extends if ((father != null) && (father instanceof ELNModule)) { resizeToFatherSize(); - setCdRectangle(0, father.getWidth() - getWidth(), 0, - father.getHeight() - getHeight()); + setCdRectangle(0, father.getWidth() - getWidth(), 0, father.getHeight() - getHeight()); setMoveCd(x, y); } } @@ -1489,7 +1251,6 @@ public class ELNComponentVoltageControlledCurrentSource extends myColor = null; setFather(null); TDiagramPanel tdp = getTDiagramPanel(); - setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), - tdp.getMaxY()); + setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY()); } } \ No newline at end of file diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledVoltageSource.java b/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledVoltageSource.java index d145271d59..21937fed61 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledVoltageSource.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledVoltageSource.java @@ -51,16 +51,14 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** - * Class ELNComponentVoltageControlledVoltageSource Voltage controlled voltage - * source to be used in ELN diagrams Creation: 13/06/2018 - * + * Class ELNComponentVoltageControlledVoltageSource + * Voltage controlled voltage source to be used in ELN diagrams + * Creation: 13/06/2018 * @version 1.0 13/06/2018 * @author Irina Kit Yan LEE */ -public class ELNComponentVoltageControlledVoltageSource extends - TGCScalableWithInternalComponent implements ActionListener, - SwallowedTGComponent, ELNComponent { +public class ELNComponentVoltageControlledVoltageSource extends TGCScalableWithInternalComponent implements ActionListener, SwallowedTGComponent, ELNComponent { protected Color myColor; protected int orientation; private int maxFontSize = 14; @@ -74,14 +72,11 @@ public class ELNComponentVoltageControlledVoltageSource extends private double val; private int position = 0; - private boolean fv_0_2 = false, fv_1_3 = false, fh_0_2 = false, - fh_1_3 = false; + private boolean fv_0_2 = false, fv_1_3 = false, fh_0_2 = false, fh_1_3 = false; private int old; private boolean first; - public ELNComponentVoltageControlledVoltageSource(int _x, int _y, - int _minX, int _maxX, int _minY, int _maxY, boolean _pos, - TGComponent _father, TDiagramPanel _tdp) { + public ELNComponentVoltageControlledVoltageSource(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); initScaling(120, 80); @@ -113,14 +108,10 @@ public class ELNComponentVoltageControlledVoltageSource extends public void initPortTerminal(int nb) { nbConnectingPoint = nb; connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "ncp"); - connectingPoint[1] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "np"); - connectingPoint[2] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "ncn"); - connectingPoint[3] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "nn"); + connectingPoint[0] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "ncp"); + connectingPoint[1] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "np"); + connectingPoint[2] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "ncn"); + connectingPoint[3] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "nn"); } public Color getMyColor() { @@ -134,10 +125,7 @@ public class ELNComponentVoltageControlledVoltageSource extends if (this.rescaled && !this.tdp.isScaled()) { this.rescaled = false; - int maxCurrentFontSize = Math.max( - 0, - Math.min(this.height, - (int) (this.maxFontSize * this.tdp.getZoom()))); + int maxCurrentFontSize = Math.max(0, Math.min(this.height, (int) (this.maxFontSize * this.tdp.getZoom()))); f = f.deriveFont((float) maxCurrentFontSize); while (maxCurrentFontSize > (this.minFontSize * this.tdp.getZoom() - 1)) { @@ -200,18 +188,12 @@ public class ELNComponentVoltageControlledVoltageSource extends ((ELNPortTerminal) connectingPoint[3]).setW(1.0); ((ELNPortTerminal) connectingPoint[3]).setH(15.0 / 16.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - sw2, y + height + height / 16 + sh2); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width, y + height + height / 16 + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - sw2, + y + height + height / 16 + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width, + y + height + height / 16 + sh3); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -228,18 +210,12 @@ public class ELNComponentVoltageControlledVoltageSource extends ((ELNPortTerminal) connectingPoint[2]).setW(1.0); ((ELNPortTerminal) connectingPoint[2]).setH(15.0 / 16.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - sw3, y + height + height / 16 + sh3); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width, y + height + height / 16 + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - sw3, + y + height + height / 16 + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width, + y + height + height / 16 + sh2); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -256,18 +232,12 @@ public class ELNComponentVoltageControlledVoltageSource extends ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(15.0 / 16.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - sw2, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + height + height / 16 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height + height / 16 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - sw2, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + height + height / 16 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height + height / 16 + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -284,18 +254,12 @@ public class ELNComponentVoltageControlledVoltageSource extends ((ELNPortTerminal) connectingPoint[0]).setW(1.0); ((ELNPortTerminal) connectingPoint[0]).setH(15.0 / 16.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - sw3, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + height + height / 16 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height + height / 16 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - sw3, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + height + height / 16 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height + height / 16 + sh0); } } } else if (position == 1) { @@ -338,18 +302,12 @@ public class ELNComponentVoltageControlledVoltageSource extends ((ELNPortTerminal) connectingPoint[1]).setW(15.0 / 16.0); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - width / 16 - sw2, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width + width / 16, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - width / 16 - sw3, y + height + sh3); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width + width / 16, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - width / 16 - sw2, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width + width / 16, y); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - width / 16 - sw3, + y + height + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width + width / 16, + y + height + sh1); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -366,18 +324,12 @@ public class ELNComponentVoltageControlledVoltageSource extends ((ELNPortTerminal) connectingPoint[0]).setW(15.0 / 16.0); ((ELNPortTerminal) connectingPoint[0]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - width / 16 - sw3, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width + width / 16, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - width / 16 - sw2, y + height + sh2); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width + width / 16, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - width / 16 - sw3, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width + width / 16, y); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - width / 16 - sw2, + y + height + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width + width / 16, + y + height + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -394,18 +346,12 @@ public class ELNComponentVoltageControlledVoltageSource extends ((ELNPortTerminal) connectingPoint[3]).setW(15.0 / 16.0); ((ELNPortTerminal) connectingPoint[3]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - width / 16 - sw0, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width + width / 16, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - width / 16 - sw1, y + height + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width + width / 16, y + height + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - width / 16 - sw0, y); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width + width / 16, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - width / 16 - sw1, + y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width + width / 16, + y + height + sh3); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -422,18 +368,12 @@ public class ELNComponentVoltageControlledVoltageSource extends ((ELNPortTerminal) connectingPoint[2]).setW(15.0 / 16.0); ((ELNPortTerminal) connectingPoint[2]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - width / 16 - sw1, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width + width / 16, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - width / 16 - sw0, y + height + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width + width / 16, y + height + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - width / 16 - sw1, y); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width + width / 16, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - width / 16 - sw0, + y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width + width / 16, + y + height + sh2); } } } else if (position == 2) { @@ -476,18 +416,12 @@ public class ELNComponentVoltageControlledVoltageSource extends ((ELNPortTerminal) connectingPoint[0]).setW(1.0); ((ELNPortTerminal) connectingPoint[0]).setH(15.0 / 16.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - sw3, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + height + height / 16 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height + height / 16 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - sw3, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + height + height / 16 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height + height / 16 + sh0); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -504,18 +438,12 @@ public class ELNComponentVoltageControlledVoltageSource extends ((ELNPortTerminal) connectingPoint[1]).setW(1.0); ((ELNPortTerminal) connectingPoint[1]).setH(15.0 / 16.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - sw2, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + height + height / 16 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height + height / 16 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - sw2, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + height + height / 16 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height + height / 16 + sh1); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -532,18 +460,12 @@ public class ELNComponentVoltageControlledVoltageSource extends ((ELNPortTerminal) connectingPoint[2]).setW(1.0); ((ELNPortTerminal) connectingPoint[2]).setH(15.0 / 16.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - sw3, y + height + height / 16 + sh3); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width, y + height + height / 16 + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - sw3, + y + height + height / 16 + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width, + y + height + height / 16 + sh2); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -560,18 +482,12 @@ public class ELNComponentVoltageControlledVoltageSource extends ((ELNPortTerminal) connectingPoint[3]).setW(1.0); ((ELNPortTerminal) connectingPoint[3]).setH(15.0 / 16.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y - height / 16); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - sw2, y + height + height / 16 + sh2); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width, y + height + height / 16 + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, y - height / 16); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - sw2, + y + height + height / 16 + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width, + y + height + height / 16 + sh3); } } } else if (position == 3) { @@ -614,18 +530,12 @@ public class ELNComponentVoltageControlledVoltageSource extends ((ELNPortTerminal) connectingPoint[2]).setW(15.0 / 16.0); ((ELNPortTerminal) connectingPoint[2]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - width / 16 - sw1, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width + width / 16, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - width / 16 - sw0, y + height + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width + width / 16, y + height + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - width / 16 - sw1, y); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width + width / 16, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - width / 16 - sw0, + y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width + width / 16, + y + height + sh2); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -642,18 +552,12 @@ public class ELNComponentVoltageControlledVoltageSource extends ((ELNPortTerminal) connectingPoint[3]).setW(15.0 / 16.0); ((ELNPortTerminal) connectingPoint[3]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - width / 16 - sw0, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width + width / 16, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - width / 16 - sw1, y + height + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - + width + width / 16, y + height + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - width / 16 - sw0, y); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width + width / 16, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - width / 16 - sw1, + y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x + width + width / 16, + y + height + sh3); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -670,18 +574,12 @@ public class ELNComponentVoltageControlledVoltageSource extends ((ELNPortTerminal) connectingPoint[0]).setW(15.0 / 16.0); ((ELNPortTerminal) connectingPoint[0]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - width / 16 - sw3, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width + width / 16, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - width / 16 - sw2, y + height + sh2); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width + width / 16, y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - width / 16 - sw3, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width + width / 16, y); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - width / 16 - sw2, + y + height + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width + width / 16, + y + height + sh0); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -698,18 +596,12 @@ public class ELNComponentVoltageControlledVoltageSource extends ((ELNPortTerminal) connectingPoint[1]).setW(15.0 / 16.0); ((ELNPortTerminal) connectingPoint[1]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - width / 16 - sw2, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width + width / 16, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[3]).getName(), x - - width / 16 - sw3, y + height + sh3); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width + width / 16, y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - width / 16 - sw2, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width + width / 16, y); + g.drawString(((ELNPortTerminal) connectingPoint[3]).getName(), x - width / 16 - sw3, + y + height + sh3); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width + width / 16, + y + height + sh1); } } } @@ -725,38 +617,29 @@ public class ELNComponentVoltageControlledVoltageSource extends int[] ptx1 = { x, x + 2 * width / 6 }; int[] pty1 = { y + height - height / 16, y + height - height / 16 }; g.drawPolygon(ptx1, pty1, 2); - int[] ptx2 = { x + width, x + 4 * width / 6, x + 4 * width / 6, - x + 3 * width / 6, x + 4 * width / 6, x + 4 * width / 6, - x + 5 * width / 6, x + 4 * width / 6, x + 4 * width / 6, - x + width, x + 4 * width / 6, x + 4 * width / 6 }; - int[] pty2 = { y + height / 16, y + height / 16, y + height / 4, - y + 2 * height / 4, y + 3 * height / 4, y + height / 4, - y + 2 * height / 4, y + 3 * height / 4, - y + height - height / 16, y + height - height / 16, - y + height - height / 16, y + height / 16 }; + int[] ptx2 = { x + width, x + 4 * width / 6, x + 4 * width / 6, x + 3 * width / 6, x + 4 * width / 6, + x + 4 * width / 6, x + 5 * width / 6, x + 4 * width / 6, x + 4 * width / 6, x + width, + x + 4 * width / 6, x + 4 * width / 6 }; + int[] pty2 = { y + height / 16, y + height / 16, y + height / 4, y + 2 * height / 4, y + 3 * height / 4, + y + height / 4, y + 2 * height / 4, y + 3 * height / 4, y + height - height / 16, + y + height - height / 16, y + height - height / 16, y + height / 16 }; g.drawPolygon(ptx2, pty2, 12); - int[] ptx3 = { x + 2 * width / 6 - width / 12 - width / 24, - x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 12, - x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 12, + int[] ptx3 = { x + 2 * width / 6 - width / 12 - width / 24, x + 2 * width / 6 - width / 12, + x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 24 }; - int[] pty3 = { y + height / 4, y + height / 4, - y + height / 4 - height / 16, y + height / 4 + height / 16, + int[] pty3 = { y + height / 4, y + height / 4, y + height / 4 - height / 16, y + height / 4 + height / 16, y + height / 4, y + height / 4 }; g.drawPolygon(ptx3, pty3, 6); - int[] ptx4 = { x + 2 * width / 6 - width / 12 - width / 24, - x + 2 * width / 6 - width / 24 }; + int[] ptx4 = { x + 2 * width / 6 - width / 12 - width / 24, x + 2 * width / 6 - width / 24 }; int[] pty4 = { y + height - height / 4, y + height - height / 4 }; g.drawPolygon(ptx4, pty4, 2); - int[] ptx5 = { x + 4 * width / 6 + width / 24, - x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12, + int[] ptx5 = { x + 4 * width / 6 + width / 24, x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12 + width / 24 }; - int[] pty5 = { y + height / 4, y + height / 4, - y + height / 4 - height / 16, y + height / 4 + height / 16, + int[] pty5 = { y + height / 4, y + height / 4, y + height / 4 - height / 16, y + height / 4 + height / 16, y + height / 4, y + height / 4 }; g.drawPolygon(ptx5, pty5, 6); - int[] ptx6 = { x + 4 * width / 6 + width / 24, - x + 4 * width / 6 + width / 12 + width / 24 }; + int[] ptx6 = { x + 4 * width / 6 + width / 24, x + 4 * width / 6 + width / 12 + width / 24 }; int[] pty6 = { y + height - height / 4, y + height - height / 4 }; g.drawPolygon(ptx6, pty6, 2); g.drawOval(x, y, width / 12, height / 8); @@ -771,11 +654,9 @@ public class ELNComponentVoltageControlledVoltageSource extends g.setColor(Color.WHITE); g.fillOval(x, y + height - height / 8, width / 12, height / 8); g.setColor(c); - g.drawOval(x + width - width / 12, y + height - height / 8, width / 12, - height / 8); + g.drawOval(x + width - width / 12, y + height - height / 8, width / 12, height / 8); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 12, y + height - height / 8, width / 12, - height / 8); + g.fillOval(x + width - width / 12, y + height - height / 8, width / 12, height / 8); g.setColor(c); } @@ -787,40 +668,29 @@ public class ELNComponentVoltageControlledVoltageSource extends int[] ptx1 = { x, x + 2 * width / 6 }; int[] pty1 = { y + height - height / 16, y + height - height / 16 }; g.drawPolygon(ptx1, pty1, 2); - int[] ptx2 = { x + width, x + 4 * width / 6, x + 4 * width / 6, - x + 3 * width / 6, x + 4 * width / 6, x + 4 * width / 6, - x + 5 * width / 6, x + 4 * width / 6, x + 4 * width / 6, - x + width, x + 4 * width / 6, x + 4 * width / 6 }; - int[] pty2 = { y + height / 16, y + height / 16, y + height / 4, - y + 2 * height / 4, y + 3 * height / 4, y + height / 4, - y + 2 * height / 4, y + 3 * height / 4, - y + height - height / 16, y + height - height / 16, - y + height - height / 16, y + height / 16 }; + int[] ptx2 = { x + width, x + 4 * width / 6, x + 4 * width / 6, x + 3 * width / 6, x + 4 * width / 6, + x + 4 * width / 6, x + 5 * width / 6, x + 4 * width / 6, x + 4 * width / 6, x + width, + x + 4 * width / 6, x + 4 * width / 6 }; + int[] pty2 = { y + height / 16, y + height / 16, y + height / 4, y + 2 * height / 4, y + 3 * height / 4, + y + height / 4, y + 2 * height / 4, y + 3 * height / 4, y + height - height / 16, + y + height - height / 16, y + height - height / 16, y + height / 16 }; g.drawPolygon(ptx2, pty2, 12); - int[] ptx3 = { x + 2 * width / 6 - width / 12 - width / 24, - x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 12, - x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 12, + int[] ptx3 = { x + 2 * width / 6 - width / 12 - width / 24, x + 2 * width / 6 - width / 12, + x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 24 }; - int[] pty3 = { y + height - height / 4, y + height - height / 4, - y + height - height / 4 + height / 16, - y + height - height / 4 - height / 16, y + height - height / 4, - y + height - height / 4 }; + int[] pty3 = { y + height - height / 4, y + height - height / 4, y + height - height / 4 + height / 16, + y + height - height / 4 - height / 16, y + height - height / 4, y + height - height / 4 }; g.drawPolygon(ptx3, pty3, 6); - int[] ptx4 = { x + 2 * width / 6 - width / 12 - width / 24, - x + 2 * width / 6 - width / 24 }; + int[] ptx4 = { x + 2 * width / 6 - width / 12 - width / 24, x + 2 * width / 6 - width / 24 }; int[] pty4 = { y + height / 4, y + height / 4 }; g.drawPolygon(ptx4, pty4, 2); - int[] ptx5 = { x + 4 * width / 6 + width / 24, - x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12, + int[] ptx5 = { x + 4 * width / 6 + width / 24, x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12 + width / 24 }; - int[] pty5 = { y + height - height / 4, y + height - height / 4, - y + height - height / 4 + height / 16, - y + height - height / 4 - height / 16, y + height - height / 4, - y + height - height / 4 }; + int[] pty5 = { y + height - height / 4, y + height - height / 4, y + height - height / 4 + height / 16, + y + height - height / 4 - height / 16, y + height - height / 4, y + height - height / 4 }; g.drawPolygon(ptx5, pty5, 6); - int[] ptx6 = { x + 4 * width / 6 + width / 24, - x + 4 * width / 6 + width / 12 + width / 24 }; + int[] ptx6 = { x + 4 * width / 6 + width / 24, x + 4 * width / 6 + width / 12 + width / 24 }; int[] pty6 = { y + height / 4, y + height / 4 }; g.drawPolygon(ptx6, pty6, 2); g.drawOval(x, y, width / 12, height / 8); @@ -835,11 +705,9 @@ public class ELNComponentVoltageControlledVoltageSource extends g.setColor(Color.WHITE); g.fillOval(x, y + height - height / 8, width / 12, height / 8); g.setColor(c); - g.drawOval(x + width - width / 12, y + height - height / 8, width / 12, - height / 8); + g.drawOval(x + width - width / 12, y + height - height / 8, width / 12, height / 8); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 12, y + height - height / 8, width / 12, - height / 8); + g.fillOval(x + width - width / 12, y + height - height / 8, width / 12, height / 8); g.setColor(c); } @@ -851,40 +719,28 @@ public class ELNComponentVoltageControlledVoltageSource extends int[] ptx1 = { x + 4 * width / 6, x + width }; int[] pty1 = { y + height - height / 16, y + height - height / 16 }; g.drawPolygon(ptx1, pty1, 2); - int[] ptx2 = { x, x + 2 * width / 6, x + 2 * width / 6, x + width / 6, - x + 2 * width / 6, x + 2 * width / 6, x + 3 * width / 6, - x + 2 * width / 6, x + 2 * width / 6, x, x + 2 * width / 6, - x + 2 * width / 6 }; - int[] pty2 = { y + height / 16, y + height / 16, y + height / 4, - y + 2 * height / 4, y + 3 * height / 4, y + height / 4, - y + 2 * height / 4, y + 3 * height / 4, - y + height - height / 16, y + height - height / 16, - y + height - height / 16, y + height / 16 }; + int[] ptx2 = { x, x + 2 * width / 6, x + 2 * width / 6, x + width / 6, x + 2 * width / 6, x + 2 * width / 6, + x + 3 * width / 6, x + 2 * width / 6, x + 2 * width / 6, x, x + 2 * width / 6, x + 2 * width / 6 }; + int[] pty2 = { y + height / 16, y + height / 16, y + height / 4, y + 2 * height / 4, y + 3 * height / 4, + y + height / 4, y + 2 * height / 4, y + 3 * height / 4, y + height - height / 16, + y + height - height / 16, y + height - height / 16, y + height / 16 }; g.drawPolygon(ptx2, pty2, 12); - int[] ptx3 = { x + 2 * width / 6 - width / 12 - width / 24, - x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 12, - x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 12, + int[] ptx3 = { x + 2 * width / 6 - width / 12 - width / 24, x + 2 * width / 6 - width / 12, + x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 24 }; - int[] pty3 = { y + height - height / 4, y + height - height / 4, - y + height - height / 4 + height / 16, - y + height - height / 4 - height / 16, y + height - height / 4, - y + height - height / 4 }; + int[] pty3 = { y + height - height / 4, y + height - height / 4, y + height - height / 4 + height / 16, + y + height - height / 4 - height / 16, y + height - height / 4, y + height - height / 4 }; g.drawPolygon(ptx3, pty3, 6); - int[] ptx4 = { x + 2 * width / 6 - width / 12 - width / 24, - x + 2 * width / 6 - width / 24 }; + int[] ptx4 = { x + 2 * width / 6 - width / 12 - width / 24, x + 2 * width / 6 - width / 24 }; int[] pty4 = { y + height / 4, y + height / 4 }; g.drawPolygon(ptx4, pty4, 2); - int[] ptx5 = { x + 4 * width / 6 + width / 24, - x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12, + int[] ptx5 = { x + 4 * width / 6 + width / 24, x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12 + width / 24 }; - int[] pty5 = { y + height - height / 4, y + height - height / 4, - y + height - height / 4 + height / 16, - y + height - height / 4 - height / 16, y + height - height / 4, - y + height - height / 4 }; + int[] pty5 = { y + height - height / 4, y + height - height / 4, y + height - height / 4 + height / 16, + y + height - height / 4 - height / 16, y + height - height / 4, y + height - height / 4 }; g.drawPolygon(ptx5, pty5, 6); - int[] ptx6 = { x + 4 * width / 6 + width / 24, - x + 4 * width / 6 + width / 12 + width / 24 }; + int[] ptx6 = { x + 4 * width / 6 + width / 24, x + 4 * width / 6 + width / 12 + width / 24 }; int[] pty6 = { y + height / 4, y + height / 4 }; g.drawPolygon(ptx6, pty6, 2); g.drawOval(x, y, width / 12, height / 8); @@ -899,11 +755,9 @@ public class ELNComponentVoltageControlledVoltageSource extends g.setColor(Color.WHITE); g.fillOval(x, y + height - height / 8, width / 12, height / 8); g.setColor(c); - g.drawOval(x + width - width / 12, y + height - height / 8, width / 12, - height / 8); + g.drawOval(x + width - width / 12, y + height - height / 8, width / 12, height / 8); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 12, y + height - height / 8, width / 12, - height / 8); + g.fillOval(x + width - width / 12, y + height - height / 8, width / 12, height / 8); g.setColor(c); } @@ -915,38 +769,28 @@ public class ELNComponentVoltageControlledVoltageSource extends int[] ptx1 = { x + 4 * width / 6, x + width }; int[] pty1 = { y + height - height / 16, y + height - height / 16 }; g.drawPolygon(ptx1, pty1, 2); - int[] ptx2 = { x, x + 2 * width / 6, x + 2 * width / 6, x + width / 6, - x + 2 * width / 6, x + 2 * width / 6, x + 3 * width / 6, - x + 2 * width / 6, x + 2 * width / 6, x, x + 2 * width / 6, - x + 2 * width / 6 }; - int[] pty2 = { y + height / 16, y + height / 16, y + height / 4, - y + 2 * height / 4, y + 3 * height / 4, y + height / 4, - y + 2 * height / 4, y + 3 * height / 4, - y + height - height / 16, y + height - height / 16, - y + height - height / 16, y + height / 16 }; + int[] ptx2 = { x, x + 2 * width / 6, x + 2 * width / 6, x + width / 6, x + 2 * width / 6, x + 2 * width / 6, + x + 3 * width / 6, x + 2 * width / 6, x + 2 * width / 6, x, x + 2 * width / 6, x + 2 * width / 6 }; + int[] pty2 = { y + height / 16, y + height / 16, y + height / 4, y + 2 * height / 4, y + 3 * height / 4, + y + height / 4, y + 2 * height / 4, y + 3 * height / 4, y + height - height / 16, + y + height - height / 16, y + height - height / 16, y + height / 16 }; g.drawPolygon(ptx2, pty2, 12); - int[] ptx3 = { x + 2 * width / 6 - width / 12 - width / 24, - x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 12, - x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 12, + int[] ptx3 = { x + 2 * width / 6 - width / 12 - width / 24, x + 2 * width / 6 - width / 12, + x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 12, x + 2 * width / 6 - width / 24 }; - int[] pty3 = { y + height / 4, y + height / 4, - y + height / 4 - height / 16, y + height / 4 + height / 16, + int[] pty3 = { y + height / 4, y + height / 4, y + height / 4 - height / 16, y + height / 4 + height / 16, y + height / 4, y + height / 4 }; g.drawPolygon(ptx3, pty3, 6); - int[] ptx4 = { x + 2 * width / 6 - width / 12 - width / 24, - x + 2 * width / 6 - width / 24 }; + int[] ptx4 = { x + 2 * width / 6 - width / 12 - width / 24, x + 2 * width / 6 - width / 24 }; int[] pty4 = { y + height - height / 4, y + height - height / 4 }; g.drawPolygon(ptx4, pty4, 2); - int[] ptx5 = { x + 4 * width / 6 + width / 24, - x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12, + int[] ptx5 = { x + 4 * width / 6 + width / 24, x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12, x + 4 * width / 6 + width / 12 + width / 24 }; - int[] pty5 = { y + height / 4, y + height / 4, - y + height / 4 - height / 16, y + height / 4 + height / 16, + int[] pty5 = { y + height / 4, y + height / 4, y + height / 4 - height / 16, y + height / 4 + height / 16, y + height / 4, y + height / 4 }; g.drawPolygon(ptx5, pty5, 6); - int[] ptx6 = { x + 4 * width / 6 + width / 24, - x + 4 * width / 6 + width / 12 + width / 24 }; + int[] ptx6 = { x + 4 * width / 6 + width / 24, x + 4 * width / 6 + width / 12 + width / 24 }; int[] pty6 = { y + height - height / 4, y + height - height / 4 }; g.drawPolygon(ptx6, pty6, 2); g.drawOval(x, y, width / 12, height / 8); @@ -961,11 +805,9 @@ public class ELNComponentVoltageControlledVoltageSource extends g.setColor(Color.WHITE); g.fillOval(x, y + height - height / 8, width / 12, height / 8); g.setColor(c); - g.drawOval(x + width - width / 12, y + height - height / 8, width / 12, - height / 8); + g.drawOval(x + width - width / 12, y + height - height / 8, width / 12, height / 8); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 12, y + height - height / 8, width / 12, - height / 8); + g.fillOval(x + width - width / 12, y + height - height / 8, width / 12, height / 8); g.setColor(c); } @@ -977,44 +819,30 @@ public class ELNComponentVoltageControlledVoltageSource extends int[] ptx1 = { x + width - width / 16, x + width - width / 16 }; int[] pty1 = { y, y + 2 * height / 6 }; g.drawPolygon(ptx1, pty1, 2); - int[] ptx2 = { x + width / 16, x + width / 16, x + width / 4, - x + 2 * width / 4, x + 3 * width / 4, x + width / 4, - x + 2 * width / 4, x + 3 * width / 4, x + width - width / 16, - x + width - width / 16, x + width - width / 16, x + width / 16 }; - int[] pty2 = { y + height, y + 4 * height / 6, y + 4 * height / 6, - y + 3 * height / 6, y + 4 * height / 6, y + 4 * height / 6, - y + 5 * height / 6, y + 4 * height / 6, y + 4 * height / 6, - y + height, y + 4 * height / 6, y + 4 * height / 6 }; + int[] ptx2 = { x + width / 16, x + width / 16, x + width / 4, x + 2 * width / 4, x + 3 * width / 4, + x + width / 4, x + 2 * width / 4, x + 3 * width / 4, x + width - width / 16, x + width - width / 16, + x + width - width / 16, x + width / 16 }; + int[] pty2 = { y + height, y + 4 * height / 6, y + 4 * height / 6, y + 3 * height / 6, y + 4 * height / 6, + y + 4 * height / 6, y + 5 * height / 6, y + 4 * height / 6, y + 4 * height / 6, y + height, + y + 4 * height / 6, y + 4 * height / 6 }; g.drawPolygon(ptx2, pty2, 12); - int[] ptx3 = { x + width - width / 4, x + width - width / 4, - x + width - width / 4 + width / 16, - x + width - width / 4 - width / 16, x + width - width / 4, - x + width - width / 4 }; - int[] pty3 = { y + 2 * height / 6 - height / 12 - height / 24, - y + 2 * height / 6 - height / 12, - y + 2 * height / 6 - height / 12, - y + 2 * height / 6 - height / 12, - y + 2 * height / 6 - height / 12, + int[] ptx3 = { x + width - width / 4, x + width - width / 4, x + width - width / 4 + width / 16, + x + width - width / 4 - width / 16, x + width - width / 4, x + width - width / 4 }; + int[] pty3 = { y + 2 * height / 6 - height / 12 - height / 24, y + 2 * height / 6 - height / 12, + y + 2 * height / 6 - height / 12, y + 2 * height / 6 - height / 12, y + 2 * height / 6 - height / 12, y + 2 * height / 6 - height / 24 }; g.drawPolygon(ptx3, pty3, 6); int[] ptx4 = { x + width / 4, x + width / 4 }; - int[] pty4 = { y + 2 * height / 6 - height / 12 - height / 24, - y + 2 * height / 6 - height / 24 }; + int[] pty4 = { y + 2 * height / 6 - height / 12 - height / 24, y + 2 * height / 6 - height / 24 }; g.drawPolygon(ptx4, pty4, 2); - int[] ptx5 = { x + width - width / 4, x + width - width / 4, - x + width - width / 4 + width / 16, - x + width - width / 4 - width / 16, x + width - width / 4, - x + width - width / 4 }; - int[] pty5 = { y + 4 * height / 6 + height / 24, - y + 4 * height / 6 + height / 12, - y + 4 * height / 6 + height / 12, - y + 4 * height / 6 + height / 12, - y + 4 * height / 6 + height / 12, + int[] ptx5 = { x + width - width / 4, x + width - width / 4, x + width - width / 4 + width / 16, + x + width - width / 4 - width / 16, x + width - width / 4, x + width - width / 4 }; + int[] pty5 = { y + 4 * height / 6 + height / 24, y + 4 * height / 6 + height / 12, + y + 4 * height / 6 + height / 12, y + 4 * height / 6 + height / 12, y + 4 * height / 6 + height / 12, y + 4 * height / 6 + height / 12 + height / 24 }; g.drawPolygon(ptx5, pty5, 6); int[] ptx6 = { x + width / 4, x + width / 4 }; - int[] pty6 = { y + 4 * height / 6 + height / 24, - y + 4 * height / 6 + height / 12 + height / 24 }; + int[] pty6 = { y + 4 * height / 6 + height / 24, y + 4 * height / 6 + height / 12 + height / 24 }; g.drawPolygon(ptx6, pty6, 2); g.drawOval(x, y, width / 8, height / 12); g.setColor(Color.WHITE); @@ -1028,11 +856,9 @@ public class ELNComponentVoltageControlledVoltageSource extends g.setColor(Color.WHITE); g.fillOval(x, y + height - height / 12, width / 8, height / 12); g.setColor(c); - g.drawOval(x + width - width / 8, y + height - height / 12, width / 8, - height / 12); + g.drawOval(x + width - width / 8, y + height - height / 12, width / 8, height / 12); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 8, y + height - height / 12, width / 8, - height / 12); + g.fillOval(x + width - width / 8, y + height - height / 12, width / 8, height / 12); g.setColor(c); } @@ -1044,44 +870,30 @@ public class ELNComponentVoltageControlledVoltageSource extends int[] ptx1 = { x + width - width / 16, x + width - width / 16 }; int[] pty1 = { y + 4 * height / 6, y + height }; g.drawPolygon(ptx1, pty1, 2); - int[] ptx2 = { x + width / 16, x + width / 16, x + width / 4, - x + 2 * width / 4, x + 3 * width / 4, x + width / 4, - x + 2 * width / 4, x + 3 * width / 4, x + width - width / 16, - x + width - width / 16, x + width - width / 16, x + width / 16 }; - int[] pty2 = { y, y + 2 * height / 6, y + 2 * height / 6, - y + height / 6, y + 2 * height / 6, y + 2 * height / 6, - y + 3 * height / 6, y + 2 * height / 6, y + 2 * height / 6, y, - y + 2 * height / 6, y + 2 * height / 6 }; + int[] ptx2 = { x + width / 16, x + width / 16, x + width / 4, x + 2 * width / 4, x + 3 * width / 4, + x + width / 4, x + 2 * width / 4, x + 3 * width / 4, x + width - width / 16, x + width - width / 16, + x + width - width / 16, x + width / 16 }; + int[] pty2 = { y, y + 2 * height / 6, y + 2 * height / 6, y + height / 6, y + 2 * height / 6, + y + 2 * height / 6, y + 3 * height / 6, y + 2 * height / 6, y + 2 * height / 6, y, y + 2 * height / 6, + y + 2 * height / 6 }; g.drawPolygon(ptx2, pty2, 12); - int[] ptx3 = { x + width - width / 4, x + width - width / 4, - x + width - width / 4 + width / 16, - x + width - width / 4 - width / 16, x + width - width / 4, - x + width - width / 4 }; - int[] pty3 = { y + 2 * height / 6 - height / 12 - height / 24, - y + 2 * height / 6 - height / 12, - y + 2 * height / 6 - height / 12, - y + 2 * height / 6 - height / 12, - y + 2 * height / 6 - height / 12, + int[] ptx3 = { x + width - width / 4, x + width - width / 4, x + width - width / 4 + width / 16, + x + width - width / 4 - width / 16, x + width - width / 4, x + width - width / 4 }; + int[] pty3 = { y + 2 * height / 6 - height / 12 - height / 24, y + 2 * height / 6 - height / 12, + y + 2 * height / 6 - height / 12, y + 2 * height / 6 - height / 12, y + 2 * height / 6 - height / 12, y + 2 * height / 6 - height / 24 }; g.drawPolygon(ptx3, pty3, 6); int[] ptx4 = { x + width / 4, x + width / 4 }; - int[] pty4 = { y + 2 * height / 6 - height / 12 - height / 24, - y + 2 * height / 6 - height / 24 }; + int[] pty4 = { y + 2 * height / 6 - height / 12 - height / 24, y + 2 * height / 6 - height / 24 }; g.drawPolygon(ptx4, pty4, 2); - int[] ptx5 = { x + width - width / 4, x + width - width / 4, - x + width - width / 4 + width / 16, - x + width - width / 4 - width / 16, x + width - width / 4, - x + width - width / 4 }; - int[] pty5 = { y + 4 * height / 6 + height / 24, - y + 4 * height / 6 + height / 12, - y + 4 * height / 6 + height / 12, - y + 4 * height / 6 + height / 12, - y + 4 * height / 6 + height / 12, + int[] ptx5 = { x + width - width / 4, x + width - width / 4, x + width - width / 4 + width / 16, + x + width - width / 4 - width / 16, x + width - width / 4, x + width - width / 4 }; + int[] pty5 = { y + 4 * height / 6 + height / 24, y + 4 * height / 6 + height / 12, + y + 4 * height / 6 + height / 12, y + 4 * height / 6 + height / 12, y + 4 * height / 6 + height / 12, y + 4 * height / 6 + height / 12 + height / 24 }; g.drawPolygon(ptx5, pty5, 6); int[] ptx6 = { x + width / 4, x + width / 4 }; - int[] pty6 = { y + 4 * height / 6 + height / 24, - y + 4 * height / 6 + height / 12 + height / 24 }; + int[] pty6 = { y + 4 * height / 6 + height / 24, y + 4 * height / 6 + height / 12 + height / 24 }; g.drawPolygon(ptx6, pty6, 2); g.drawOval(x, y, width / 8, height / 12); g.setColor(Color.WHITE); @@ -1095,11 +907,9 @@ public class ELNComponentVoltageControlledVoltageSource extends g.setColor(Color.WHITE); g.fillOval(x, y + height - height / 12, width / 8, height / 12); g.setColor(c); - g.drawOval(x + width - width / 8, y + height - height / 12, width / 8, - height / 12); + g.drawOval(x + width - width / 8, y + height - height / 12, width / 8, height / 12); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 8, y + height - height / 12, width / 8, - height / 12); + g.fillOval(x + width - width / 8, y + height - height / 12, width / 8, height / 12); g.setColor(c); } @@ -1111,42 +921,30 @@ public class ELNComponentVoltageControlledVoltageSource extends int[] ptx1 = { x + width - width / 16, x + width - width / 16 }; int[] pty1 = { y + 4 * height / 6, y + height }; g.drawPolygon(ptx1, pty1, 2); - int[] ptx2 = { x + width / 16, x + width / 16, x + width / 4, - x + 2 * width / 4, x + 3 * width / 4, x + width / 4, - x + 2 * width / 4, x + 3 * width / 4, x + width - width / 16, - x + width - width / 16, x + width - width / 16, x + width / 16 }; - int[] pty2 = { y, y + 2 * height / 6, y + 2 * height / 6, - y + height / 6, y + 2 * height / 6, y + 2 * height / 6, - y + 3 * height / 6, y + 2 * height / 6, y + 2 * height / 6, y, - y + 2 * height / 6, y + 2 * height / 6 }; + int[] ptx2 = { x + width / 16, x + width / 16, x + width / 4, x + 2 * width / 4, x + 3 * width / 4, + x + width / 4, x + 2 * width / 4, x + 3 * width / 4, x + width - width / 16, x + width - width / 16, + x + width - width / 16, x + width / 16 }; + int[] pty2 = { y, y + 2 * height / 6, y + 2 * height / 6, y + height / 6, y + 2 * height / 6, + y + 2 * height / 6, y + 3 * height / 6, y + 2 * height / 6, y + 2 * height / 6, y, y + 2 * height / 6, + y + 2 * height / 6 }; g.drawPolygon(ptx2, pty2, 12); - int[] ptx3 = { x + width / 4, x + width / 4, - x + width / 4 - width / 16, x + width / 4 + width / 16, + int[] ptx3 = { x + width / 4, x + width / 4, x + width / 4 - width / 16, x + width / 4 + width / 16, x + width / 4, x + width / 4 }; - int[] pty3 = { y + 2 * height / 6 - height / 12 - height / 24, - y + 2 * height / 6 - height / 12, - y + 2 * height / 6 - height / 12, - y + 2 * height / 6 - height / 12, - y + 2 * height / 6 - height / 12, + int[] pty3 = { y + 2 * height / 6 - height / 12 - height / 24, y + 2 * height / 6 - height / 12, + y + 2 * height / 6 - height / 12, y + 2 * height / 6 - height / 12, y + 2 * height / 6 - height / 12, y + 2 * height / 6 - height / 24 }; g.drawPolygon(ptx3, pty3, 6); int[] ptx4 = { x + width - width / 4, x + width - width / 4 }; - int[] pty4 = { y + 2 * height / 6 - height / 12 - height / 24, - y + 2 * height / 6 - height / 24 }; + int[] pty4 = { y + 2 * height / 6 - height / 12 - height / 24, y + 2 * height / 6 - height / 24 }; g.drawPolygon(ptx4, pty4, 2); - int[] ptx5 = { x + width / 4, x + width / 4, - x + width / 4 - width / 16, x + width / 4 + width / 16, + int[] ptx5 = { x + width / 4, x + width / 4, x + width / 4 - width / 16, x + width / 4 + width / 16, x + width / 4, x + width / 4 }; - int[] pty5 = { y + 4 * height / 6 + height / 24, - y + 4 * height / 6 + height / 12, - y + 4 * height / 6 + height / 12, - y + 4 * height / 6 + height / 12, - y + 4 * height / 6 + height / 12, + int[] pty5 = { y + 4 * height / 6 + height / 24, y + 4 * height / 6 + height / 12, + y + 4 * height / 6 + height / 12, y + 4 * height / 6 + height / 12, y + 4 * height / 6 + height / 12, y + 4 * height / 6 + height / 12 + height / 24 }; g.drawPolygon(ptx5, pty5, 6); int[] ptx6 = { x + width - width / 4, x + width - width / 4 }; - int[] pty6 = { y + 4 * height / 6 + height / 24, - y + 4 * height / 6 + height / 12 + height / 24 }; + int[] pty6 = { y + 4 * height / 6 + height / 24, y + 4 * height / 6 + height / 12 + height / 24 }; g.drawPolygon(ptx6, pty6, 2); g.drawOval(x, y, width / 8, height / 12); g.setColor(Color.WHITE); @@ -1160,11 +958,9 @@ public class ELNComponentVoltageControlledVoltageSource extends g.setColor(Color.WHITE); g.fillOval(x, y + height - height / 12, width / 8, height / 12); g.setColor(c); - g.drawOval(x + width - width / 8, y + height - height / 12, width / 8, - height / 12); + g.drawOval(x + width - width / 8, y + height - height / 12, width / 8, height / 12); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 8, y + height - height / 12, width / 8, - height / 12); + g.fillOval(x + width - width / 8, y + height - height / 12, width / 8, height / 12); g.setColor(c); } @@ -1176,42 +972,30 @@ public class ELNComponentVoltageControlledVoltageSource extends int[] ptx1 = { x + width - width / 16, x + width - width / 16 }; int[] pty1 = { y, y + 2 * height / 6 }; g.drawPolygon(ptx1, pty1, 2); - int[] ptx2 = { x + width / 16, x + width / 16, x + width / 4, - x + 2 * width / 4, x + 3 * width / 4, x + width / 4, - x + 2 * width / 4, x + 3 * width / 4, x + width - width / 16, - x + width - width / 16, x + width - width / 16, x + width / 16 }; - int[] pty2 = { y + height, y + 4 * height / 6, y + 4 * height / 6, - y + 3 * height / 6, y + 4 * height / 6, y + 4 * height / 6, - y + 5 * height / 6, y + 4 * height / 6, y + 4 * height / 6, - y + height, y + 4 * height / 6, y + 4 * height / 6 }; + int[] ptx2 = { x + width / 16, x + width / 16, x + width / 4, x + 2 * width / 4, x + 3 * width / 4, + x + width / 4, x + 2 * width / 4, x + 3 * width / 4, x + width - width / 16, x + width - width / 16, + x + width - width / 16, x + width / 16 }; + int[] pty2 = { y + height, y + 4 * height / 6, y + 4 * height / 6, y + 3 * height / 6, y + 4 * height / 6, + y + 4 * height / 6, y + 5 * height / 6, y + 4 * height / 6, y + 4 * height / 6, y + height, + y + 4 * height / 6, y + 4 * height / 6 }; g.drawPolygon(ptx2, pty2, 12); - int[] ptx3 = { x + width / 4, x + width / 4, - x + width / 4 - width / 16, x + width / 4 + width / 16, + int[] ptx3 = { x + width / 4, x + width / 4, x + width / 4 - width / 16, x + width / 4 + width / 16, x + width / 4, x + width / 4 }; - int[] pty3 = { y + 2 * height / 6 - height / 12 - height / 24, - y + 2 * height / 6 - height / 12, - y + 2 * height / 6 - height / 12, - y + 2 * height / 6 - height / 12, - y + 2 * height / 6 - height / 12, + int[] pty3 = { y + 2 * height / 6 - height / 12 - height / 24, y + 2 * height / 6 - height / 12, + y + 2 * height / 6 - height / 12, y + 2 * height / 6 - height / 12, y + 2 * height / 6 - height / 12, y + 2 * height / 6 - height / 24 }; g.drawPolygon(ptx3, pty3, 6); int[] ptx4 = { x + width - width / 4, x + width - width / 4 }; - int[] pty4 = { y + 2 * height / 6 - height / 12 - height / 24, - y + 2 * height / 6 - height / 24 }; + int[] pty4 = { y + 2 * height / 6 - height / 12 - height / 24, y + 2 * height / 6 - height / 24 }; g.drawPolygon(ptx4, pty4, 2); - int[] ptx5 = { x + width / 4, x + width / 4, - x + width / 4 - width / 16, x + width / 4 + width / 16, + int[] ptx5 = { x + width / 4, x + width / 4, x + width / 4 - width / 16, x + width / 4 + width / 16, x + width / 4, x + width / 4 }; - int[] pty5 = { y + 4 * height / 6 + height / 24, - y + 4 * height / 6 + height / 12, - y + 4 * height / 6 + height / 12, - y + 4 * height / 6 + height / 12, - y + 4 * height / 6 + height / 12, + int[] pty5 = { y + 4 * height / 6 + height / 24, y + 4 * height / 6 + height / 12, + y + 4 * height / 6 + height / 12, y + 4 * height / 6 + height / 12, y + 4 * height / 6 + height / 12, y + 4 * height / 6 + height / 12 + height / 24 }; g.drawPolygon(ptx5, pty5, 6); int[] ptx6 = { x + width - width / 4, x + width - width / 4 }; - int[] pty6 = { y + 4 * height / 6 + height / 24, - y + 4 * height / 6 + height / 12 + height / 24 }; + int[] pty6 = { y + 4 * height / 6 + height / 24, y + 4 * height / 6 + height / 12 + height / 24 }; g.drawPolygon(ptx6, pty6, 2); g.drawOval(x, y, width / 8, height / 12); g.setColor(Color.WHITE); @@ -1225,11 +1009,9 @@ public class ELNComponentVoltageControlledVoltageSource extends g.setColor(Color.WHITE); g.fillOval(x, y + height - height / 12, width / 8, height / 12); g.setColor(c); - g.drawOval(x + width - width / 8, y + height - height / 12, width / 8, - height / 12); + g.drawOval(x + width - width / 8, y + height - height / 12, width / 8, height / 12); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 8, y + height - height / 12, width / 8, - height / 12); + g.fillOval(x + width - width / 8, y + height - height / 12, width / 8, height / 12); g.setColor(c); } @@ -1265,8 +1047,7 @@ public class ELNComponentVoltageControlledVoltageSource extends return new String(sb); } - public void loadExtraParam(NodeList nl, int decX, int decY, int decId) - throws MalformedModelingException { + public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException { try { NodeList nli; Node n1, n2; @@ -1285,20 +1066,13 @@ public class ELNComponentVoltageControlledVoltageSource extends if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; if (elt.getTagName().equals("attributes")) { - value = Double.parseDouble(elt - .getAttribute("value")); - position = Integer.parseInt(elt - .getAttribute("position")); - fv_0_2 = Boolean.parseBoolean(elt - .getAttribute("fv_0_2")); - fv_1_3 = Boolean.parseBoolean(elt - .getAttribute("fv_1_3")); - fh_0_2 = Boolean.parseBoolean(elt - .getAttribute("fh_0_2")); - fh_1_3 = Boolean.parseBoolean(elt - .getAttribute("fh_1_3")); - first = Boolean.parseBoolean(elt - .getAttribute("first")); + value = Double.parseDouble(elt.getAttribute("value")); + position = Integer.parseInt(elt.getAttribute("position")); + fv_0_2 = Boolean.parseBoolean(elt.getAttribute("fv_0_2")); + fv_1_3 = Boolean.parseBoolean(elt.getAttribute("fv_1_3")); + fh_0_2 = Boolean.parseBoolean(elt.getAttribute("fh_0_2")); + fh_1_3 = Boolean.parseBoolean(elt.getAttribute("fh_1_3")); + first = Boolean.parseBoolean(elt.getAttribute("first")); setVal(value); setPosition(position); setFv_0_2(fv_0_2); @@ -1316,8 +1090,7 @@ public class ELNComponentVoltageControlledVoltageSource extends } } - public void addActionToPopupMenu(JPopupMenu componentMenu, - ActionListener menuAL, int x, int y) { + public void addActionToPopupMenu(JPopupMenu componentMenu, ActionListener menuAL, int x, int y) { componentMenu.addSeparator(); JMenuItem rotateright = new JMenuItem("Rotate right 90\u00b0"); @@ -1448,8 +1221,7 @@ public class ELNComponentVoltageControlledVoltageSource extends if ((father != null) && (father instanceof ELNModule)) { resizeToFatherSize(); - setCdRectangle(0, father.getWidth() - getWidth(), 0, - father.getHeight() - getHeight()); + setCdRectangle(0, father.getWidth() - getWidth(), 0, father.getHeight() - getHeight()); setMoveCd(x, y); } } @@ -1462,7 +1234,6 @@ public class ELNComponentVoltageControlledVoltageSource extends myColor = null; setFather(null); TDiagramPanel tdp = getTDiagramPanel(); - setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), - tdp.getMaxY()); + setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY()); } } \ No newline at end of file diff --git a/src/main/java/ui/eln/sca_eln_sca_tdf/ELNComponentCurrentSinkTDF.java b/src/main/java/ui/eln/sca_eln_sca_tdf/ELNComponentCurrentSinkTDF.java index 605f7acf1d..2d8694d2de 100644 --- a/src/main/java/ui/eln/sca_eln_sca_tdf/ELNComponentCurrentSinkTDF.java +++ b/src/main/java/ui/eln/sca_eln_sca_tdf/ELNComponentCurrentSinkTDF.java @@ -59,8 +59,7 @@ import java.awt.geom.RoundRectangle2D; * @author Irina Kit Yan LEE */ -public class ELNComponentCurrentSinkTDF extends TGCScalableWithInternalComponent - implements ActionListener, SwallowedTGComponent, ELNComponent { +public class ELNComponentCurrentSinkTDF extends TGCScalableWithInternalComponent implements ActionListener, SwallowedTGComponent, ELNComponent { protected Color myColor; protected int orientation; private int maxFontSize = 14; @@ -78,8 +77,7 @@ public class ELNComponentCurrentSinkTDF extends TGCScalableWithInternalComponent private int old; private boolean first; - public ELNComponentCurrentSinkTDF(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, - TGComponent _father, TDiagramPanel _tdp) { + public ELNComponentCurrentSinkTDF(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); initScaling(100, 100); diff --git a/src/main/java/ui/eln/sca_eln_sca_tdf/ELNComponentVoltageSinkTDF.java b/src/main/java/ui/eln/sca_eln_sca_tdf/ELNComponentVoltageSinkTDF.java index 131c38c569..701abb53ac 100644 --- a/src/main/java/ui/eln/sca_eln_sca_tdf/ELNComponentVoltageSinkTDF.java +++ b/src/main/java/ui/eln/sca_eln_sca_tdf/ELNComponentVoltageSinkTDF.java @@ -53,16 +53,14 @@ import java.awt.event.ActionListener; import java.awt.geom.RoundRectangle2D; /** - * Class ELNComponentVoltageSinkTDF Converts voltage to a TDF output signal to - * be used in ELN diagrams Creation: 17/07/2018 - * + * Class ELNComponentVoltageSinkTDF + * Converts voltage to a TDF output signal to be used in ELN diagrams + * Creation: 17/07/2018 * @version 1.0 17/07/2018 * @author Irina Kit Yan LEE */ -public class ELNComponentVoltageSinkTDF extends - TGCScalableWithInternalComponent implements ActionListener, - SwallowedTGComponent, ELNComponent { +public class ELNComponentVoltageSinkTDF extends TGCScalableWithInternalComponent implements ActionListener, SwallowedTGComponent, ELNComponent { protected Color myColor; protected int orientation; private int maxFontSize = 14; @@ -76,14 +74,11 @@ public class ELNComponentVoltageSinkTDF extends private double scale; private int position = 0; - private boolean fv_0_2 = false, fv_1_3 = false, fh_0_2 = false, - fh_1_3 = false; + private boolean fv_0_2 = false, fv_1_3 = false, fh_0_2 = false, fh_1_3 = false; private int old; private boolean first; - public ELNComponentVoltageSinkTDF(int _x, int _y, int _minX, int _maxX, - int _minY, int _maxY, boolean _pos, TGComponent _father, - TDiagramPanel _tdp) { + public ELNComponentVoltageSinkTDF(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); initScaling(100, 100); @@ -115,12 +110,9 @@ public class ELNComponentVoltageSinkTDF extends public void initPortTerminal(int nb) { nbConnectingPoint = nb; connectingPoint = new TGConnectingPoint[nb]; - connectingPoint[0] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "p"); - connectingPoint[1] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "n"); - connectingPoint[2] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, - 0.0, "outp"); + connectingPoint[0] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "p"); + connectingPoint[1] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "n"); + connectingPoint[2] = new ELNPortTerminal(this, 0, 0, true, true, 0.0, 0.0, "outp"); } public Color getMyColor() { @@ -134,10 +126,7 @@ public class ELNComponentVoltageSinkTDF extends if (this.rescaled && !this.tdp.isScaled()) { this.rescaled = false; - int maxCurrentFontSize = Math.max( - 0, - Math.min(this.height, - (int) (this.maxFontSize * this.tdp.getZoom()))); + int maxCurrentFontSize = Math.max(0, Math.min(this.height, (int) (this.maxFontSize * this.tdp.getZoom()))); f = f.deriveFont((float) maxCurrentFontSize); while (maxCurrentFontSize > (this.minFontSize * this.tdp.getZoom() - 1)) { @@ -196,15 +185,11 @@ public class ELNComponentVoltageSinkTDF extends ((ELNPortTerminal) connectingPoint[2]).setW(1.0); ((ELNPortTerminal) connectingPoint[2]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y - height / 20); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + height + height / 20 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width, y + height / 2 + height / 5 + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, y - height / 20); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + height + height / 20 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width, + y + height / 2 + height / 5 + sh2); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -219,15 +204,11 @@ public class ELNComponentVoltageSinkTDF extends ((ELNPortTerminal) connectingPoint[2]).setW(0.0); ((ELNPortTerminal) connectingPoint[2]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y - height / 20); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height + height / 20 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - sw2, y + height / 2 + height / 5 + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, y - height / 20); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height + height / 20 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - sw2, + y + height / 2 + height / 5 + sh2); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -242,15 +223,11 @@ public class ELNComponentVoltageSinkTDF extends ((ELNPortTerminal) connectingPoint[2]).setW(1.0); ((ELNPortTerminal) connectingPoint[2]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y - height / 20); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + height + height / 20 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width, y + height / 2 + height / 5 + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, y - height / 20); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + height + height / 20 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width, + y + height / 2 + height / 5 + sh2); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -265,15 +242,11 @@ public class ELNComponentVoltageSinkTDF extends ((ELNPortTerminal) connectingPoint[2]).setW(0.0); ((ELNPortTerminal) connectingPoint[2]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y - height / 20); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height + height / 20 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - sw2, y + height / 2 + height / 5 + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, y - height / 20); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height + height / 20 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - sw2, + y + height / 2 + height / 5 + sh2); } } } else if (position == 1) { @@ -311,15 +284,10 @@ public class ELNComponentVoltageSinkTDF extends ((ELNPortTerminal) connectingPoint[2]).setW(0.5); ((ELNPortTerminal) connectingPoint[2]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - width / 20 - sw1, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width + width / 20, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width / 2 + width / 5, y + height + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - width / 20 - sw1, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width + width / 20, y); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width / 2 + width / 5, + y + height + sh2); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -334,15 +302,11 @@ public class ELNComponentVoltageSinkTDF extends ((ELNPortTerminal) connectingPoint[2]).setW(0.5); ((ELNPortTerminal) connectingPoint[2]).setH(0.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - width / 16 - sw1, y + height + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width + width / 16, y + height + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width / 2 + width / 5, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - width / 16 - sw1, + y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width + width / 16, + y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width / 2 + width / 5, y); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -357,15 +321,10 @@ public class ELNComponentVoltageSinkTDF extends ((ELNPortTerminal) connectingPoint[2]).setW(0.5); ((ELNPortTerminal) connectingPoint[2]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - width / 20 - sw0, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width + width / 20, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width / 2 + width / 5, y + height + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - width / 20 - sw0, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width + width / 20, y); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width / 2 + width / 5, + y + height + sh2); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -380,15 +339,11 @@ public class ELNComponentVoltageSinkTDF extends ((ELNPortTerminal) connectingPoint[2]).setW(0.5); ((ELNPortTerminal) connectingPoint[2]).setH(0.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - width / 20 - sw0, y + height + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width + width / 20, y + height + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width / 2 + width / 5, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - width / 20 - sw0, + y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width + width / 20, + y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width / 2 + width / 5, y); } } } else if (position == 2) { @@ -427,15 +382,11 @@ public class ELNComponentVoltageSinkTDF extends ((ELNPortTerminal) connectingPoint[2]).setW(0.0); ((ELNPortTerminal) connectingPoint[2]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y - height / 20); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y + height + height / 20 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - sw2, y + height / 2 + height / 5 + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, y - height / 20); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, + y + height + height / 20 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - sw2, + y + height / 2 + height / 5 + sh2); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -450,15 +401,11 @@ public class ELNComponentVoltageSinkTDF extends ((ELNPortTerminal) connectingPoint[2]).setW(1.0); ((ELNPortTerminal) connectingPoint[2]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y - height / 20); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y + height + height / 20 + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width, y + height / 2 + height / 5 + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, y - height / 20); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, + y + height + height / 20 + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width, + y + height / 2 + height / 5 + sh2); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -473,15 +420,11 @@ public class ELNComponentVoltageSinkTDF extends ((ELNPortTerminal) connectingPoint[2]).setW(0.0); ((ELNPortTerminal) connectingPoint[2]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width, y - height / 20); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width, y + height + height / 20 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - - sw2, y + height / 2 + height / 5 + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width, y - height / 20); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width, + y + height + height / 20 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x - sw2, + y + height / 2 + height / 5 + sh2); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -496,15 +439,11 @@ public class ELNComponentVoltageSinkTDF extends ((ELNPortTerminal) connectingPoint[2]).setW(1.0); ((ELNPortTerminal) connectingPoint[2]).setH(0.5); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - sw0, y - height / 20); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - sw1, y + height + height / 20 + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width, y + height / 2 + height / 5 + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - sw0, y - height / 20); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - sw1, + y + height + height / 20 + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width, + y + height / 2 + height / 5 + sh2); } } } else if (position == 3) { @@ -542,15 +481,11 @@ public class ELNComponentVoltageSinkTDF extends ((ELNPortTerminal) connectingPoint[2]).setW(0.5); ((ELNPortTerminal) connectingPoint[2]).setH(0.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - width / 20 - sw0, y + height + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width + width / 20, y + height + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width / 2 + width / 5, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - width / 20 - sw0, + y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width + width / 20, + y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width / 2 + width / 5, y); } } if ((fv_0_2 == false && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -565,15 +500,10 @@ public class ELNComponentVoltageSinkTDF extends ((ELNPortTerminal) connectingPoint[2]).setW(0.5); ((ELNPortTerminal) connectingPoint[2]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - - width / 20 - sw0, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - + width + width / 20, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width / 2 + width / 5, y + height + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x - width / 20 - sw0, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x + width + width / 20, y); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width / 2 + width / 5, + y + height + sh2); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == false && fh_1_3 == false) @@ -588,15 +518,11 @@ public class ELNComponentVoltageSinkTDF extends ((ELNPortTerminal) connectingPoint[2]).setW(0.5); ((ELNPortTerminal) connectingPoint[2]).setH(0.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - width / 16 - sw1, y + height + sh1); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width + width / 16, y + height + sh0); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width / 2 + width / 5, y); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - width / 16 - sw1, + y + height + sh1); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width + width / 16, + y + height + sh0); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width / 2 + width / 5, y); } } if ((fv_0_2 == true && fv_1_3 == false && fh_0_2 == true && fh_1_3 == false) @@ -611,15 +537,10 @@ public class ELNComponentVoltageSinkTDF extends ((ELNPortTerminal) connectingPoint[2]).setW(0.5); ((ELNPortTerminal) connectingPoint[2]).setH(1.0); if (mgui.getHidden() == false) { - g.drawString( - ((ELNPortTerminal) connectingPoint[1]).getName(), x - - width / 20 - sw1, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[0]).getName(), x - + width + width / 20, y); - g.drawString( - ((ELNPortTerminal) connectingPoint[2]).getName(), x - + width / 2 + width / 5, y + height + sh2); + g.drawString(((ELNPortTerminal) connectingPoint[1]).getName(), x - width / 20 - sw1, y); + g.drawString(((ELNPortTerminal) connectingPoint[0]).getName(), x + width + width / 20, y); + g.drawString(((ELNPortTerminal) connectingPoint[2]).getName(), x + width / 2 + width / 5, + y + height + sh2); } } } @@ -635,34 +556,27 @@ public class ELNComponentVoltageSinkTDF extends int[] ptx1 = { x, x + 2 * width / 5 - width / 10 }; int[] pty1 = { y + height - height / 20, y + height - height / 20 }; g.drawPolygon(ptx1, pty1, 2); - int[] ptx3 = { x + width / 5 - width / 20, x + width / 5, - x + width / 5, x + width / 5, x + width / 5, + int[] ptx3 = { x + width / 5 - width / 20, x + width / 5, x + width / 5, x + width / 5, x + width / 5, x + width / 5 + width / 20 }; - int[] pty3 = { y + height / 10 + height / 20, - y + height / 10 + height / 20, y + height / 10, y + height / 5, + int[] pty3 = { y + height / 10 + height / 20, y + height / 10 + height / 20, y + height / 10, y + height / 5, y + height / 10 + height / 20, y + height / 10 + height / 20 }; g.drawPolygon(ptx3, pty3, 6); int[] ptx4 = { x + width / 5 - width / 20, x + width / 5 + width / 20 }; - int[] pty4 = { y + height - height / 10 - height / 20, - y + height - height / 10 - height / 20 }; + int[] pty4 = { y + height - height / 10 - height / 20, y + height - height / 10 - height / 20 }; g.drawPolygon(ptx4, pty4, 2); - int[] ptx5 = { x + 2 * width / 5, x + 2 * width / 5, - x + 2 * width / 5 - width / 20, x + 2 * width / 5 + width / 20, - x + 2 * width / 5 }; - int[] pty5 = { y + height / 20, y + height - height / 20, - y + height - height / 10, y + height - height / 10, + int[] ptx5 = { x + 2 * width / 5, x + 2 * width / 5, x + 2 * width / 5 - width / 20, + x + 2 * width / 5 + width / 20, x + 2 * width / 5 }; + int[] pty5 = { y + height / 20, y + height - height / 20, y + height - height / 10, y + height - height / 10, y + height - height / 20 }; g.drawPolygon(ptx5, pty5, 5); g.fillPolygon(ptx5, pty5, 5); g.fillRect(x + 4 * width / 5, y + 2 * height / 5, width / 5, height / 5); Graphics2D g2d = (Graphics2D) g.create(); - Stroke dashed = new BasicStroke(1, BasicStroke.CAP_BUTT, - BasicStroke.JOIN_BEVEL, 0, new float[] { 9 }, 0); + Stroke dashed = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[] { 9 }, 0); g2d.setStroke(dashed); - g2d.draw(new RoundRectangle2D.Double(x + width / 20, y - height / 20, 4 - * width / 5 + width / 10 - width / 20, height + height / 10, - 10, 10)); + g2d.draw(new RoundRectangle2D.Double(x + width / 20, y - height / 20, 4 * width / 5 + width / 10 - width / 20, + height + height / 10, 10, 10)); g2d.dispose(); g.drawOval(x, y, width / 10, height / 10); @@ -683,35 +597,27 @@ public class ELNComponentVoltageSinkTDF extends int[] ptx1 = { x, x + 2 * width / 5 - width / 10 }; int[] pty1 = { y + height - height / 20, y + height - height / 20 }; g.drawPolygon(ptx1, pty1, 2); - int[] ptx3 = { x + width / 5 - width / 20, x + width / 5, - x + width / 5, x + width / 5, x + width / 5, + int[] ptx3 = { x + width / 5 - width / 20, x + width / 5, x + width / 5, x + width / 5, x + width / 5, x + width / 5 + width / 20 }; - int[] pty3 = { y + height - height / 10 - height / 20, - y + height - height / 10 - height / 20, - y + height - 2 * height / 10, y + height - height / 10, - y + height - height / 10 - height / 20, + int[] pty3 = { y + height - height / 10 - height / 20, y + height - height / 10 - height / 20, + y + height - 2 * height / 10, y + height - height / 10, y + height - height / 10 - height / 20, y + height - height / 10 - height / 20 }; g.drawPolygon(ptx3, pty3, 6); int[] ptx4 = { x + width / 5 - width / 20, x + width / 5 + width / 20 }; - int[] pty4 = { y + height / 10 + height / 20, - y + height / 10 + height / 20 }; + int[] pty4 = { y + height / 10 + height / 20, y + height / 10 + height / 20 }; g.drawPolygon(ptx4, pty4, 2); - int[] ptx5 = { x + 2 * width / 5, x + 2 * width / 5, - x + 2 * width / 5 - width / 20, x + 2 * width / 5 + width / 20, - x + 2 * width / 5 }; - int[] pty5 = { y + height - height / 20, y + height / 20, - y + height / 10, y + height / 10, y + height / 20 }; + int[] ptx5 = { x + 2 * width / 5, x + 2 * width / 5, x + 2 * width / 5 - width / 20, + x + 2 * width / 5 + width / 20, x + 2 * width / 5 }; + int[] pty5 = { y + height - height / 20, y + height / 20, y + height / 10, y + height / 10, y + height / 20 }; g.drawPolygon(ptx5, pty5, 5); g.fillPolygon(ptx5, pty5, 5); g.fillRect(x + 4 * width / 5, y + 2 * height / 5, width / 5, height / 5); Graphics2D g2d = (Graphics2D) g.create(); - Stroke dashed = new BasicStroke(1, BasicStroke.CAP_BUTT, - BasicStroke.JOIN_BEVEL, 0, new float[] { 9 }, 0); + Stroke dashed = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[] { 9 }, 0); g2d.setStroke(dashed); - g2d.draw(new RoundRectangle2D.Double(x + width / 20, y - height / 20, 4 - * width / 5 + width / 10 - width / 20, height + height / 10, - 10, 10)); + g2d.draw(new RoundRectangle2D.Double(x + width / 20, y - height / 20, 4 * width / 5 + width / 10 - width / 20, + height + height / 10, 10, 10)); g2d.dispose(); g.drawOval(x, y, width / 10, height / 10); @@ -732,47 +638,36 @@ public class ELNComponentVoltageSinkTDF extends int[] ptx1 = { x + height, x + 3 * width / 5 + width / 10 }; int[] pty1 = { y + height - height / 20, y + height - height / 20 }; g.drawPolygon(ptx1, pty1, 2); - int[] ptx3 = { x + 4 * width / 5 - width / 20, x + 4 * width / 5, - x + 4 * width / 5, x + 4 * width / 5, x + 4 * width / 5, - x + 4 * width / 5 + width / 20 }; - int[] pty3 = { y + height - height / 10 - height / 20, - y + height - height / 10 - height / 20, - y + height - 2 * height / 10, y + height - height / 10, - y + height - height / 10 - height / 20, + int[] ptx3 = { x + 4 * width / 5 - width / 20, x + 4 * width / 5, x + 4 * width / 5, x + 4 * width / 5, + x + 4 * width / 5, x + 4 * width / 5 + width / 20 }; + int[] pty3 = { y + height - height / 10 - height / 20, y + height - height / 10 - height / 20, + y + height - 2 * height / 10, y + height - height / 10, y + height - height / 10 - height / 20, y + height - height / 10 - height / 20 }; g.drawPolygon(ptx3, pty3, 6); - int[] ptx4 = { x + 4 * width / 5 - width / 20, - x + 4 * width / 5 + width / 20 }; - int[] pty4 = { y + height / 10 + height / 20, - y + height / 10 + height / 20 }; + int[] ptx4 = { x + 4 * width / 5 - width / 20, x + 4 * width / 5 + width / 20 }; + int[] pty4 = { y + height / 10 + height / 20, y + height / 10 + height / 20 }; g.drawPolygon(ptx4, pty4, 2); - int[] ptx5 = { x + 3 * width / 5, x + 3 * width / 5, - x + 3 * width / 5 + width / 20, x + 3 * width / 5 - width / 20, - x + 3 * width / 5 }; - int[] pty5 = { y + height - height / 20, y + height / 20, - y + height / 10, y + height / 10, y + height / 20 }; + int[] ptx5 = { x + 3 * width / 5, x + 3 * width / 5, x + 3 * width / 5 + width / 20, + x + 3 * width / 5 - width / 20, x + 3 * width / 5 }; + int[] pty5 = { y + height - height / 20, y + height / 20, y + height / 10, y + height / 10, y + height / 20 }; g.drawPolygon(ptx5, pty5, 5); g.fillPolygon(ptx5, pty5, 5); g.fillRect(x, y + 2 * height / 5, width / 5, height / 5); Graphics2D g2d = (Graphics2D) g.create(); - Stroke dashed = new BasicStroke(1, BasicStroke.CAP_BUTT, - BasicStroke.JOIN_BEVEL, 0, new float[] { 9 }, 0); + Stroke dashed = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[] { 9 }, 0); g2d.setStroke(dashed); - g2d.draw(new RoundRectangle2D.Double(x + width / 10, y - height / 20, 4 - * width / 5 + width / 10 - width / 20, height + height / 10, - 10, 10)); + g2d.draw(new RoundRectangle2D.Double(x + width / 10, y - height / 20, 4 * width / 5 + width / 10 - width / 20, + height + height / 10, 10, 10)); g2d.dispose(); g.drawOval(x + width - width / 10, y, width / 10, height / 10); g.setColor(Color.WHITE); g.fillOval(x + width - width / 10, y, width / 10, height / 10); g.setColor(c); - g.drawOval(x + width - width / 10, y + height - height / 10, - width / 10, height / 10); + g.drawOval(x + width - width / 10, y + height - height / 10, width / 10, height / 10); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 10, y + height - height / 10, - width / 10, height / 10); + g.fillOval(x + width - width / 10, y + height - height / 10, width / 10, height / 10); g.setColor(c); } @@ -784,46 +679,36 @@ public class ELNComponentVoltageSinkTDF extends int[] ptx1 = { x + height, x + 3 * width / 5 + width / 10 }; int[] pty1 = { y + height - height / 20, y + height - height / 20 }; g.drawPolygon(ptx1, pty1, 2); - int[] ptx3 = { x + 4 * width / 5 - width / 20, x + 4 * width / 5, - x + 4 * width / 5, x + 4 * width / 5, x + 4 * width / 5, - x + 4 * width / 5 + width / 20 }; - int[] pty3 = { y + height / 10 + height / 20, - y + height / 10 + height / 20, y + height / 10, y + height / 5, + int[] ptx3 = { x + 4 * width / 5 - width / 20, x + 4 * width / 5, x + 4 * width / 5, x + 4 * width / 5, + x + 4 * width / 5, x + 4 * width / 5 + width / 20 }; + int[] pty3 = { y + height / 10 + height / 20, y + height / 10 + height / 20, y + height / 10, y + height / 5, y + height / 10 + height / 20, y + height / 10 + height / 20 }; g.drawPolygon(ptx3, pty3, 6); - int[] ptx4 = { x + 4 * width / 5 - width / 20, - x + 4 * width / 5 + width / 20 }; - int[] pty4 = { y + height - height / 10 - height / 20, - y + height - height / 10 - height / 20 }; + int[] ptx4 = { x + 4 * width / 5 - width / 20, x + 4 * width / 5 + width / 20 }; + int[] pty4 = { y + height - height / 10 - height / 20, y + height - height / 10 - height / 20 }; g.drawPolygon(ptx4, pty4, 2); - int[] ptx5 = { x + 3 * width / 5, x + 3 * width / 5, - x + 3 * width / 5 + width / 20, x + 3 * width / 5 - width / 20, - x + 3 * width / 5 }; - int[] pty5 = { y + height / 20, y + height - height / 20, - y + height - height / 10, y + height - height / 10, + int[] ptx5 = { x + 3 * width / 5, x + 3 * width / 5, x + 3 * width / 5 + width / 20, + x + 3 * width / 5 - width / 20, x + 3 * width / 5 }; + int[] pty5 = { y + height / 20, y + height - height / 20, y + height - height / 10, y + height - height / 10, y + height - height / 20 }; g.drawPolygon(ptx5, pty5, 5); g.fillPolygon(ptx5, pty5, 5); g.fillRect(x, y + 2 * height / 5, width / 5, height / 5); Graphics2D g2d = (Graphics2D) g.create(); - Stroke dashed = new BasicStroke(1, BasicStroke.CAP_BUTT, - BasicStroke.JOIN_BEVEL, 0, new float[] { 9 }, 0); + Stroke dashed = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[] { 9 }, 0); g2d.setStroke(dashed); - g2d.draw(new RoundRectangle2D.Double(x + width / 10, y - height / 20, 4 - * width / 5 + width / 10 - width / 20, height + height / 10, - 10, 10)); + g2d.draw(new RoundRectangle2D.Double(x + width / 10, y - height / 20, 4 * width / 5 + width / 10 - width / 20, + height + height / 10, 10, 10)); g2d.dispose(); g.drawOval(x + width - width / 10, y, width / 10, height / 10); g.setColor(Color.WHITE); g.fillOval(x + width - width / 10, y, width / 10, height / 10); g.setColor(c); - g.drawOval(x + width - width / 10, y + height - height / 10, - width / 10, height / 10); + g.drawOval(x + width - width / 10, y + height - height / 10, width / 10, height / 10); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 10, y + height - height / 10, - width / 10, height / 10); + g.fillOval(x + width - width / 10, y + height - height / 10, width / 10, height / 10); g.setColor(c); } @@ -835,35 +720,27 @@ public class ELNComponentVoltageSinkTDF extends int[] ptx1 = { x + width - width / 20, x + width - width / 20 }; int[] pty1 = { y, y + 2 * height / 5 - height / 10 }; g.drawPolygon(ptx1, pty1, 2); - int[] ptx3 = { x + width - width / 10 - width / 20, - x + width - width / 10 - width / 20, - x + width - width / 10 - width / 10, x + width - width / 10, - x + width - width / 10 - width / 20, + int[] ptx3 = { x + width - width / 10 - width / 20, x + width - width / 10 - width / 20, + x + width - width / 10 - width / 10, x + width - width / 10, x + width - width / 10 - width / 20, x + width - width / 10 - width / 20 }; - int[] pty3 = { y + height / 5 - height / 20, y + height / 5, - y + height / 5, y + height / 5, y + height / 5, + int[] pty3 = { y + height / 5 - height / 20, y + height / 5, y + height / 5, y + height / 5, y + height / 5, y + height / 5 + height / 20 }; g.drawPolygon(ptx3, pty3, 6); int[] ptx4 = { x + width / 10 + width / 20, x + width / 10 + width / 20 }; - int[] pty4 = { y + height / 5 - height / 20, - y + height / 5 + height / 20 }; + int[] pty4 = { y + height / 5 - height / 20, y + height / 5 + height / 20 }; g.drawPolygon(ptx4, pty4, 2); - int[] ptx5 = { x + width - width / 20, x + width / 20, x + width / 10, - x + width / 10, x + width / 20 }; - int[] pty5 = { y + 2 * height / 5, y + 2 * height / 5, - y + 2 * height / 5 - height / 20, + int[] ptx5 = { x + width - width / 20, x + width / 20, x + width / 10, x + width / 10, x + width / 20 }; + int[] pty5 = { y + 2 * height / 5, y + 2 * height / 5, y + 2 * height / 5 - height / 20, y + 2 * height / 5 + height / 20, y + 2 * height / 5 }; g.drawPolygon(ptx5, pty5, 5); g.fillPolygon(ptx5, pty5, 5); g.fillRect(x + 2 * width / 5, y + 4 * height / 5, width / 5, height / 5); Graphics2D g2d = (Graphics2D) g.create(); - Stroke dashed = new BasicStroke(1, BasicStroke.CAP_BUTT, - BasicStroke.JOIN_BEVEL, 0, new float[] { 9 }, 0); + Stroke dashed = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[] { 9 }, 0); g2d.setStroke(dashed); - g2d.draw(new RoundRectangle2D.Double(x - width / 20, y + height / 20, - width + width / 10, 4 * height / 5 + height / 10 - height / 20, - 10, 10)); + g2d.draw(new RoundRectangle2D.Double(x - width / 20, y + height / 20, width + width / 10, + 4 * height / 5 + height / 10 - height / 20, 10, 10)); g2d.dispose(); g.drawOval(x, y, width / 10, height / 10); @@ -884,46 +761,36 @@ public class ELNComponentVoltageSinkTDF extends int[] ptx1 = { x + width - width / 20, x + width - width / 20 }; int[] pty1 = { y + height, y + 3 * height / 5 + height / 10 }; g.drawPolygon(ptx1, pty1, 2); - int[] ptx3 = { x + width - width / 10 - width / 20, - x + width - width / 10 - width / 20, - x + width - width / 10 - width / 10, x + width - width / 10, - x + width - width / 10 - width / 20, + int[] ptx3 = { x + width - width / 10 - width / 20, x + width - width / 10 - width / 20, + x + width - width / 10 - width / 10, x + width - width / 10, x + width - width / 10 - width / 20, x + width - width / 10 - width / 20 }; - int[] pty3 = { y + 4 * height / 5 - height / 20, y + 4 * height / 5, - y + 4 * height / 5, y + 4 * height / 5, y + 4 * height / 5, - y + 4 * height / 5 + height / 20 }; + int[] pty3 = { y + 4 * height / 5 - height / 20, y + 4 * height / 5, y + 4 * height / 5, y + 4 * height / 5, + y + 4 * height / 5, y + 4 * height / 5 + height / 20 }; g.drawPolygon(ptx3, pty3, 6); int[] ptx4 = { x + width / 10 + width / 20, x + width / 10 + width / 20 }; - int[] pty4 = { y + 4 * height / 5 - height / 20, - y + 4 * height / 5 + height / 20 }; + int[] pty4 = { y + 4 * height / 5 - height / 20, y + 4 * height / 5 + height / 20 }; g.drawPolygon(ptx4, pty4, 2); - int[] ptx5 = { x + width - width / 20, x + width / 20, x + width / 10, - x + width / 10, x + width / 20 }; - int[] pty5 = { y + 3 * height / 5, y + 3 * height / 5, - y + 3 * height / 5 + height / 20, + int[] ptx5 = { x + width - width / 20, x + width / 20, x + width / 10, x + width / 10, x + width / 20 }; + int[] pty5 = { y + 3 * height / 5, y + 3 * height / 5, y + 3 * height / 5 + height / 20, y + 3 * height / 5 - height / 20, y + 3 * height / 5 }; g.drawPolygon(ptx5, pty5, 5); g.fillPolygon(ptx5, pty5, 5); g.fillRect(x + 2 * width / 5, y, width / 5, height / 5); Graphics2D g2d = (Graphics2D) g.create(); - Stroke dashed = new BasicStroke(1, BasicStroke.CAP_BUTT, - BasicStroke.JOIN_BEVEL, 0, new float[] { 9 }, 0); + Stroke dashed = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[] { 9 }, 0); g2d.setStroke(dashed); - g2d.draw(new RoundRectangle2D.Double(x - width / 20, y + height / 10, - width + width / 10, 4 * height / 5 + height / 10 - height / 20, - 10, 10)); + g2d.draw(new RoundRectangle2D.Double(x - width / 20, y + height / 10, width + width / 10, + 4 * height / 5 + height / 10 - height / 20, 10, 10)); g2d.dispose(); g.drawOval(x, y + height - height / 10, width / 10, height / 10); g.setColor(Color.WHITE); g.fillOval(x, y + height - height / 10, width / 10, height / 10); g.setColor(c); - g.drawOval(x + width - width / 10, y + height - height / 10, - width / 10, height / 10); + g.drawOval(x + width - width / 10, y + height - height / 10, width / 10, height / 10); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 10, y + height - height / 10, - width / 10, height / 10); + g.fillOval(x + width - width / 10, y + height - height / 10, width / 10, height / 10); g.setColor(c); } @@ -935,46 +802,36 @@ public class ELNComponentVoltageSinkTDF extends int[] ptx1 = { x + width - width / 20, x + width - width / 20 }; int[] pty1 = { y + height, y + 3 * height / 5 + height / 10 }; g.drawPolygon(ptx1, pty1, 2); - int[] ptx3 = { x + width / 10 + width / 20, - x + width / 10 + width / 20, x + width / 10, x + width / 5, + int[] ptx3 = { x + width / 10 + width / 20, x + width / 10 + width / 20, x + width / 10, x + width / 5, x + width / 10 + width / 20, x + width / 10 + width / 20 }; - int[] pty3 = { y + 4 * height / 5 - height / 20, y + 4 * height / 5, - y + 4 * height / 5, y + 4 * height / 5, y + 4 * height / 5, - y + 4 * height / 5 + height / 20 }; + int[] pty3 = { y + 4 * height / 5 - height / 20, y + 4 * height / 5, y + 4 * height / 5, y + 4 * height / 5, + y + 4 * height / 5, y + 4 * height / 5 + height / 20 }; g.drawPolygon(ptx3, pty3, 6); - int[] ptx4 = { x + width - width / 10 - width / 20, - x + width - width / 10 - width / 20 }; - int[] pty4 = { y + 4 * height / 5 - height / 20, - y + 4 * height / 5 + height / 20 }; + int[] ptx4 = { x + width - width / 10 - width / 20, x + width - width / 10 - width / 20 }; + int[] pty4 = { y + 4 * height / 5 - height / 20, y + 4 * height / 5 + height / 20 }; g.drawPolygon(ptx4, pty4, 2); - int[] ptx5 = { x + width / 20, x + width - width / 20, - x + width - width / 10, x + width - width / 10, + int[] ptx5 = { x + width / 20, x + width - width / 20, x + width - width / 10, x + width - width / 10, x + width - width / 20 }; - int[] pty5 = { y + 3 * height / 5, y + 3 * height / 5, - y + 3 * height / 5 + height / 20, + int[] pty5 = { y + 3 * height / 5, y + 3 * height / 5, y + 3 * height / 5 + height / 20, y + 3 * height / 5 - height / 20, y + 3 * height / 5 }; g.drawPolygon(ptx5, pty5, 5); g.fillPolygon(ptx5, pty5, 5); g.fillRect(x + 2 * width / 5, y, width / 5, height / 5); Graphics2D g2d = (Graphics2D) g.create(); - Stroke dashed = new BasicStroke(1, BasicStroke.CAP_BUTT, - BasicStroke.JOIN_BEVEL, 0, new float[] { 9 }, 0); + Stroke dashed = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[] { 9 }, 0); g2d.setStroke(dashed); - g2d.draw(new RoundRectangle2D.Double(x - width / 20, y + height / 10, - width + width / 10, 4 * height / 5 + height / 10 - height / 20, - 10, 10)); + g2d.draw(new RoundRectangle2D.Double(x - width / 20, y + height / 10, width + width / 10, + 4 * height / 5 + height / 10 - height / 20, 10, 10)); g2d.dispose(); g.drawOval(x, y + height - height / 10, width / 10, height / 10); g.setColor(Color.WHITE); g.fillOval(x, y + height - height / 10, width / 10, height / 10); g.setColor(c); - g.drawOval(x + width - width / 10, y + height - height / 10, - width / 10, height / 10); + g.drawOval(x + width - width / 10, y + height - height / 10, width / 10, height / 10); g.setColor(Color.WHITE); - g.fillOval(x + width - width / 10, y + height - height / 10, - width / 10, height / 10); + g.fillOval(x + width - width / 10, y + height - height / 10, width / 10, height / 10); g.setColor(c); } @@ -986,35 +843,27 @@ public class ELNComponentVoltageSinkTDF extends int[] ptx1 = { x + width - width / 20, x + width - width / 20 }; int[] pty1 = { y, y + 2 * height / 5 - height / 10 }; g.drawPolygon(ptx1, pty1, 2); - int[] ptx3 = { x + width / 10 + width / 20, - x + width / 10 + width / 20, x + width / 10, x + width / 5, + int[] ptx3 = { x + width / 10 + width / 20, x + width / 10 + width / 20, x + width / 10, x + width / 5, x + width / 10 + width / 20, x + width / 10 + width / 20 }; - int[] pty3 = { y + height / 5 - height / 20, y + height / 5, - y + height / 5, y + height / 5, y + height / 5, + int[] pty3 = { y + height / 5 - height / 20, y + height / 5, y + height / 5, y + height / 5, y + height / 5, y + height / 5 + height / 20 }; g.drawPolygon(ptx3, pty3, 6); - int[] ptx4 = { x + width - width / 10 - width / 20, - x + width - width / 10 - width / 20 }; - int[] pty4 = { y + height / 5 - height / 20, - y + height / 5 + height / 20 }; + int[] ptx4 = { x + width - width / 10 - width / 20, x + width - width / 10 - width / 20 }; + int[] pty4 = { y + height / 5 - height / 20, y + height / 5 + height / 20 }; g.drawPolygon(ptx4, pty4, 2); - int[] ptx5 = { x + width / 20, x + width - width / 20, - x + width - width / 10, x + width - width / 10, + int[] ptx5 = { x + width / 20, x + width - width / 20, x + width - width / 10, x + width - width / 10, x + width - width / 20 }; - int[] pty5 = { y + 2 * height / 5, y + 2 * height / 5, - y + 2 * height / 5 - height / 20, + int[] pty5 = { y + 2 * height / 5, y + 2 * height / 5, y + 2 * height / 5 - height / 20, y + 2 * height / 5 + height / 20, y + 2 * height / 5 }; g.drawPolygon(ptx5, pty5, 5); g.fillPolygon(ptx5, pty5, 5); g.fillRect(x + 2 * width / 5, y + 4 * height / 5, width / 5, height / 5); Graphics2D g2d = (Graphics2D) g.create(); - Stroke dashed = new BasicStroke(1, BasicStroke.CAP_BUTT, - BasicStroke.JOIN_BEVEL, 0, new float[] { 9 }, 0); + Stroke dashed = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[] { 9 }, 0); g2d.setStroke(dashed); - g2d.draw(new RoundRectangle2D.Double(x - width / 20, y + height / 20, - width + width / 10, 4 * height / 5 + height / 10 - height / 20, - 10, 10)); + g2d.draw(new RoundRectangle2D.Double(x - width / 20, y + height / 20, width + width / 10, + 4 * height / 5 + height / 10 - height / 20, 10, 10)); g2d.dispose(); g.drawOval(x, y, width / 10, height / 10); @@ -1039,8 +888,7 @@ public class ELNComponentVoltageSinkTDF extends } public boolean editOndoubleClick(JFrame frame) { - JDialogELNComponentVoltageSinkTDF jde = new JDialogELNComponentVoltageSinkTDF( - this); + JDialogELNComponentVoltageSinkTDF jde = new JDialogELNComponentVoltageSinkTDF(this); jde.setVisible(true); return true; } @@ -1059,8 +907,7 @@ public class ELNComponentVoltageSinkTDF extends return new String(sb); } - public void loadExtraParam(NodeList nl, int decX, int decY, int decId) - throws MalformedModelingException { + public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException { try { NodeList nli; Node n1, n2; @@ -1079,20 +926,13 @@ public class ELNComponentVoltageSinkTDF extends if (n2.getNodeType() == Node.ELEMENT_NODE) { elt = (Element) n2; if (elt.getTagName().equals("attributes")) { - scale = Double.parseDouble(elt - .getAttribute("scale")); - position = Integer.parseInt(elt - .getAttribute("position")); - fv_0_2 = Boolean.parseBoolean(elt - .getAttribute("fv_0_2")); - fv_1_3 = Boolean.parseBoolean(elt - .getAttribute("fv_1_3")); - fh_0_2 = Boolean.parseBoolean(elt - .getAttribute("fh_0_2")); - fh_1_3 = Boolean.parseBoolean(elt - .getAttribute("fh_1_3")); - first = Boolean.parseBoolean(elt - .getAttribute("first")); + scale = Double.parseDouble(elt.getAttribute("scale")); + position = Integer.parseInt(elt.getAttribute("position")); + fv_0_2 = Boolean.parseBoolean(elt.getAttribute("fv_0_2")); + fv_1_3 = Boolean.parseBoolean(elt.getAttribute("fv_1_3")); + fh_0_2 = Boolean.parseBoolean(elt.getAttribute("fh_0_2")); + fh_1_3 = Boolean.parseBoolean(elt.getAttribute("fh_1_3")); + first = Boolean.parseBoolean(elt.getAttribute("first")); setScale(scale); setPosition(position); setFv_0_2(fv_0_2); @@ -1110,8 +950,7 @@ public class ELNComponentVoltageSinkTDF extends } } - public void addActionToPopupMenu(JPopupMenu componentMenu, - ActionListener menuAL, int x, int y) { + public void addActionToPopupMenu(JPopupMenu componentMenu, ActionListener menuAL, int x, int y) { componentMenu.addSeparator(); JMenuItem rotateright = new JMenuItem("Rotate right 90\u00b0"); @@ -1242,8 +1081,7 @@ public class ELNComponentVoltageSinkTDF extends if ((father != null) && (father instanceof ELNModule)) { resizeToFatherSize(); - setCdRectangle(0, father.getWidth() - getWidth(), 0, - father.getHeight() - getHeight()); + setCdRectangle(0, father.getWidth() - getWidth(), 0, father.getHeight() - getHeight()); setMoveCd(x, y); } } @@ -1256,7 +1094,6 @@ public class ELNComponentVoltageSinkTDF extends myColor = null; setFather(null); TDiagramPanel tdp = getTDiagramPanel(); - setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), - tdp.getMaxY()); + setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY()); } } \ No newline at end of file -- GitLab