Added MOSFET Symbol

This commit is contained in:
bancika
2012-03-04 22:41:37 +00:00
parent c6cb77f4ef
commit 989e0a03e4
5 changed files with 37 additions and 20 deletions
@@ -29,7 +29,6 @@ public abstract class AbstractTransistorSymbol extends AbstractComponent<String>
public static Size PIN_SPACING = new Size(0.1d, SizeUnit.in);
public static Color COLOR = Color.black;
protected TransistorPolarity polarity = TransistorPolarity.NPN;
protected String value = "";
protected Point[] controlPoints = new Point[] { 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;
}
@EditableProperty
public TransistorPolarity getPolarity() {
return polarity;
}
public void setPolarity(TransistorPolarity polarity) {
this.polarity = polarity;
// Invalidate body
body = null;
}
@EditableProperty
public Color getColor() {
return color;
@@ -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;
}
}
@@ -8,12 +8,15 @@ import java.awt.geom.GeneralPath;
import org.diylc.common.ObjectCache;
import org.diylc.core.IDIYComponent;
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)
public class MOSFETSymbol extends AbstractTransistorSymbol {
private static final long serialVersionUID = 1L;
protected FETPolarity polarity = FETPolarity.NEGATIVE;
public Shape[] getBody() {
if (body == null) {
body = new Shape[3];
@@ -44,7 +47,7 @@ public class MOSFETSymbol extends AbstractTransistorSymbol {
body[1] = polyline;
Polygon arrow;
if (polarity == TransistorPolarity.PNP) {
if (polarity == FETPolarity.NEGATIVE) {
arrow = new Polygon(new int[] { x + pinSpacing * 8 / 6, x + pinSpacing * 8 / 6,
x + pinSpacing * 12 / 6 }, new int[] { y + pinSpacing * 6 / 5,
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 * 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;
}
}
@@ -1,6 +0,0 @@
package org.diylc.components.semiconductors;
public enum TransistorPolarity {
NPN, PNP,
}