mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
Added MOSFET Symbol
This commit is contained in:
-12
@@ -29,7 +29,6 @@ public abstract class AbstractTransistorSymbol extends AbstractComponent<String>
|
|||||||
public static Size PIN_SPACING = new Size(0.1d, SizeUnit.in);
|
public static Size PIN_SPACING = new Size(0.1d, SizeUnit.in);
|
||||||
public static Color COLOR = Color.black;
|
public static Color COLOR = Color.black;
|
||||||
|
|
||||||
protected TransistorPolarity polarity = TransistorPolarity.NPN;
|
|
||||||
protected String value = "";
|
protected String value = "";
|
||||||
protected Point[] controlPoints = new Point[] { new Point(0, 0), new Point(0, 0),
|
protected Point[] controlPoints = new Point[] { new Point(0, 0), new Point(0, 0),
|
||||||
new Point(0, 0) };
|
new Point(0, 0) };
|
||||||
@@ -146,17 +145,6 @@ public abstract class AbstractTransistorSymbol extends AbstractComponent<String>
|
|||||||
body = null;
|
body = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EditableProperty
|
|
||||||
public TransistorPolarity getPolarity() {
|
|
||||||
return polarity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPolarity(TransistorPolarity polarity) {
|
|
||||||
this.polarity = polarity;
|
|
||||||
// Invalidate body
|
|
||||||
body = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EditableProperty
|
@EditableProperty
|
||||||
public Color getColor() {
|
public Color getColor() {
|
||||||
return color;
|
return color;
|
||||||
|
|||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
package org.diylc.components.semiconductors;
|
||||||
|
|
||||||
|
public enum FETPolarity {
|
||||||
|
|
||||||
|
NEGATIVE("Negative"), POSITIVE("Positive");
|
||||||
|
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
private FETPolarity(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
}
|
||||||
+15
-1
@@ -8,12 +8,15 @@ import java.awt.geom.GeneralPath;
|
|||||||
import org.diylc.common.ObjectCache;
|
import org.diylc.common.ObjectCache;
|
||||||
import org.diylc.core.IDIYComponent;
|
import org.diylc.core.IDIYComponent;
|
||||||
import org.diylc.core.annotations.ComponentDescriptor;
|
import org.diylc.core.annotations.ComponentDescriptor;
|
||||||
|
import org.diylc.core.annotations.EditableProperty;
|
||||||
|
|
||||||
@ComponentDescriptor(name = "MOSFET Symbol", author = "Branislav Stojkovic", category = "Semiconductors", instanceNamePrefix = "Q", description = "BJT NPN and PNP transistor", stretchable = false, zOrder = IDIYComponent.COMPONENT)
|
@ComponentDescriptor(name = "MOSFET Symbol", author = "Branislav Stojkovic", category = "Semiconductors", instanceNamePrefix = "Q", description = "BJT NPN and PNP transistor", stretchable = false, zOrder = IDIYComponent.COMPONENT)
|
||||||
public class MOSFETSymbol extends AbstractTransistorSymbol {
|
public class MOSFETSymbol extends AbstractTransistorSymbol {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
protected FETPolarity polarity = FETPolarity.NEGATIVE;
|
||||||
|
|
||||||
public Shape[] getBody() {
|
public Shape[] getBody() {
|
||||||
if (body == null) {
|
if (body == null) {
|
||||||
body = new Shape[3];
|
body = new Shape[3];
|
||||||
@@ -44,7 +47,7 @@ public class MOSFETSymbol extends AbstractTransistorSymbol {
|
|||||||
body[1] = polyline;
|
body[1] = polyline;
|
||||||
|
|
||||||
Polygon arrow;
|
Polygon arrow;
|
||||||
if (polarity == TransistorPolarity.PNP) {
|
if (polarity == FETPolarity.NEGATIVE) {
|
||||||
arrow = new Polygon(new int[] { x + pinSpacing * 8 / 6, x + pinSpacing * 8 / 6,
|
arrow = new Polygon(new int[] { x + pinSpacing * 8 / 6, x + pinSpacing * 8 / 6,
|
||||||
x + pinSpacing * 12 / 6 }, new int[] { y + pinSpacing * 6 / 5,
|
x + pinSpacing * 12 / 6 }, new int[] { y + pinSpacing * 6 / 5,
|
||||||
y + pinSpacing * 4 / 5, y + pinSpacing }, 3);
|
y + pinSpacing * 4 / 5, y + pinSpacing }, 3);
|
||||||
@@ -72,4 +75,15 @@ public class MOSFETSymbol extends AbstractTransistorSymbol {
|
|||||||
g2d.drawLine(width * 4 / 5, height - 1, width * 4 / 5, height * 3 / 4);
|
g2d.drawLine(width * 4 / 5, height - 1, width * 4 / 5, height * 3 / 4);
|
||||||
g2d.drawLine(width * 4 / 5, height * 3 / 4, width * 3 / 5, height * 3 / 4);
|
g2d.drawLine(width * 4 / 5, height * 3 / 4, width * 3 / 5, height * 3 / 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EditableProperty
|
||||||
|
public FETPolarity getPolarity() {
|
||||||
|
return polarity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPolarity(FETPolarity polarity) {
|
||||||
|
this.polarity = polarity;
|
||||||
|
// Invalidate body
|
||||||
|
body = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
package org.diylc.components.semiconductors;
|
|
||||||
|
|
||||||
public enum TransistorPolarity {
|
|
||||||
|
|
||||||
NPN, PNP,
|
|
||||||
}
|
|
||||||
Binary file not shown.
Reference in New Issue
Block a user