From 12ed05ed2220af33f84546ff6dc3d411e19d0688 Mon Sep 17 00:00:00 2001 From: Etudiant Master SESI <irina.lee@etu.upmc.fr> Date: Tue, 26 Jun 2018 17:35:14 +0200 Subject: [PATCH] solved problem with loading/saving rotational component --- .../ui/eln/sca_eln/ELNComponentCapacitor.java | 53 +++++++++++- .../sca_eln/ELNComponentIdealTransformer.java | 76 ++++++++++++++++- .../ELNComponentIndependentCurrentSource.java | 84 +++++++++++++++++-- .../ELNComponentIndependentVoltageSource.java | 84 +++++++++++++++++-- .../ui/eln/sca_eln/ELNComponentInductor.java | 75 ++++++++++++++++- .../ui/eln/sca_eln/ELNComponentResistor.java | 57 ++++++++++++- .../sca_eln/ELNComponentTransmissionLine.java | 76 ++++++++++++++++- ...mponentVoltageControlledCurrentSource.java | 76 ++++++++++++++++- ...mponentVoltageControlledVoltageSource.java | 76 ++++++++++++++++- 9 files changed, 638 insertions(+), 19 deletions(-) diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentCapacitor.java b/src/main/java/ui/eln/sca_eln/ELNComponentCapacitor.java index 0723f2df3f..c1e05630b1 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentCapacitor.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentCapacitor.java @@ -365,7 +365,12 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent impl sb.append("\" q0=\"" + q0); sb.append("\" unit1=\""); sb.append(encode(unit1)); - sb.append("\""); + sb.append("\" position=\"" + position); + sb.append("\" width=\"" + width); + sb.append("\" height=\"" + height); + sb.append("\" fv=\"" + fv); + sb.append("\" fh=\"" + fh); + sb.append("\" first=\"" + first + "\""); sb.append("/>\n"); sb.append("</extraparam>\n"); return new String(sb); @@ -379,6 +384,8 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent impl double value, q0; String unit0, unit1; + int position, width, height; + boolean fv, fh, first; for (int i = 0; i < nl.getLength(); i++) { n1 = nl.item(i); @@ -393,10 +400,22 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent impl q0 = Double.parseDouble(elt.getAttribute("q0")); unit0 = elt.getAttribute("unit0"); unit1 = elt.getAttribute("unit1"); + position = Integer.parseInt(elt.getAttribute("position")); + width = Integer.parseInt(elt.getAttribute("width")); + height = Integer.parseInt(elt.getAttribute("height")); + fv = Boolean.parseBoolean(elt.getAttribute("fv")); + fh = Boolean.parseBoolean(elt.getAttribute("fh")); + first = Boolean.parseBoolean(elt.getAttribute("first")); setVal(value); setQ0(q0); setUnit0(unit0); setUnit1(unit1); + setPosition(position); + this.width = width; + this.height = height; + setFv(fv); + setFh(fh); + setFirst(first); } } } @@ -493,4 +512,36 @@ public class ELNComponentCapacitor extends TGCScalableWithInternalComponent impl public void setUnit1(String _unit1) { unit1 = _unit1; } + + public int getPosition() { + return position; + } + + public void setPosition(int position) { + this.position = position; + } + + public boolean isFv() { + return fv; + } + + public void setFv(boolean fv) { + this.fv = fv; + } + + public boolean isFh() { + return fh; + } + + public void setFh(boolean fh) { + this.fh = fh; + } + + public boolean isFirst() { + return first; + } + + public void setFirst(boolean first) { + this.first = first; + } } diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentIdealTransformer.java b/src/main/java/ui/eln/sca_eln/ELNComponentIdealTransformer.java index ed0a245242..6cea5ddc75 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentIdealTransformer.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentIdealTransformer.java @@ -672,7 +672,15 @@ public class ELNComponentIdealTransformer extends TGCScalableWithInternalCompone protected String translateExtraParam() { StringBuffer sb = new StringBuffer("<extraparam>\n"); - sb.append("<attributes ratio=\"" + ratio + "\""); + sb.append("<attributes ratio=\"" + ratio); + sb.append("\" position=\"" + position); + sb.append("\" width=\"" + width); + sb.append("\" height=\"" + height); + sb.append("\" fv_0_2=\"" + fv_0_2); + sb.append("\" fv_1_3=\"" + fv_1_3); + sb.append("\" fh_0_2=\"" + fh_0_2); + sb.append("\" fh_1_3=\"" + fh_1_3); + sb.append("\" first=\"" + first + "\""); sb.append("/>\n"); sb.append("</extraparam>\n"); return new String(sb); @@ -685,6 +693,8 @@ public class ELNComponentIdealTransformer extends TGCScalableWithInternalCompone Element elt; double ratio; + int position, width, height; + boolean fv_0_2, fv_1_3, fh_0_2, fh_1_3, first; for (int i = 0; i < nl.getLength(); i++) { n1 = nl.item(i); @@ -696,7 +706,23 @@ public class ELNComponentIdealTransformer extends TGCScalableWithInternalCompone elt = (Element) n2; if (elt.getTagName().equals("attributes")) { ratio = Double.parseDouble(elt.getAttribute("ratio")); + 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")); setRatio(ratio); + setPosition(position); + this.width = width; + this.height = height; + setFv_0_2(fv_0_2); + setFv_1_3(fv_1_3); + setFh_0_2(fh_0_2); + setFh_1_3(fh_1_3); + setFirst(first); } } } @@ -785,4 +811,52 @@ public class ELNComponentIdealTransformer extends TGCScalableWithInternalCompone public void setRatio(double _ratio) { ratio = _ratio; } + + public int getPosition() { + return position; + } + + public void setPosition(int position) { + this.position = position; + } + + public boolean isFv_0_2() { + return fv_0_2; + } + + public void setFv_0_2(boolean fv_0_2) { + this.fv_0_2 = fv_0_2; + } + + public boolean isFv_1_3() { + return fv_1_3; + } + + public void setFv_1_3(boolean fv_1_3) { + this.fv_1_3 = fv_1_3; + } + + public boolean isFh_0_2() { + return fh_0_2; + } + + public void setFh_0_2(boolean fh_0_2) { + this.fh_0_2 = fh_0_2; + } + + public boolean isFh_1_3() { + return fh_1_3; + } + + public void setFh_1_3(boolean fh_1_3) { + this.fh_1_3 = fh_1_3; + } + + public boolean isFirst() { + return first; + } + + public void setFirst(boolean first) { + this.first = first; + } } diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentIndependentCurrentSource.java b/src/main/java/ui/eln/sca_eln/ELNComponentIndependentCurrentSource.java index 9702db6fde..3eda5b50c3 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentIndependentCurrentSource.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentIndependentCurrentSource.java @@ -668,7 +668,15 @@ public class ELNComponentIndependentCurrentSource extends TGCScalableWithInterna sb.append("\" delay=\"" + delay); sb.append("\" ac_amplitude=\"" + acAmplitude); sb.append("\" ac_phase=\"" + acPhase); - sb.append("\" ac_noise_amplitude=\"" + acNoiseAmplitude + "\""); + sb.append("\" ac_noise_amplitude=\"" + acNoiseAmplitude); + sb.append("\" position=\"" + position); + sb.append("\" width=\"" + width); + sb.append("\" height=\"" + height); + sb.append("\" fv_0_2=\"" + fv_0_2); + sb.append("\" fv_1_3=\"" + fv_1_3); + sb.append("\" fh_0_2=\"" + fh_0_2); + sb.append("\" fh_1_3=\"" + fh_1_3); + sb.append("\" first=\"" + first + "\""); sb.append("/>\n"); sb.append("</extraparam>\n"); return new String(sb); @@ -683,6 +691,8 @@ public class ELNComponentIndependentCurrentSource extends TGCScalableWithInterna double initValue, offset, amplitude, frequency, phase, acAmplitude, acPhase, acNoiseAmplitude; String delay; String unit0; + int position, width, height; + boolean fv_0_2, fv_1_3, fh_0_2, fh_1_3, first; for (int i = 0; i < nl.getLength(); i++) { n1 = nl.item(i); @@ -703,6 +713,14 @@ public class ELNComponentIndependentCurrentSource extends TGCScalableWithInterna 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); @@ -713,6 +731,14 @@ public class ELNComponentIndependentCurrentSource extends TGCScalableWithInterna setAcAmplitude(acAmplitude); setAcPhase(acPhase); setAcNoiseAmplitude(acNoiseAmplitude); + setPosition(position); + this.width = width; + this.height = height; + setFv_0_2(fv_0_2); + setFv_1_3(fv_1_3); + setFh_0_2(fh_0_2); + setFh_1_3(fh_1_3); + setFirst(first); } } } @@ -726,11 +752,11 @@ public class ELNComponentIndependentCurrentSource extends TGCScalableWithInterna public void addActionToPopupMenu(JPopupMenu componentMenu, ActionListener menuAL, int x, int y) { componentMenu.addSeparator(); - JMenuItem rotateright = new JMenuItem("Rotate right 90°"); + JMenuItem rotateright = new JMenuItem("Rotate right 90°"); rotateright.addActionListener(this); componentMenu.add(rotateright); - JMenuItem rotateleft = new JMenuItem("Rotate left 90°"); + JMenuItem rotateleft = new JMenuItem("Rotate left 90°"); rotateleft.addActionListener(this); componentMenu.add(rotateleft); @@ -746,12 +772,12 @@ public class ELNComponentIndependentCurrentSource extends TGCScalableWithInterna } public void actionPerformed(ActionEvent e) { - if (e.getActionCommand().equals("Rotate right 90°")) { + if (e.getActionCommand().equals("Rotate right 90°")) { position++; position %= 4; first = false; } - if (e.getActionCommand().equals("Rotate left 90°")) { + if (e.getActionCommand().equals("Rotate left 90°")) { position = position + 3; position %= 4; first = false; @@ -873,4 +899,52 @@ public class ELNComponentIndependentCurrentSource extends TGCScalableWithInterna public void setUnit0(String _unit0) { unit0 = _unit0; } + + public int getPosition() { + return position; + } + + public void setPosition(int position) { + this.position = position; + } + + public boolean isFv_0_2() { + return fv_0_2; + } + + public void setFv_0_2(boolean fv_0_2) { + this.fv_0_2 = fv_0_2; + } + + public boolean isFv_1_3() { + return fv_1_3; + } + + public void setFv_1_3(boolean fv_1_3) { + this.fv_1_3 = fv_1_3; + } + + public boolean isFh_0_2() { + return fh_0_2; + } + + public void setFh_0_2(boolean fh_0_2) { + this.fh_0_2 = fh_0_2; + } + + public boolean isFh_1_3() { + return fh_1_3; + } + + public void setFh_1_3(boolean fh_1_3) { + this.fh_1_3 = fh_1_3; + } + + public boolean isFirst() { + return first; + } + + public void setFirst(boolean first) { + this.first = first; + } } diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentIndependentVoltageSource.java b/src/main/java/ui/eln/sca_eln/ELNComponentIndependentVoltageSource.java index 063cdd70c2..e30d15c512 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentIndependentVoltageSource.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentIndependentVoltageSource.java @@ -591,7 +591,15 @@ public class ELNComponentIndependentVoltageSource extends TGCScalableWithInterna sb.append("\" delay=\"" + delay); sb.append("\" ac_amplitude=\"" + acAmplitude); sb.append("\" ac_phase=\"" + acPhase); - sb.append("\" ac_noise_amplitude=\"" + acNoiseAmplitude + "\""); + sb.append("\" ac_noise_amplitude=\"" + acNoiseAmplitude); + sb.append("\" position=\"" + position); + sb.append("\" width=\"" + width); + sb.append("\" height=\"" + height); + sb.append("\" fv_0_2=\"" + fv_0_2); + sb.append("\" fv_1_3=\"" + fv_1_3); + sb.append("\" fh_0_2=\"" + fh_0_2); + sb.append("\" fh_1_3=\"" + fh_1_3); + sb.append("\" first=\"" + first + "\""); sb.append("/>\n"); sb.append("</extraparam>\n"); return new String(sb); @@ -606,6 +614,8 @@ public class ELNComponentIndependentVoltageSource extends TGCScalableWithInterna double initValue, offset, amplitude, frequency, phase, acAmplitude, acPhase, acNoiseAmplitude; String delay; String unit0; + int position, width, height; + boolean fv_0_2, fv_1_3, fh_0_2, fh_1_3, first; for (int i = 0; i < nl.getLength(); i++) { n1 = nl.item(i); @@ -626,6 +636,14 @@ public class ELNComponentIndependentVoltageSource extends TGCScalableWithInterna 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); @@ -636,6 +654,14 @@ public class ELNComponentIndependentVoltageSource extends TGCScalableWithInterna setAcAmplitude(acAmplitude); setAcPhase(acPhase); setAcNoiseAmplitude(acNoiseAmplitude); + setPosition(position); + this.width = width; + this.height = height; + setFv_0_2(fv_0_2); + setFv_1_3(fv_1_3); + setFh_0_2(fh_0_2); + setFh_1_3(fh_1_3); + setFirst(first); } } } @@ -649,11 +675,11 @@ public class ELNComponentIndependentVoltageSource extends TGCScalableWithInterna public void addActionToPopupMenu(JPopupMenu componentMenu, ActionListener menuAL, int x, int y) { componentMenu.addSeparator(); - JMenuItem rotateright = new JMenuItem("Rotate right 90°"); + JMenuItem rotateright = new JMenuItem("Rotate right 90°"); rotateright.addActionListener(this); componentMenu.add(rotateright); - JMenuItem rotateleft = new JMenuItem("Rotate left 90°"); + JMenuItem rotateleft = new JMenuItem("Rotate left 90°"); rotateleft.addActionListener(this); componentMenu.add(rotateleft); @@ -669,12 +695,12 @@ public class ELNComponentIndependentVoltageSource extends TGCScalableWithInterna } public void actionPerformed(ActionEvent e) { - if (e.getActionCommand().equals("Rotate right 90°")) { + if (e.getActionCommand().equals("Rotate right 90°")) { position++; position %= 4; first = false; } - if (e.getActionCommand().equals("Rotate left 90°")) { + if (e.getActionCommand().equals("Rotate left 90°")) { position = position + 3; position %= 4; first = false; @@ -796,4 +822,52 @@ public class ELNComponentIndependentVoltageSource extends TGCScalableWithInterna public void setUnit0(String _unit0) { unit0 = _unit0; } + + public int getPosition() { + return position; + } + + public void setPosition(int position) { + this.position = position; + } + + public boolean isFv_0_2() { + return fv_0_2; + } + + public void setFv_0_2(boolean fv_0_2) { + this.fv_0_2 = fv_0_2; + } + + public boolean isFv_1_3() { + return fv_1_3; + } + + public void setFv_1_3(boolean fv_1_3) { + this.fv_1_3 = fv_1_3; + } + + public boolean isFh_0_2() { + return fh_0_2; + } + + public void setFh_0_2(boolean fh_0_2) { + this.fh_0_2 = fh_0_2; + } + + public boolean isFh_1_3() { + return fh_1_3; + } + + public void setFh_1_3(boolean fh_1_3) { + this.fh_1_3 = fh_1_3; + } + + public boolean isFirst() { + return first; + } + + public void setFirst(boolean first) { + this.first = first; + } } diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentInductor.java b/src/main/java/ui/eln/sca_eln/ELNComponentInductor.java index 5a7b5b3e23..c2286bb155 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentInductor.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentInductor.java @@ -483,7 +483,14 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent imple sb.append("\" phi0=\"" + phi0); sb.append("\" unit1=\""); sb.append(encode(unit1)); - sb.append("\""); + sb.append("\" position=\"" + position); + sb.append("\" width=\"" + width); + sb.append("\" height=\"" + height); + sb.append("\" fv_0_2=\"" + fv_0_2); + sb.append("\" fv_1_3=\"" + fv_1_3); + sb.append("\" fh_0_2=\"" + fh_0_2); + sb.append("\" fh_1_3=\"" + fh_1_3); + sb.append("\" first=\"" + first + "\""); sb.append("/>\n"); sb.append("</extraparam>\n"); return new String(sb); @@ -497,6 +504,8 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent imple double value, phi0; String unit0, unit1; + int position, width, height; + boolean fv_0_2, fv_1_3, fh_0_2, fh_1_3, first; for (int i = 0; i < nl.getLength(); i++) { n1 = nl.item(i); @@ -511,10 +520,26 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent imple phi0 = Double.parseDouble(elt.getAttribute("phi0")); unit0 = elt.getAttribute("unit0"); unit1 = elt.getAttribute("unit1"); + 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")); setVal(value); setPhi0(phi0); setUnit0(unit0); setUnit1(unit1); + setPosition(position); + this.width = width; + this.height = height; + setFv_0_2(fv_0_2); + setFv_1_3(fv_1_3); + setFh_0_2(fh_0_2); + setFh_1_3(fh_1_3); + setFirst(first); } } } @@ -627,4 +652,52 @@ public class ELNComponentInductor extends TGCScalableWithInternalComponent imple public void setUnit1(String _unit1) { unit1 = _unit1; } + + public int getPosition() { + return position; + } + + public void setPosition(int position) { + this.position = position; + } + + public boolean isFv_0_2() { + return fv_0_2; + } + + public void setFv_0_2(boolean fv_0_2) { + this.fv_0_2 = fv_0_2; + } + + public boolean isFv_1_3() { + return fv_1_3; + } + + public void setFv_1_3(boolean fv_1_3) { + this.fv_1_3 = fv_1_3; + } + + public boolean isFh_0_2() { + return fh_0_2; + } + + public void setFh_0_2(boolean fh_0_2) { + this.fh_0_2 = fh_0_2; + } + + public boolean isFh_1_3() { + return fh_1_3; + } + + public void setFh_1_3(boolean fh_1_3) { + this.fh_1_3 = fh_1_3; + } + + public boolean isFirst() { + return first; + } + + public void setFirst(boolean first) { + this.first = first; + } } diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentResistor.java b/src/main/java/ui/eln/sca_eln/ELNComponentResistor.java index c8a2a6a13c..280c3d6450 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentResistor.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentResistor.java @@ -361,12 +361,17 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent imple sb.append("<attributes value=\"" + val); sb.append("\" unit=\""); sb.append(encode(unit)); - sb.append("\""); + sb.append("\" position=\"" + position); + sb.append("\" width=\"" + width); + sb.append("\" height=\"" + height); + sb.append("\" fv=\"" + fv); + sb.append("\" fh=\"" + fh); + sb.append("\" first=\"" + first + "\""); sb.append("/>\n"); sb.append("</extraparam>\n"); return new String(sb); } - + public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException { try { NodeList nli; @@ -375,7 +380,9 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent imple double value; String unit; - + int position, width, height; + boolean fv, fh, first; + for (int i = 0; i < nl.getLength(); i++) { n1 = nl.item(i); if (n1.getNodeType() == Node.ELEMENT_NODE) { @@ -387,8 +394,20 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent imple if (elt.getTagName().equals("attributes")) { value = Double.parseDouble(elt.getAttribute("value")); unit = elt.getAttribute("unit"); + position = Integer.parseInt(elt.getAttribute("position")); + width = Integer.parseInt(elt.getAttribute("width")); + height = Integer.parseInt(elt.getAttribute("height")); + fv = Boolean.parseBoolean(elt.getAttribute("fv")); + fh = Boolean.parseBoolean(elt.getAttribute("fh")); + first = Boolean.parseBoolean(elt.getAttribute("first")); setVal(value); setUnit(unit); + setPosition(position); + this.width = width; + this.height = height; + setFv(fv); + setFh(fh); + setFirst(first); } } } @@ -469,4 +488,36 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent imple public void setUnit(String _unit) { unit = _unit; } + + public int getPosition() { + return position; + } + + public void setPosition(int position) { + this.position = position; + } + + public boolean isFv() { + return fv; + } + + public void setFv(boolean fv) { + this.fv = fv; + } + + public boolean isFh() { + return fh; + } + + public void setFh(boolean fh) { + this.fh = fh; + } + + public boolean isFirst() { + return first; + } + + public void setFirst(boolean first) { + this.first = first; + } } diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentTransmissionLine.java b/src/main/java/ui/eln/sca_eln/ELNComponentTransmissionLine.java index 97c0825a56..b60f2dbb98 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentTransmissionLine.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentTransmissionLine.java @@ -550,7 +550,15 @@ public class ELNComponentTransmissionLine extends TGCScalableWithInternalCompone sb.append("\" unit0=\"" + encode(unit0)); sb.append("\" delay=\"" + delay); sb.append("\" delta0=\"" + delta0); - sb.append("\" unit2=\"" + encode(unit2) + "\""); + sb.append("\" unit2=\"" + encode(unit2)); + sb.append("\" position=\"" + position); + sb.append("\" width=\"" + width); + sb.append("\" height=\"" + height); + sb.append("\" fv_0_2=\"" + fv_0_2); + sb.append("\" fv_1_3=\"" + fv_1_3); + sb.append("\" fh_0_2=\"" + fh_0_2); + sb.append("\" fh_1_3=\"" + fh_1_3); + sb.append("\" first=\"" + first + "\""); sb.append("/>\n"); sb.append("</extraparam>\n"); return new String(sb); @@ -565,6 +573,8 @@ public class ELNComponentTransmissionLine extends TGCScalableWithInternalCompone double z0, delta0; String delay; String unit0, unit2; + int position, width, height; + boolean fv_0_2, fv_1_3, fh_0_2, fh_1_3, first; for (int i = 0; i < nl.getLength(); i++) { n1 = nl.item(i); @@ -580,11 +590,27 @@ public class ELNComponentTransmissionLine extends TGCScalableWithInternalCompone delay = elt.getAttribute("delay"); delta0 = Double.parseDouble(elt.getAttribute("delta0")); unit2 = elt.getAttribute("unit2"); + 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")); setZ0(z0); setUnit0(unit0); setDelay(delay); setDelta0(delta0); setUnit2(unit2); + setPosition(position); + this.width = width; + this.height = height; + setFv_0_2(fv_0_2); + setFv_1_3(fv_1_3); + setFh_0_2(fh_0_2); + setFh_1_3(fh_1_3); + setFirst(first); } } } @@ -705,4 +731,52 @@ public class ELNComponentTransmissionLine extends TGCScalableWithInternalCompone public void setUnit2(String _unit2) { unit2 = _unit2; } + + public int getPosition() { + return position; + } + + public void setPosition(int position) { + this.position = position; + } + + public boolean isFv_0_2() { + return fv_0_2; + } + + public void setFv_0_2(boolean fv_0_2) { + this.fv_0_2 = fv_0_2; + } + + public boolean isFv_1_3() { + return fv_1_3; + } + + public void setFv_1_3(boolean fv_1_3) { + this.fv_1_3 = fv_1_3; + } + + public boolean isFh_0_2() { + return fh_0_2; + } + + public void setFh_0_2(boolean fh_0_2) { + this.fh_0_2 = fh_0_2; + } + + public boolean isFh_1_3() { + return fh_1_3; + } + + public void setFh_1_3(boolean fh_1_3) { + this.fh_1_3 = fh_1_3; + } + + public boolean isFirst() { + return first; + } + + public void setFirst(boolean first) { + this.first = first; + } } diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledCurrentSource.java b/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledCurrentSource.java index a7fcf1b30d..fc6e6f7452 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledCurrentSource.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledCurrentSource.java @@ -776,7 +776,15 @@ public class ELNComponentVoltageControlledCurrentSource extends TGCScalableWithI protected String translateExtraParam() { StringBuffer sb = new StringBuffer("<extraparam>\n"); sb.append("<attributes value=\"" + val); - sb.append("\" unit=\"" + encode(unit) + "\""); + sb.append("\" unit=\"" + encode(unit)); + sb.append("\" position=\"" + position); + sb.append("\" width=\"" + width); + sb.append("\" height=\"" + height); + sb.append("\" fv_0_2=\"" + fv_0_2); + sb.append("\" fv_1_3=\"" + fv_1_3); + sb.append("\" fh_0_2=\"" + fh_0_2); + sb.append("\" fh_1_3=\"" + fh_1_3); + sb.append("\" first=\"" + first + "\""); sb.append("/>\n"); sb.append("</extraparam>\n"); return new String(sb); @@ -790,6 +798,8 @@ public class ELNComponentVoltageControlledCurrentSource extends TGCScalableWithI double value; String unit; + int position, width, height; + boolean fv_0_2, fv_1_3, fh_0_2, fh_1_3, first; for (int i = 0; i < nl.getLength(); i++) { n1 = nl.item(i); @@ -802,8 +812,24 @@ public class ELNComponentVoltageControlledCurrentSource extends TGCScalableWithI if (elt.getTagName().equals("attributes")) { value = Double.parseDouble(elt.getAttribute("value")); unit = elt.getAttribute("unit"); + 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")); setVal(value); setUnit(unit); + setPosition(position); + this.width = width; + this.height = height; + setFv_0_2(fv_0_2); + setFv_1_3(fv_1_3); + setFh_0_2(fh_0_2); + setFh_1_3(fh_1_3); + setFirst(first); } } } @@ -900,4 +926,52 @@ public class ELNComponentVoltageControlledCurrentSource extends TGCScalableWithI public void setUnit(String _unit) { unit = _unit; } + + public int getPosition() { + return position; + } + + public void setPosition(int position) { + this.position = position; + } + + public boolean isFv_0_2() { + return fv_0_2; + } + + public void setFv_0_2(boolean fv_0_2) { + this.fv_0_2 = fv_0_2; + } + + public boolean isFv_1_3() { + return fv_1_3; + } + + public void setFv_1_3(boolean fv_1_3) { + this.fv_1_3 = fv_1_3; + } + + public boolean isFh_0_2() { + return fh_0_2; + } + + public void setFh_0_2(boolean fh_0_2) { + this.fh_0_2 = fh_0_2; + } + + public boolean isFh_1_3() { + return fh_1_3; + } + + public void setFh_1_3(boolean fh_1_3) { + this.fh_1_3 = fh_1_3; + } + + public boolean isFirst() { + return first; + } + + public void setFirst(boolean first) { + this.first = first; + } } diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledVoltageSource.java b/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledVoltageSource.java index 3a1934db3f..0fc0e07597 100644 --- a/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledVoltageSource.java +++ b/src/main/java/ui/eln/sca_eln/ELNComponentVoltageControlledVoltageSource.java @@ -770,7 +770,15 @@ public class ELNComponentVoltageControlledVoltageSource extends TGCScalableWithI protected String translateExtraParam() { StringBuffer sb = new StringBuffer("<extraparam>\n"); - sb.append("<attributes value=\"" + val + "\""); + sb.append("<attributes value=\"" + val); + sb.append("\" position=\"" + position); + sb.append("\" width=\"" + width); + sb.append("\" height=\"" + height); + sb.append("\" fv_0_2=\"" + fv_0_2); + sb.append("\" fv_1_3=\"" + fv_1_3); + sb.append("\" fh_0_2=\"" + fh_0_2); + sb.append("\" fh_1_3=\"" + fh_1_3); + sb.append("\" first=\"" + first + "\""); sb.append("/>\n"); sb.append("</extraparam>\n"); return new String(sb); @@ -783,6 +791,8 @@ public class ELNComponentVoltageControlledVoltageSource extends TGCScalableWithI Element elt; double value; + int position, width, height; + boolean fv_0_2, fv_1_3, fh_0_2, fh_1_3, first; for (int i = 0; i < nl.getLength(); i++) { n1 = nl.item(i); @@ -794,7 +804,23 @@ public class ELNComponentVoltageControlledVoltageSource extends TGCScalableWithI elt = (Element) n2; if (elt.getTagName().equals("attributes")) { value = Double.parseDouble(elt.getAttribute("value")); + 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")); setVal(value); + setPosition(position); + this.width = width; + this.height = height; + setFv_0_2(fv_0_2); + setFv_1_3(fv_1_3); + setFh_0_2(fh_0_2); + setFh_1_3(fh_1_3); + setFirst(first); } } } @@ -883,4 +909,52 @@ public class ELNComponentVoltageControlledVoltageSource extends TGCScalableWithI public void setVal(double _val) { val = _val; } + + public int getPosition() { + return position; + } + + public void setPosition(int position) { + this.position = position; + } + + public boolean isFv_0_2() { + return fv_0_2; + } + + public void setFv_0_2(boolean fv_0_2) { + this.fv_0_2 = fv_0_2; + } + + public boolean isFv_1_3() { + return fv_1_3; + } + + public void setFv_1_3(boolean fv_1_3) { + this.fv_1_3 = fv_1_3; + } + + public boolean isFh_0_2() { + return fh_0_2; + } + + public void setFh_0_2(boolean fh_0_2) { + this.fh_0_2 = fh_0_2; + } + + public boolean isFh_1_3() { + return fh_1_3; + } + + public void setFh_1_3(boolean fh_1_3) { + this.fh_1_3 = fh_1_3; + } + + public boolean isFirst() { + return first; + } + + public void setFirst(boolean first) { + this.first = first; + } } -- GitLab