mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
Show voltage and power ratings in BOM where applicable
This commit is contained in:
Binary file not shown.
+10
-14
@@ -10,7 +10,7 @@ import org.diylc.core.measures.Resistance;
|
||||
import org.diylc.core.measures.ResistanceUnit;
|
||||
|
||||
public abstract class AbstractPotentiometer extends
|
||||
AbstractTransparentComponent<PotentiometerValue> {
|
||||
AbstractTransparentComponent<Resistance> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -44,25 +44,21 @@ public abstract class AbstractPotentiometer extends
|
||||
public boolean isControlPointSticky(int index) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValueForDisplay() {
|
||||
return resistance.toString() + " " + taper.toString();
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
public Resistance getResistance() {
|
||||
@Override
|
||||
public Resistance getValue() {
|
||||
return resistance;
|
||||
}
|
||||
|
||||
public void setResistance(Resistance resistance) {
|
||||
this.resistance = resistance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PotentiometerValue getValue() {
|
||||
return new PotentiometerValue(resistance, taper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(PotentiometerValue value) {
|
||||
this.resistance = value.getResistance();
|
||||
this.taper = value.getTaper();
|
||||
public void setValue(Resistance value) {
|
||||
this.resistance = value;
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
|
||||
+5
@@ -57,6 +57,11 @@ public class AxialElectrolyticCapacitor extends AbstractLeadedComponent<Capacita
|
||||
public void setValue(Capacitance value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValueForDisplay() {
|
||||
return getValue().toString() + " " + getVoltageNew().toString();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Voltage getVoltage() {
|
||||
|
||||
+5
@@ -61,6 +61,11 @@ public class AxialFilmCapacitor extends AbstractLeadedComponent<Capacitance> {
|
||||
public void setVoltage(Voltage voltage) {
|
||||
this.voltage = voltage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValueForDisplay() {
|
||||
return getValue().toString() + " " + getVoltageNew().toString();
|
||||
}
|
||||
|
||||
@EditableProperty(name = "Voltage")
|
||||
public org.diylc.core.measures.Voltage getVoltageNew() {
|
||||
|
||||
+5
@@ -38,6 +38,11 @@ public class CapacitorSymbol extends AbstractSchematicLeadedSymbol<Capacitance>
|
||||
public void setValue(Capacitance value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValueForDisplay() {
|
||||
return getValue().toString() + " " + getVoltageNew().toString();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Voltage getVoltage() {
|
||||
|
||||
+2
-2
@@ -197,7 +197,7 @@ public class PotentiometerPanel extends AbstractPotentiometer {
|
||||
g2d.drawString(getName(), (int) (bodyRect.getX() + x), (int) (bodyRect.getY() + y));
|
||||
|
||||
// Draw value.
|
||||
rect = fontMetrics.getStringBounds(getValue().toString(), g2d);
|
||||
rect = fontMetrics.getStringBounds(getValueForDisplay(), g2d);
|
||||
|
||||
textHeight = (int) rect.getHeight();
|
||||
textWidth = (int) rect.getWidth();
|
||||
@@ -205,7 +205,7 @@ public class PotentiometerPanel extends AbstractPotentiometer {
|
||||
x = (panelWidth - textWidth) / 2;
|
||||
y = panelHeight / 2 + fontMetrics.getAscent();
|
||||
|
||||
g2d.drawString(getValue().toString(), (int) (bodyRect.getX() + x),
|
||||
g2d.drawString(getValueForDisplay(), (int) (bodyRect.getX() + x),
|
||||
(int) (bodyRect.getY() + y));
|
||||
}
|
||||
|
||||
|
||||
+24
@@ -14,6 +14,7 @@ import org.diylc.core.measures.Capacitance;
|
||||
import org.diylc.core.measures.CapacitanceUnit;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
import org.diylc.core.measures.VoltageUnit;
|
||||
|
||||
@ComponentDescriptor(name = "Ceramic Capacitor (radial)", author = "Branislav Stojkovic", category = "Passive", creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "C", description = "Standard radial ceramic capacitor", zOrder = IDIYComponent.COMPONENT)
|
||||
public class RadialCeramicDiskCapacitor extends AbstractLeadedComponent<Capacitance> {
|
||||
@@ -26,7 +27,10 @@ public class RadialCeramicDiskCapacitor extends AbstractLeadedComponent<Capacita
|
||||
public static Color BORDER_COLOR = BODY_COLOR.darker();
|
||||
|
||||
private Capacitance value = new Capacitance(470d, CapacitanceUnit.pF);
|
||||
@Deprecated
|
||||
private Voltage voltage = Voltage._63V;
|
||||
private org.diylc.core.measures.Voltage voltageNew = new org.diylc.core.measures.Voltage(63d,
|
||||
VoltageUnit.V);
|
||||
|
||||
public RadialCeramicDiskCapacitor() {
|
||||
super();
|
||||
@@ -43,6 +47,26 @@ public class RadialCeramicDiskCapacitor extends AbstractLeadedComponent<Capacita
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValueForDisplay() {
|
||||
return getValue().toString() + " " + getVoltageNew().toString();
|
||||
}
|
||||
|
||||
@EditableProperty(name = "Voltage")
|
||||
public org.diylc.core.measures.Voltage getVoltageNew() {
|
||||
// Backward comptibility
|
||||
if (voltageNew == null) {
|
||||
voltageNew = voltage.convertToNewFormat();
|
||||
voltage = null;
|
||||
// Clear old value, don't need it anymore
|
||||
}
|
||||
return voltageNew;
|
||||
}
|
||||
|
||||
public void setVoltageNew(org.diylc.core.measures.Voltage voltageNew) {
|
||||
this.voltageNew = voltageNew;
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
public Voltage getVoltage() {
|
||||
return voltage;
|
||||
|
||||
+5
@@ -58,6 +58,11 @@ public class RadialElectrolytic extends AbstractLeadedComponent<Capacitance> {
|
||||
public void setValue(Capacitance value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValueForDisplay() {
|
||||
return getValue().toString() + " " + getVoltageNew().toString();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Voltage getVoltage() {
|
||||
|
||||
+5
@@ -47,6 +47,11 @@ public class RadialFilmCapacitor extends AbstractLeadedComponent<Capacitance> {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValueForDisplay() {
|
||||
return getValue().toString() + " " + getVoltageNew().toString();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Voltage getVoltage() {
|
||||
return voltage;
|
||||
|
||||
+5
@@ -57,6 +57,11 @@ public class Resistor extends AbstractLeadedComponent<Resistance> {
|
||||
public void setValue(Resistance value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValueForDisplay() {
|
||||
return getValue().toString() + " " + getPowerNew().toString();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Power getPower() {
|
||||
|
||||
+5
@@ -38,6 +38,11 @@ public class ResistorSymbol extends AbstractSchematicLeadedSymbol<Resistance> {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValueForDisplay() {
|
||||
return getValue().toString() + " " + getPowerNew().toString();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Power getPower() {
|
||||
return power;
|
||||
|
||||
Reference in New Issue
Block a user