mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
inductor symbol
allow empty values
This commit is contained in:
+4
-4
@@ -7,7 +7,6 @@ import org.diylc.components.AbstractTransparentComponent;
|
||||
import org.diylc.core.VisibilityPolicy;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.measures.Resistance;
|
||||
import org.diylc.core.measures.ResistanceUnit;
|
||||
|
||||
public abstract class AbstractPotentiometer extends
|
||||
AbstractTransparentComponent<Resistance> {
|
||||
@@ -16,7 +15,7 @@ public abstract class AbstractPotentiometer extends
|
||||
|
||||
protected Point[] controlPoints;
|
||||
|
||||
protected Resistance resistance = new Resistance(100d, ResistanceUnit.K);
|
||||
protected Resistance resistance = null;
|
||||
protected Orientation orientation = Orientation.DEFAULT;
|
||||
protected Taper taper = Taper.LIN;
|
||||
|
||||
@@ -44,10 +43,11 @@ public abstract class AbstractPotentiometer extends
|
||||
public boolean isControlPointSticky(int index) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getValueForDisplay() {
|
||||
return resistance.toString() + " " + taper.toString();
|
||||
return (resistance == null ? "" : resistance.toString()) + " "
|
||||
+ taper.toString();
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
|
||||
+18
-21
@@ -15,14 +15,13 @@ import org.diylc.core.Theme;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
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;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
@ComponentDescriptor(name = "Electrolytic Capacitor (axial)", author = "Branislav Stojkovic", category = "Passive", creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "C", description = "Axial electrolytic capacitor, similar to Sprague Atom, F&T, etc", zOrder = IDIYComponent.COMPONENT)
|
||||
public class AxialElectrolyticCapacitor extends AbstractLeadedComponent<Capacitance> {
|
||||
public class AxialElectrolyticCapacitor extends
|
||||
AbstractLeadedComponent<Capacitance> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -33,11 +32,10 @@ public class AxialElectrolyticCapacitor extends AbstractLeadedComponent<Capacita
|
||||
public static Color MARKER_COLOR = Color.gray;
|
||||
public static Color TICK_COLOR = Color.white;
|
||||
|
||||
private Capacitance value = new Capacitance(1d, CapacitanceUnit.uF);
|
||||
private Capacitance value = null;
|
||||
@Deprecated
|
||||
private Voltage voltage = Voltage._63V;
|
||||
private org.diylc.core.measures.Voltage voltageNew = new org.diylc.core.measures.Voltage(63d,
|
||||
VoltageUnit.V);
|
||||
private org.diylc.core.measures.Voltage voltageNew = null;
|
||||
|
||||
private Color markerColor = MARKER_COLOR;
|
||||
private Color tickColor = TICK_COLOR;
|
||||
@@ -57,7 +55,7 @@ public class AxialElectrolyticCapacitor extends AbstractLeadedComponent<Capacita
|
||||
public void setValue(Capacitance value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getValueForDisplay() {
|
||||
return getValue().toString() + " " + getVoltageNew().toString();
|
||||
@@ -72,15 +70,9 @@ public class AxialElectrolyticCapacitor extends AbstractLeadedComponent<Capacita
|
||||
public void setVoltage(Voltage voltage) {
|
||||
this.voltage = voltage;
|
||||
}
|
||||
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
@@ -152,22 +144,27 @@ public class AxialElectrolyticCapacitor extends AbstractLeadedComponent<Capacita
|
||||
int markerLength = (int) (getLength().convertToPixels() * 0.2);
|
||||
if (!outlineMode) {
|
||||
g2d.setColor(markerColor);
|
||||
g2d.fillRect((int) getLength().convertToPixels() - markerLength, 0, markerLength,
|
||||
width);
|
||||
g2d.fillRect(
|
||||
(int) getLength().convertToPixels() - markerLength, 0,
|
||||
markerLength, width);
|
||||
}
|
||||
Color finalTickColor;
|
||||
if (outlineMode) {
|
||||
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(
|
||||
IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||
Theme theme = (Theme) ConfigurationManager.getInstance()
|
||||
.readObject(IPlugInPort.THEME_KEY,
|
||||
Constants.DEFAULT_THEME);
|
||||
finalTickColor = theme.getOutlineColor();
|
||||
} else {
|
||||
finalTickColor = tickColor;
|
||||
}
|
||||
g2d.setColor(finalTickColor);
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(2));
|
||||
g2d.drawLine((int) getLength().convertToPixels() - markerLength / 2,
|
||||
(int) (width / 2 - width * 0.15), (int) getLength().convertToPixels()
|
||||
- markerLength / 2, (int) (width / 2 + width * 0.15));
|
||||
g2d.drawLine(
|
||||
(int) getLength().convertToPixels() - markerLength / 2,
|
||||
(int) (width / 2 - width * 0.15), (int) getLength()
|
||||
.convertToPixels()
|
||||
- markerLength / 2,
|
||||
(int) (width / 2 + width * 0.15));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-14
@@ -11,10 +11,8 @@ import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
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 = "Film Capacitor (axial)", author = "Branislav Stojkovic", category = "Passive", creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "C", description = "Axial film capacitor, similar to Mallory 150s", zOrder = IDIYComponent.COMPONENT)
|
||||
public class AxialFilmCapacitor extends AbstractLeadedComponent<Capacitance> {
|
||||
@@ -26,18 +24,17 @@ public class AxialFilmCapacitor extends AbstractLeadedComponent<Capacitance> {
|
||||
public static Color BODY_COLOR = Color.decode("#FFE303");
|
||||
public static Color BORDER_COLOR = BODY_COLOR.darker();
|
||||
|
||||
private Capacitance value = new Capacitance(22d, CapacitanceUnit.nF);
|
||||
private Capacitance value = null;
|
||||
@Deprecated
|
||||
private Voltage voltage = Voltage._63V;
|
||||
private org.diylc.core.measures.Voltage voltageNew = new org.diylc.core.measures.Voltage(63d,
|
||||
VoltageUnit.V);
|
||||
private org.diylc.core.measures.Voltage voltageNew = null;
|
||||
|
||||
public AxialFilmCapacitor() {
|
||||
super();
|
||||
this.bodyColor = BODY_COLOR;
|
||||
this.borderColor = BORDER_COLOR;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected boolean supportsStandingMode() {
|
||||
return true;
|
||||
@@ -51,7 +48,7 @@ public class AxialFilmCapacitor extends AbstractLeadedComponent<Capacitance> {
|
||||
public void setValue(Capacitance value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
@Deprecated
|
||||
public Voltage getVoltage() {
|
||||
return voltage;
|
||||
@@ -61,7 +58,7 @@ public class AxialFilmCapacitor extends AbstractLeadedComponent<Capacitance> {
|
||||
public void setVoltage(Voltage voltage) {
|
||||
this.voltage = voltage;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getValueForDisplay() {
|
||||
return getValue().toString() + " " + getVoltageNew().toString();
|
||||
@@ -69,12 +66,6 @@ public class AxialFilmCapacitor extends AbstractLeadedComponent<Capacitance> {
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
|
||||
+3
-12
@@ -10,10 +10,8 @@ import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
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 = "Capacitor (schematic symbol)", author = "Branislav Stojkovic", category = "Passive", creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "C", description = "Capacitor schematic symbol with an optional polarity sign", zOrder = IDIYComponent.COMPONENT)
|
||||
public class CapacitorSymbol extends AbstractSchematicLeadedSymbol<Capacitance> {
|
||||
@@ -23,11 +21,10 @@ public class CapacitorSymbol extends AbstractSchematicLeadedSymbol<Capacitance>
|
||||
public static Size DEFAULT_LENGTH = new Size(0.05, SizeUnit.in);
|
||||
public static Size DEFAULT_WIDTH = new Size(0.15, SizeUnit.in);
|
||||
|
||||
private Capacitance value = new Capacitance(22d, CapacitanceUnit.nF);
|
||||
private Capacitance value = null;
|
||||
@Deprecated
|
||||
private Voltage voltage = Voltage._63V;
|
||||
private org.diylc.core.measures.Voltage voltageNew = new org.diylc.core.measures.Voltage(63d,
|
||||
VoltageUnit.V);
|
||||
private org.diylc.core.measures.Voltage voltageNew = null;
|
||||
private boolean polarized = false;
|
||||
|
||||
@EditableProperty
|
||||
@@ -38,7 +35,7 @@ public class CapacitorSymbol extends AbstractSchematicLeadedSymbol<Capacitance>
|
||||
public void setValue(Capacitance value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getValueForDisplay() {
|
||||
return getValue().toString() + " " + getVoltageNew().toString();
|
||||
@@ -56,12 +53,6 @@ public class CapacitorSymbol extends AbstractSchematicLeadedSymbol<Capacitance>
|
||||
|
||||
@EditableProperty(name = "Voltage")
|
||||
public org.diylc.core.measures.Voltage getVoltageNew() {
|
||||
// Backward compatibility
|
||||
if (voltageNew == null) {
|
||||
voltageNew = voltage.convertToNewFormat();
|
||||
voltage = null;
|
||||
// Clear old value, don't need it anymore
|
||||
}
|
||||
return voltageNew;
|
||||
}
|
||||
|
||||
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
package org.diylc.components.passive;
|
||||
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Shape;
|
||||
import java.awt.geom.GeneralPath;
|
||||
|
||||
import org.diylc.components.AbstractSchematicLeadedSymbol;
|
||||
import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.measures.Current;
|
||||
import org.diylc.core.measures.Inductance;
|
||||
import org.diylc.core.measures.Resistance;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@ComponentDescriptor(name = "Inductor (schematic symbol)", author = "Branislav Stojkovic", category = "Passive", creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "L", description = "Inductor schematic symbol", zOrder = IDIYComponent.COMPONENT)
|
||||
public class InductorSymbol extends AbstractSchematicLeadedSymbol<Inductance> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static Size DEFAULT_LENGTH = new Size(0.3, SizeUnit.in);
|
||||
public static Size DEFAULT_WIDTH = new Size(0.08, SizeUnit.in);
|
||||
|
||||
private Inductance value = null;
|
||||
private Current current = null;
|
||||
private Resistance resistance = null;
|
||||
private boolean core = false;
|
||||
|
||||
@EditableProperty
|
||||
public Inductance getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(Inductance value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
public Current getCurrent() {
|
||||
return current;
|
||||
}
|
||||
|
||||
public void setCurrent(Current current) {
|
||||
this.current = current;
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
public Resistance getResistance() {
|
||||
return resistance;
|
||||
}
|
||||
|
||||
public void setResistance(Resistance resistance) {
|
||||
this.resistance = resistance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValueForDisplay() {
|
||||
return getValue().toString() + " " + getCurrent().toString();
|
||||
}
|
||||
|
||||
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||
g2d.rotate(-Math.PI / 4, width / 2, height / 2);
|
||||
g2d.setColor(LEAD_COLOR);
|
||||
g2d.drawLine(0, height / 2, width / 8, height / 2);
|
||||
g2d.drawLine(width * 7 / 8, height / 2, width, height / 2);
|
||||
g2d.setColor(COLOR);
|
||||
|
||||
GeneralPath polyline = new GeneralPath();
|
||||
polyline.moveTo(width / 8, height / 2);
|
||||
polyline.curveTo(width / 8, height / 4, width * 3 / 8, height / 4,
|
||||
width * 3 / 8, height / 2);
|
||||
polyline.curveTo(width * 3 / 8, height / 4, width * 5 / 8, height / 4,
|
||||
width * 5 / 8, height / 2);
|
||||
polyline.curveTo(width * 5 / 8, height / 4, width * 7 / 8, height / 4,
|
||||
width * 7 / 8, height / 2);
|
||||
|
||||
polyline.moveTo(width / 8, height * 6 / 10);
|
||||
polyline.lineTo(width * 7 / 8, height * 6 / 10);
|
||||
polyline.moveTo(width / 8, height * 7 / 10);
|
||||
polyline.lineTo(width * 7 / 8, height * 7 / 10);
|
||||
g2d.draw(polyline);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Size getDefaultWidth() {
|
||||
return DEFAULT_WIDTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Size getDefaultLength() {
|
||||
return DEFAULT_LENGTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Shape getBodyShape() {
|
||||
GeneralPath polyline = new GeneralPath();
|
||||
double length = getLength().convertToPixels();
|
||||
double width = getWidth().convertToPixels();
|
||||
double d = length / 10;
|
||||
polyline.moveTo(0, width / 2);
|
||||
polyline.curveTo(0, 0, 2 * d, 0, 2 * d, width / 2);
|
||||
polyline.curveTo(2 * d, 0, 4 * d, 0, 4 * d, width / 2);
|
||||
polyline.curveTo(4 * d, 0, 6 * d, 0, 6 * d, width / 2);
|
||||
polyline.curveTo(6 * d, 0, 8 * d, 0, 8 * d, width / 2);
|
||||
polyline.curveTo(8 * d, 0, 10 * d, 0, 10 * d, width / 2);
|
||||
if (core) {
|
||||
polyline.moveTo(0, width * 3 / 4);
|
||||
polyline.lineTo(length, width * 3 / 4);
|
||||
polyline.moveTo(0, width * 7 / 8);
|
||||
polyline.lineTo(length, width * 7 / 8);
|
||||
}
|
||||
return polyline;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean useShapeRectAsPosition() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
public boolean getCore() {
|
||||
return core;
|
||||
}
|
||||
|
||||
public void setCore(boolean core) {
|
||||
this.core = core;
|
||||
}
|
||||
}
|
||||
+2
-11
@@ -11,10 +11,8 @@ import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
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 AbstractRadialComponent<Capacitance> {
|
||||
@@ -26,11 +24,10 @@ public class RadialCeramicDiskCapacitor extends AbstractRadialComponent<Capacita
|
||||
public static Color BODY_COLOR = Color.decode("#F0E68C");
|
||||
public static Color BORDER_COLOR = BODY_COLOR.darker();
|
||||
|
||||
private Capacitance value = new Capacitance(470d, CapacitanceUnit.pF);
|
||||
private Capacitance value = null;
|
||||
@Deprecated
|
||||
private Voltage voltage = Voltage._63V;
|
||||
private org.diylc.core.measures.Voltage voltageNew = new org.diylc.core.measures.Voltage(63d,
|
||||
VoltageUnit.V);
|
||||
private org.diylc.core.measures.Voltage voltageNew = null;
|
||||
|
||||
public RadialCeramicDiskCapacitor() {
|
||||
super();
|
||||
@@ -54,12 +51,6 @@ public class RadialCeramicDiskCapacitor extends AbstractRadialComponent<Capacita
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
|
||||
+2
-11
@@ -18,10 +18,8 @@ import org.diylc.core.Theme;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
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;
|
||||
import org.diylc.utils.Constants;
|
||||
|
||||
@ComponentDescriptor(name = "Electrolytic Capacitor", author = "Branislav Stojkovic", category = "Passive", creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "C", description = "Vertical mounted electrolytic capacitor, polarized or bipolar", zOrder = IDIYComponent.COMPONENT)
|
||||
@@ -37,11 +35,10 @@ public class RadialElectrolytic extends AbstractRadialComponent<Capacitance> {
|
||||
public static Size HEIGHT = new Size(0.4d, SizeUnit.in);
|
||||
public static Size EDGE_RADIUS = new Size(1d, SizeUnit.mm);
|
||||
|
||||
private Capacitance value = new Capacitance(1d, CapacitanceUnit.uF);
|
||||
private Capacitance value = null;
|
||||
@Deprecated
|
||||
private Voltage voltage = Voltage._63V;
|
||||
private org.diylc.core.measures.Voltage voltageNew = new org.diylc.core.measures.Voltage(
|
||||
63d, VoltageUnit.V);
|
||||
private org.diylc.core.measures.Voltage voltageNew = null;
|
||||
|
||||
private Color markerColor = MARKER_COLOR;
|
||||
private Color tickColor = TICK_COLOR;
|
||||
@@ -82,12 +79,6 @@ public class RadialElectrolytic extends AbstractRadialComponent<Capacitance> {
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
|
||||
+2
-11
@@ -11,10 +11,8 @@ import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
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 = "Film Capacitor (radial)", author = "Branislav Stojkovic", category = "Passive", creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "C", description = "Radial film capacitor, similar to Sprague Orange Drop", zOrder = IDIYComponent.COMPONENT)
|
||||
public class RadialFilmCapacitor extends AbstractRadialComponent<Capacitance> {
|
||||
@@ -26,11 +24,10 @@ public class RadialFilmCapacitor extends AbstractRadialComponent<Capacitance> {
|
||||
public static Color BODY_COLOR = Color.decode("#FF8000");
|
||||
public static Color BORDER_COLOR = BODY_COLOR.darker();
|
||||
|
||||
private Capacitance value = new Capacitance(123d, CapacitanceUnit.nF);
|
||||
private Capacitance value = null;
|
||||
@Deprecated
|
||||
private Voltage voltage = Voltage._63V;
|
||||
private org.diylc.core.measures.Voltage voltageNew = new org.diylc.core.measures.Voltage(
|
||||
63d, VoltageUnit.V);
|
||||
private org.diylc.core.measures.Voltage voltageNew = null;
|
||||
|
||||
public RadialFilmCapacitor() {
|
||||
super();
|
||||
@@ -64,12 +61,6 @@ public class RadialFilmCapacitor extends AbstractRadialComponent<Capacitance> {
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
|
||||
+7
-14
@@ -13,13 +13,11 @@ import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.annotations.PositiveMeasureValidator;
|
||||
import org.diylc.core.measures.PowerUnit;
|
||||
import org.diylc.core.measures.Resistance;
|
||||
import org.diylc.core.measures.ResistanceUnit;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@ComponentDescriptor(name = "Resistor", author = "Branislav Stojkovic", category = "Passive", creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "R", description = "", zOrder = IDIYComponent.COMPONENT)
|
||||
@ComponentDescriptor(name = "Resistor", author = "Branislav Stojkovic", category = "Passive", creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "R", description = "Resistor layout symbol", zOrder = IDIYComponent.COMPONENT)
|
||||
public class Resistor extends AbstractLeadedComponent<Resistance> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -31,11 +29,10 @@ public class Resistor extends AbstractLeadedComponent<Resistance> {
|
||||
public static int BAND_SPACING = 5;
|
||||
public static int FIRST_BAND = 4;
|
||||
|
||||
private Resistance value = new Resistance(100d, ResistanceUnit.K);
|
||||
private Resistance value = null;
|
||||
@Deprecated
|
||||
private Power power = Power.HALF;
|
||||
private org.diylc.core.measures.Power powerNew = new org.diylc.core.measures.Power(0.5,
|
||||
PowerUnit.W);
|
||||
private org.diylc.core.measures.Power powerNew = null;
|
||||
private ResistorColorCode colorCode = ResistorColorCode._5_BAND;
|
||||
|
||||
public Resistor() {
|
||||
@@ -75,12 +72,6 @@ public class Resistor extends AbstractLeadedComponent<Resistance> {
|
||||
|
||||
@EditableProperty(name = "Power rating")
|
||||
public org.diylc.core.measures.Power getPowerNew() {
|
||||
// Backward compatibility
|
||||
if (powerNew == null) {
|
||||
powerNew = power.convertToNewFormat();
|
||||
// Clear old value, don't need it anymore
|
||||
power = null;
|
||||
}
|
||||
return powerNew;
|
||||
}
|
||||
|
||||
@@ -131,8 +122,8 @@ public class Resistor extends AbstractLeadedComponent<Resistance> {
|
||||
|
||||
@Override
|
||||
protected void decorateComponentBody(Graphics2D g2d, boolean outlineMode) {
|
||||
// int width = getWidth().convertToPixels();
|
||||
if (colorCode == ResistorColorCode.NONE || outlineMode) {
|
||||
// int width = getWidth().convertToPixels();
|
||||
if (colorCode == ResistorColorCode.NONE || outlineMode || value == null) {
|
||||
return;
|
||||
}
|
||||
int height = getClosestOdd(getWidth().convertToPixels());
|
||||
@@ -148,6 +139,8 @@ public class Resistor extends AbstractLeadedComponent<Resistance> {
|
||||
|
||||
@Override
|
||||
protected int getLabelOffset(int bodyWidth, int labelWidth) {
|
||||
if (value == null)
|
||||
return 0;
|
||||
Color[] bands = value.getColorCode(colorCode);
|
||||
int bandArea = FIRST_BAND + BAND_SPACING * (bands.length - 1);
|
||||
// Only offset the label if overlaping with the band area.
|
||||
|
||||
+1
-2
@@ -11,7 +11,6 @@ import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.measures.PowerUnit;
|
||||
import org.diylc.core.measures.Resistance;
|
||||
import org.diylc.core.measures.ResistanceUnit;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@@ -23,7 +22,7 @@ public class ResistorSymbol extends AbstractSchematicLeadedSymbol<Resistance> {
|
||||
public static Size DEFAULT_LENGTH = new Size(0.3, SizeUnit.in);
|
||||
public static Size DEFAULT_WIDTH = new Size(0.08, SizeUnit.in);
|
||||
|
||||
private Resistance value = new Resistance(100d, ResistanceUnit.K);
|
||||
private Resistance value = null;
|
||||
@Deprecated
|
||||
private Power power = Power.HALF;
|
||||
private org.diylc.core.measures.Power powerNew = new org.diylc.core.measures.Power(0.5,
|
||||
|
||||
Reference in New Issue
Block a user