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:
Binary file not shown.
+3
-3
@@ -7,7 +7,6 @@ import org.diylc.components.AbstractTransparentComponent;
|
|||||||
import org.diylc.core.VisibilityPolicy;
|
import org.diylc.core.VisibilityPolicy;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Resistance;
|
import org.diylc.core.measures.Resistance;
|
||||||
import org.diylc.core.measures.ResistanceUnit;
|
|
||||||
|
|
||||||
public abstract class AbstractPotentiometer extends
|
public abstract class AbstractPotentiometer extends
|
||||||
AbstractTransparentComponent<Resistance> {
|
AbstractTransparentComponent<Resistance> {
|
||||||
@@ -16,7 +15,7 @@ public abstract class AbstractPotentiometer extends
|
|||||||
|
|
||||||
protected Point[] controlPoints;
|
protected Point[] controlPoints;
|
||||||
|
|
||||||
protected Resistance resistance = new Resistance(100d, ResistanceUnit.K);
|
protected Resistance resistance = null;
|
||||||
protected Orientation orientation = Orientation.DEFAULT;
|
protected Orientation orientation = Orientation.DEFAULT;
|
||||||
protected Taper taper = Taper.LIN;
|
protected Taper taper = Taper.LIN;
|
||||||
|
|
||||||
@@ -47,7 +46,8 @@ public abstract class AbstractPotentiometer extends
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getValueForDisplay() {
|
public String getValueForDisplay() {
|
||||||
return resistance.toString() + " " + taper.toString();
|
return (resistance == null ? "" : resistance.toString()) + " "
|
||||||
|
+ taper.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EditableProperty
|
@EditableProperty
|
||||||
|
|||||||
+16
-19
@@ -15,14 +15,13 @@ import org.diylc.core.Theme;
|
|||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Capacitance;
|
import org.diylc.core.measures.Capacitance;
|
||||||
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;
|
|
||||||
import org.diylc.utils.Constants;
|
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)
|
@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;
|
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 MARKER_COLOR = Color.gray;
|
||||||
public static Color TICK_COLOR = Color.white;
|
public static Color TICK_COLOR = Color.white;
|
||||||
|
|
||||||
private Capacitance value = new Capacitance(1d, CapacitanceUnit.uF);
|
private Capacitance value = null;
|
||||||
@Deprecated
|
@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,
|
private org.diylc.core.measures.Voltage voltageNew = null;
|
||||||
VoltageUnit.V);
|
|
||||||
|
|
||||||
private Color markerColor = MARKER_COLOR;
|
private Color markerColor = MARKER_COLOR;
|
||||||
private Color tickColor = TICK_COLOR;
|
private Color tickColor = TICK_COLOR;
|
||||||
@@ -75,12 +73,6 @@ public class AxialElectrolyticCapacitor extends AbstractLeadedComponent<Capacita
|
|||||||
|
|
||||||
@EditableProperty(name = "Voltage")
|
@EditableProperty(name = "Voltage")
|
||||||
public org.diylc.core.measures.Voltage getVoltageNew() {
|
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;
|
return voltageNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,22 +144,27 @@ public class AxialElectrolyticCapacitor extends AbstractLeadedComponent<Capacita
|
|||||||
int markerLength = (int) (getLength().convertToPixels() * 0.2);
|
int markerLength = (int) (getLength().convertToPixels() * 0.2);
|
||||||
if (!outlineMode) {
|
if (!outlineMode) {
|
||||||
g2d.setColor(markerColor);
|
g2d.setColor(markerColor);
|
||||||
g2d.fillRect((int) getLength().convertToPixels() - markerLength, 0, markerLength,
|
g2d.fillRect(
|
||||||
width);
|
(int) getLength().convertToPixels() - markerLength, 0,
|
||||||
|
markerLength, width);
|
||||||
}
|
}
|
||||||
Color finalTickColor;
|
Color finalTickColor;
|
||||||
if (outlineMode) {
|
if (outlineMode) {
|
||||||
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(
|
Theme theme = (Theme) ConfigurationManager.getInstance()
|
||||||
IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
.readObject(IPlugInPort.THEME_KEY,
|
||||||
|
Constants.DEFAULT_THEME);
|
||||||
finalTickColor = theme.getOutlineColor();
|
finalTickColor = theme.getOutlineColor();
|
||||||
} else {
|
} else {
|
||||||
finalTickColor = tickColor;
|
finalTickColor = tickColor;
|
||||||
}
|
}
|
||||||
g2d.setColor(finalTickColor);
|
g2d.setColor(finalTickColor);
|
||||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(2));
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(2));
|
||||||
g2d.drawLine((int) getLength().convertToPixels() - markerLength / 2,
|
g2d.drawLine(
|
||||||
(int) (width / 2 - width * 0.15), (int) getLength().convertToPixels()
|
(int) getLength().convertToPixels() - markerLength / 2,
|
||||||
- markerLength / 2, (int) (width / 2 + width * 0.15));
|
(int) (width / 2 - width * 0.15), (int) getLength()
|
||||||
|
.convertToPixels()
|
||||||
|
- markerLength / 2,
|
||||||
|
(int) (width / 2 + width * 0.15));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-11
@@ -11,10 +11,8 @@ import org.diylc.core.IDIYComponent;
|
|||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Capacitance;
|
import org.diylc.core.measures.Capacitance;
|
||||||
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 = "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)
|
@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> {
|
public class AxialFilmCapacitor extends AbstractLeadedComponent<Capacitance> {
|
||||||
@@ -26,11 +24,10 @@ public class AxialFilmCapacitor extends AbstractLeadedComponent<Capacitance> {
|
|||||||
public static Color BODY_COLOR = Color.decode("#FFE303");
|
public static Color BODY_COLOR = Color.decode("#FFE303");
|
||||||
public static Color BORDER_COLOR = BODY_COLOR.darker();
|
public static Color BORDER_COLOR = BODY_COLOR.darker();
|
||||||
|
|
||||||
private Capacitance value = new Capacitance(22d, CapacitanceUnit.nF);
|
private Capacitance value = null;
|
||||||
@Deprecated
|
@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,
|
private org.diylc.core.measures.Voltage voltageNew = null;
|
||||||
VoltageUnit.V);
|
|
||||||
|
|
||||||
public AxialFilmCapacitor() {
|
public AxialFilmCapacitor() {
|
||||||
super();
|
super();
|
||||||
@@ -69,12 +66,6 @@ public class AxialFilmCapacitor extends AbstractLeadedComponent<Capacitance> {
|
|||||||
|
|
||||||
@EditableProperty(name = "Voltage")
|
@EditableProperty(name = "Voltage")
|
||||||
public org.diylc.core.measures.Voltage getVoltageNew() {
|
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;
|
return voltageNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-11
@@ -10,10 +10,8 @@ import org.diylc.core.IDIYComponent;
|
|||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Capacitance;
|
import org.diylc.core.measures.Capacitance;
|
||||||
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 = "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)
|
@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> {
|
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_LENGTH = new Size(0.05, SizeUnit.in);
|
||||||
public static Size DEFAULT_WIDTH = new Size(0.15, 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
|
@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,
|
private org.diylc.core.measures.Voltage voltageNew = null;
|
||||||
VoltageUnit.V);
|
|
||||||
private boolean polarized = false;
|
private boolean polarized = false;
|
||||||
|
|
||||||
@EditableProperty
|
@EditableProperty
|
||||||
@@ -56,12 +53,6 @@ public class CapacitorSymbol extends AbstractSchematicLeadedSymbol<Capacitance>
|
|||||||
|
|
||||||
@EditableProperty(name = "Voltage")
|
@EditableProperty(name = "Voltage")
|
||||||
public org.diylc.core.measures.Voltage getVoltageNew() {
|
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;
|
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.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Capacitance;
|
import org.diylc.core.measures.Capacitance;
|
||||||
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 AbstractRadialComponent<Capacitance> {
|
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 BODY_COLOR = Color.decode("#F0E68C");
|
||||||
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 = null;
|
||||||
@Deprecated
|
@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,
|
private org.diylc.core.measures.Voltage voltageNew = null;
|
||||||
VoltageUnit.V);
|
|
||||||
|
|
||||||
public RadialCeramicDiskCapacitor() {
|
public RadialCeramicDiskCapacitor() {
|
||||||
super();
|
super();
|
||||||
@@ -54,12 +51,6 @@ public class RadialCeramicDiskCapacitor extends AbstractRadialComponent<Capacita
|
|||||||
|
|
||||||
@EditableProperty(name = "Voltage")
|
@EditableProperty(name = "Voltage")
|
||||||
public org.diylc.core.measures.Voltage getVoltageNew() {
|
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;
|
return voltageNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-11
@@ -18,10 +18,8 @@ import org.diylc.core.Theme;
|
|||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Capacitance;
|
import org.diylc.core.measures.Capacitance;
|
||||||
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;
|
|
||||||
import org.diylc.utils.Constants;
|
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)
|
@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 HEIGHT = new Size(0.4d, SizeUnit.in);
|
||||||
public static Size EDGE_RADIUS = new Size(1d, SizeUnit.mm);
|
public static Size EDGE_RADIUS = new Size(1d, SizeUnit.mm);
|
||||||
|
|
||||||
private Capacitance value = new Capacitance(1d, CapacitanceUnit.uF);
|
private Capacitance value = null;
|
||||||
@Deprecated
|
@Deprecated
|
||||||
private Voltage voltage = Voltage._63V;
|
private Voltage voltage = Voltage._63V;
|
||||||
private org.diylc.core.measures.Voltage voltageNew = new org.diylc.core.measures.Voltage(
|
private org.diylc.core.measures.Voltage voltageNew = null;
|
||||||
63d, VoltageUnit.V);
|
|
||||||
|
|
||||||
private Color markerColor = MARKER_COLOR;
|
private Color markerColor = MARKER_COLOR;
|
||||||
private Color tickColor = TICK_COLOR;
|
private Color tickColor = TICK_COLOR;
|
||||||
@@ -82,12 +79,6 @@ public class RadialElectrolytic extends AbstractRadialComponent<Capacitance> {
|
|||||||
|
|
||||||
@EditableProperty(name = "Voltage")
|
@EditableProperty(name = "Voltage")
|
||||||
public org.diylc.core.measures.Voltage getVoltageNew() {
|
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;
|
return voltageNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-11
@@ -11,10 +11,8 @@ import org.diylc.core.IDIYComponent;
|
|||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.Capacitance;
|
import org.diylc.core.measures.Capacitance;
|
||||||
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 = "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)
|
@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> {
|
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 BODY_COLOR = Color.decode("#FF8000");
|
||||||
public static Color BORDER_COLOR = BODY_COLOR.darker();
|
public static Color BORDER_COLOR = BODY_COLOR.darker();
|
||||||
|
|
||||||
private Capacitance value = new Capacitance(123d, CapacitanceUnit.nF);
|
private Capacitance value = null;
|
||||||
@Deprecated
|
@Deprecated
|
||||||
private Voltage voltage = Voltage._63V;
|
private Voltage voltage = Voltage._63V;
|
||||||
private org.diylc.core.measures.Voltage voltageNew = new org.diylc.core.measures.Voltage(
|
private org.diylc.core.measures.Voltage voltageNew = null;
|
||||||
63d, VoltageUnit.V);
|
|
||||||
|
|
||||||
public RadialFilmCapacitor() {
|
public RadialFilmCapacitor() {
|
||||||
super();
|
super();
|
||||||
@@ -64,12 +61,6 @@ public class RadialFilmCapacitor extends AbstractRadialComponent<Capacitance> {
|
|||||||
|
|
||||||
@EditableProperty(name = "Voltage")
|
@EditableProperty(name = "Voltage")
|
||||||
public org.diylc.core.measures.Voltage getVoltageNew() {
|
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;
|
return voltageNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-13
@@ -13,13 +13,11 @@ import org.diylc.core.IDIYComponent;
|
|||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
import org.diylc.core.annotations.EditableProperty;
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
import org.diylc.core.annotations.PositiveMeasureValidator;
|
import org.diylc.core.annotations.PositiveMeasureValidator;
|
||||||
import org.diylc.core.measures.PowerUnit;
|
|
||||||
import org.diylc.core.measures.Resistance;
|
import org.diylc.core.measures.Resistance;
|
||||||
import org.diylc.core.measures.ResistanceUnit;
|
|
||||||
import org.diylc.core.measures.Size;
|
import org.diylc.core.measures.Size;
|
||||||
import org.diylc.core.measures.SizeUnit;
|
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> {
|
public class Resistor extends AbstractLeadedComponent<Resistance> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
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 BAND_SPACING = 5;
|
||||||
public static int FIRST_BAND = 4;
|
public static int FIRST_BAND = 4;
|
||||||
|
|
||||||
private Resistance value = new Resistance(100d, ResistanceUnit.K);
|
private Resistance value = null;
|
||||||
@Deprecated
|
@Deprecated
|
||||||
private Power power = Power.HALF;
|
private Power power = Power.HALF;
|
||||||
private org.diylc.core.measures.Power powerNew = new org.diylc.core.measures.Power(0.5,
|
private org.diylc.core.measures.Power powerNew = null;
|
||||||
PowerUnit.W);
|
|
||||||
private ResistorColorCode colorCode = ResistorColorCode._5_BAND;
|
private ResistorColorCode colorCode = ResistorColorCode._5_BAND;
|
||||||
|
|
||||||
public Resistor() {
|
public Resistor() {
|
||||||
@@ -75,12 +72,6 @@ public class Resistor extends AbstractLeadedComponent<Resistance> {
|
|||||||
|
|
||||||
@EditableProperty(name = "Power rating")
|
@EditableProperty(name = "Power rating")
|
||||||
public org.diylc.core.measures.Power getPowerNew() {
|
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;
|
return powerNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +123,7 @@ public class Resistor extends AbstractLeadedComponent<Resistance> {
|
|||||||
@Override
|
@Override
|
||||||
protected void decorateComponentBody(Graphics2D g2d, boolean outlineMode) {
|
protected void decorateComponentBody(Graphics2D g2d, boolean outlineMode) {
|
||||||
// int width = getWidth().convertToPixels();
|
// int width = getWidth().convertToPixels();
|
||||||
if (colorCode == ResistorColorCode.NONE || outlineMode) {
|
if (colorCode == ResistorColorCode.NONE || outlineMode || value == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int height = getClosestOdd(getWidth().convertToPixels());
|
int height = getClosestOdd(getWidth().convertToPixels());
|
||||||
@@ -148,6 +139,8 @@ public class Resistor extends AbstractLeadedComponent<Resistance> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLabelOffset(int bodyWidth, int labelWidth) {
|
protected int getLabelOffset(int bodyWidth, int labelWidth) {
|
||||||
|
if (value == null)
|
||||||
|
return 0;
|
||||||
Color[] bands = value.getColorCode(colorCode);
|
Color[] bands = value.getColorCode(colorCode);
|
||||||
int bandArea = FIRST_BAND + BAND_SPACING * (bands.length - 1);
|
int bandArea = FIRST_BAND + BAND_SPACING * (bands.length - 1);
|
||||||
// Only offset the label if overlaping with the band area.
|
// 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.annotations.EditableProperty;
|
||||||
import org.diylc.core.measures.PowerUnit;
|
import org.diylc.core.measures.PowerUnit;
|
||||||
import org.diylc.core.measures.Resistance;
|
import org.diylc.core.measures.Resistance;
|
||||||
import org.diylc.core.measures.ResistanceUnit;
|
|
||||||
import org.diylc.core.measures.Size;
|
import org.diylc.core.measures.Size;
|
||||||
import org.diylc.core.measures.SizeUnit;
|
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_LENGTH = new Size(0.3, SizeUnit.in);
|
||||||
public static Size DEFAULT_WIDTH = new Size(0.08, 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
|
@Deprecated
|
||||||
private Power power = Power.HALF;
|
private Power power = Power.HALF;
|
||||||
private org.diylc.core.measures.Power powerNew = new org.diylc.core.measures.Power(0.5,
|
private org.diylc.core.measures.Power powerNew = new org.diylc.core.measures.Power(0.5,
|
||||||
|
|||||||
Reference in New Issue
Block a user