Capacitor components now label their terminal nodes as '+' and '-' instead of '1' and '2' when 'Polarized' property is ticked

This commit is contained in:
Bane Stojkovic
2026-09-04 13:13:03 +02:00
parent 8b48f34df0
commit 033f94f331
4 changed files with 45 additions and 1 deletions
@@ -397,6 +397,10 @@
<changeType>IMPROVEMENT</changeType>
<description>Diode components now label their terminal nodes as 'A' (anode) and 'K' (cathode) instead of '1' and '2'</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType>
<description>Capacitor components now label their terminal nodes as '+' and '-' instead of '1' and '2' when 'Polarized' property is ticked</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType>
<description>Percentage values such as transparency Alpha, image Scale, etc, can have decimal values and not just integers</description>
@@ -203,6 +203,19 @@ public class AxialElectrolyticCapacitor extends AbstractLeadedComponent<Capacita
this.polarized = polarized;
}
@Override
public String getControlPointNodeName(int index) {
if (getPolarized()) {
switch (index) {
case 0:
return "+";
case 1:
return "-";
}
}
return super.getControlPointNodeName(index);
}
@Override
protected Shape getBodyShape() {
double lengthFinal = getLength().convertToPixels();
@@ -96,6 +96,19 @@ public class CapacitorSymbol extends AbstractSchematicLeadedSymbol<Capacitance>
this.polarized = polarized;
}
@Override
public String getControlPointNodeName(int index) {
if (getPolarized()) {
switch (index) {
case 0:
return "+";
case 1:
return "-";
}
}
return super.getControlPointNodeName(index);
}
public void drawIcon(Graphics2D g2d, int width, int height) {
g2d.rotate(-Math.PI / 4, width / 2, height / 2);
g2d.setColor(LEAD_COLOR);
@@ -72,6 +72,7 @@ public class RadialElectrolytic extends AbstractRadialComponent<Capacitance> imp
private boolean polarized = true;
private boolean folded = false;
private Size height = HEIGHT;
@Deprecated
private boolean invert = false;
public RadialElectrolytic() {
@@ -304,7 +305,7 @@ public class RadialElectrolytic extends AbstractRadialComponent<Capacitance> imp
this.height = height;
}
@EditableProperty(name = "Invert Polarity")
// @EditableProperty(name = "Invert Polarity")
public boolean getInvert() {
return invert;
}
@@ -313,6 +314,19 @@ public class RadialElectrolytic extends AbstractRadialComponent<Capacitance> imp
this.invert = invert;
}
@Override
public String getControlPointNodeName(int index) {
if (getPolarized()) {
switch (index) {
case 0:
return getInvert() ? "-" : "+";
case 1:
return getInvert() ? "+" : "-";
}
}
return super.getControlPointNodeName(index);
}
@Override
protected Shape getBodyShape() {
double height = (int) getHeight().convertToPixels();