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;
|
import org.diylc.core.measures.ResistanceUnit;
|
||||||
|
|
||||||
public abstract class AbstractPotentiometer extends
|
public abstract class AbstractPotentiometer extends
|
||||||
AbstractTransparentComponent<PotentiometerValue> {
|
AbstractTransparentComponent<Resistance> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@@ -44,25 +44,21 @@ public abstract class AbstractPotentiometer extends
|
|||||||
public boolean isControlPointSticky(int index) {
|
public boolean isControlPointSticky(int index) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getValueForDisplay() {
|
||||||
|
return resistance.toString() + " " + taper.toString();
|
||||||
|
}
|
||||||
|
|
||||||
@EditableProperty
|
@EditableProperty
|
||||||
public Resistance getResistance() {
|
@Override
|
||||||
|
public Resistance getValue() {
|
||||||
return resistance;
|
return resistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setResistance(Resistance resistance) {
|
|
||||||
this.resistance = resistance;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PotentiometerValue getValue() {
|
public void setValue(Resistance value) {
|
||||||
return new PotentiometerValue(resistance, taper);
|
this.resistance = value;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setValue(PotentiometerValue value) {
|
|
||||||
this.resistance = value.getResistance();
|
|
||||||
this.taper = value.getTaper();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EditableProperty
|
@EditableProperty
|
||||||
|
|||||||
+5
@@ -57,6 +57,11 @@ public class AxialElectrolyticCapacitor extends AbstractLeadedComponent<Capacita
|
|||||||
public void setValue(Capacitance value) {
|
public void setValue(Capacitance value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getValueForDisplay() {
|
||||||
|
return getValue().toString() + " " + getVoltageNew().toString();
|
||||||
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public Voltage getVoltage() {
|
public Voltage getVoltage() {
|
||||||
|
|||||||
+5
@@ -61,6 +61,11 @@ public class AxialFilmCapacitor extends AbstractLeadedComponent<Capacitance> {
|
|||||||
public void setVoltage(Voltage voltage) {
|
public void setVoltage(Voltage voltage) {
|
||||||
this.voltage = voltage;
|
this.voltage = voltage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getValueForDisplay() {
|
||||||
|
return getValue().toString() + " " + getVoltageNew().toString();
|
||||||
|
}
|
||||||
|
|
||||||
@EditableProperty(name = "Voltage")
|
@EditableProperty(name = "Voltage")
|
||||||
public org.diylc.core.measures.Voltage getVoltageNew() {
|
public org.diylc.core.measures.Voltage getVoltageNew() {
|
||||||
|
|||||||
+5
@@ -38,6 +38,11 @@ public class CapacitorSymbol extends AbstractSchematicLeadedSymbol<Capacitance>
|
|||||||
public void setValue(Capacitance value) {
|
public void setValue(Capacitance value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getValueForDisplay() {
|
||||||
|
return getValue().toString() + " " + getVoltageNew().toString();
|
||||||
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public Voltage getVoltage() {
|
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));
|
g2d.drawString(getName(), (int) (bodyRect.getX() + x), (int) (bodyRect.getY() + y));
|
||||||
|
|
||||||
// Draw value.
|
// Draw value.
|
||||||
rect = fontMetrics.getStringBounds(getValue().toString(), g2d);
|
rect = fontMetrics.getStringBounds(getValueForDisplay(), g2d);
|
||||||
|
|
||||||
textHeight = (int) rect.getHeight();
|
textHeight = (int) rect.getHeight();
|
||||||
textWidth = (int) rect.getWidth();
|
textWidth = (int) rect.getWidth();
|
||||||
@@ -205,7 +205,7 @@ public class PotentiometerPanel extends AbstractPotentiometer {
|
|||||||
x = (panelWidth - textWidth) / 2;
|
x = (panelWidth - textWidth) / 2;
|
||||||
y = panelHeight / 2 + fontMetrics.getAscent();
|
y = panelHeight / 2 + fontMetrics.getAscent();
|
||||||
|
|
||||||
g2d.drawString(getValue().toString(), (int) (bodyRect.getX() + x),
|
g2d.drawString(getValueForDisplay(), (int) (bodyRect.getX() + x),
|
||||||
(int) (bodyRect.getY() + y));
|
(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.CapacitanceUnit;
|
||||||
import org.diylc.core.measures.Size;
|
import org.diylc.core.measures.Size;
|
||||||
import org.diylc.core.measures.SizeUnit;
|
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)
|
@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> {
|
public class RadialCeramicDiskCapacitor extends AbstractLeadedComponent<Capacitance> {
|
||||||
@@ -26,7 +27,10 @@ public class RadialCeramicDiskCapacitor extends AbstractLeadedComponent<Capacita
|
|||||||
public static Color BORDER_COLOR = BODY_COLOR.darker();
|
public static Color BORDER_COLOR = BODY_COLOR.darker();
|
||||||
|
|
||||||
private Capacitance value = new Capacitance(470d, CapacitanceUnit.pF);
|
private Capacitance value = new Capacitance(470d, CapacitanceUnit.pF);
|
||||||
|
@Deprecated
|
||||||
private Voltage voltage = Voltage._63V;
|
private Voltage voltage = Voltage._63V;
|
||||||
|
private org.diylc.core.measures.Voltage voltageNew = new org.diylc.core.measures.Voltage(63d,
|
||||||
|
VoltageUnit.V);
|
||||||
|
|
||||||
public RadialCeramicDiskCapacitor() {
|
public RadialCeramicDiskCapacitor() {
|
||||||
super();
|
super();
|
||||||
@@ -43,6 +47,26 @@ public class RadialCeramicDiskCapacitor extends AbstractLeadedComponent<Capacita
|
|||||||
this.value = value;
|
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
|
@EditableProperty
|
||||||
public Voltage getVoltage() {
|
public Voltage getVoltage() {
|
||||||
return voltage;
|
return voltage;
|
||||||
|
|||||||
+5
@@ -58,6 +58,11 @@ public class RadialElectrolytic extends AbstractLeadedComponent<Capacitance> {
|
|||||||
public void setValue(Capacitance value) {
|
public void setValue(Capacitance value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getValueForDisplay() {
|
||||||
|
return getValue().toString() + " " + getVoltageNew().toString();
|
||||||
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public Voltage getVoltage() {
|
public Voltage getVoltage() {
|
||||||
|
|||||||
+5
@@ -47,6 +47,11 @@ public class RadialFilmCapacitor extends AbstractLeadedComponent<Capacitance> {
|
|||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getValueForDisplay() {
|
||||||
|
return getValue().toString() + " " + getVoltageNew().toString();
|
||||||
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public Voltage getVoltage() {
|
public Voltage getVoltage() {
|
||||||
return voltage;
|
return voltage;
|
||||||
|
|||||||
+5
@@ -57,6 +57,11 @@ public class Resistor extends AbstractLeadedComponent<Resistance> {
|
|||||||
public void setValue(Resistance value) {
|
public void setValue(Resistance value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getValueForDisplay() {
|
||||||
|
return getValue().toString() + " " + getPowerNew().toString();
|
||||||
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public Power getPower() {
|
public Power getPower() {
|
||||||
|
|||||||
+5
@@ -38,6 +38,11 @@ public class ResistorSymbol extends AbstractSchematicLeadedSymbol<Resistance> {
|
|||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getValueForDisplay() {
|
||||||
|
return getValue().toString() + " " + getPowerNew().toString();
|
||||||
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public Power getPower() {
|
public Power getPower() {
|
||||||
return power;
|
return power;
|
||||||
|
|||||||
Reference in New Issue
Block a user