mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-12 02:02:16 +10:00
Added JFET Symbol
This commit is contained in:
+1
-1
@@ -15,7 +15,7 @@ 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 (schematic symbol)", author = "Branislav Stojkovic", category = "Passive", creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "R", description = "", zOrder = IDIYComponent.COMPONENT)
|
@ComponentDescriptor(name = "Resistor (schematic symbol)", author = "Branislav Stojkovic", category = "Passive", creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "R", description = "Resistor schematic symbol", zOrder = IDIYComponent.COMPONENT)
|
||||||
public class ResistorSymbol extends AbstractSchematicLeadedSymbol<Resistance> {
|
public class ResistorSymbol extends AbstractSchematicLeadedSymbol<Resistance> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
+88
@@ -0,0 +1,88 @@
|
|||||||
|
package org.diylc.components.semiconductors;
|
||||||
|
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Polygon;
|
||||||
|
import java.awt.Shape;
|
||||||
|
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 = "JFET Symbol", author = "Branislav Stojkovic", category = "Semiconductors", instanceNamePrefix = "Q", description = "JFET transistor schematic symbol", stretchable = false, zOrder = IDIYComponent.COMPONENT)
|
||||||
|
public class JFETSymbol extends AbstractTransistorSymbol {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
protected FETPolarity polarity = FETPolarity.NEGATIVE;
|
||||||
|
|
||||||
|
public Shape[] getBody() {
|
||||||
|
if (body == null) {
|
||||||
|
body = new Shape[3];
|
||||||
|
int x = controlPoints[0].x;
|
||||||
|
int y = controlPoints[0].y;
|
||||||
|
int pinSpacing = (int) PIN_SPACING.convertToPixels();
|
||||||
|
|
||||||
|
GeneralPath polyline = new GeneralPath();
|
||||||
|
|
||||||
|
polyline.moveTo(x + pinSpacing, y - pinSpacing);
|
||||||
|
polyline.lineTo(x + pinSpacing, y + pinSpacing);
|
||||||
|
|
||||||
|
body[0] = polyline;
|
||||||
|
|
||||||
|
polyline = new GeneralPath();
|
||||||
|
|
||||||
|
polyline.moveTo(x, y);
|
||||||
|
polyline.lineTo(x + pinSpacing, y);
|
||||||
|
polyline.moveTo(x + pinSpacing, y - pinSpacing * 7 / 8);
|
||||||
|
polyline.lineTo(x + pinSpacing * 2, y - pinSpacing * 7 / 8);
|
||||||
|
polyline.lineTo(x + pinSpacing * 2, y - pinSpacing * 2);
|
||||||
|
polyline.moveTo(x + pinSpacing, y + pinSpacing * 7 / 8);
|
||||||
|
polyline.lineTo(x + pinSpacing * 2, y + pinSpacing * 7 / 8);
|
||||||
|
polyline.lineTo(x + pinSpacing * 2, y + pinSpacing * 2);
|
||||||
|
body[1] = polyline;
|
||||||
|
|
||||||
|
Polygon arrow;
|
||||||
|
if (polarity == FETPolarity.NEGATIVE) {
|
||||||
|
arrow = new Polygon(new int[] { x + pinSpacing * 2 / 6, x + pinSpacing * 2 / 6,
|
||||||
|
x + pinSpacing * 6 / 6 }, new int[] { y - pinSpacing / 5,
|
||||||
|
y + pinSpacing / 5, y }, 3);
|
||||||
|
} else {
|
||||||
|
arrow = new Polygon(new int[] { x + pinSpacing / 6, x + pinSpacing * 5 / 6,
|
||||||
|
x + pinSpacing * 5 / 6 }, new int[] { y, y + pinSpacing / 5,
|
||||||
|
y - pinSpacing / 5 }, 3);
|
||||||
|
}
|
||||||
|
body[2] = arrow;
|
||||||
|
}
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawIcon(Graphics2D g2d, int width, int height) {
|
||||||
|
g2d.setColor(COLOR);
|
||||||
|
|
||||||
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(2));
|
||||||
|
g2d.drawLine(width / 2, height / 5, width / 2, height * 4 / 5);
|
||||||
|
|
||||||
|
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||||
|
g2d.drawLine(width / 5, height / 2, width / 2, height / 2);
|
||||||
|
|
||||||
|
g2d.drawLine(width * 3 / 4, 1, width * 3 / 4, height / 4);
|
||||||
|
g2d.drawLine(width / 2, height / 4, width * 3 / 4, height / 4);
|
||||||
|
|
||||||
|
g2d.drawLine(width * 3 / 4, height - 1, width * 3 / 4, height * 3 / 4);
|
||||||
|
g2d.drawLine(width / 2, height * 3 / 4, width * 3 / 4, height * 3 / 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Channel")
|
||||||
|
public FETPolarity getPolarity() {
|
||||||
|
return polarity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPolarity(FETPolarity polarity) {
|
||||||
|
this.polarity = polarity;
|
||||||
|
// Invalidate body
|
||||||
|
body = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
-6
@@ -10,7 +10,7 @@ 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;
|
||||||
|
|
||||||
@ComponentDescriptor(name = "MOSFET Symbol", author = "Branislav Stojkovic", category = "Semiconductors", instanceNamePrefix = "Q", description = "MOSFET transistor", stretchable = false, zOrder = IDIYComponent.COMPONENT)
|
@ComponentDescriptor(name = "MOSFET Symbol", author = "Branislav Stojkovic", category = "Semiconductors", instanceNamePrefix = "Q", description = "MOSFET transistor schematic symbol", 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;
|
||||||
@@ -30,14 +30,14 @@ public class MOSFETSymbol extends AbstractTransistorSymbol {
|
|||||||
polyline.lineTo(x + pinSpacing / 2, y + pinSpacing);
|
polyline.lineTo(x + pinSpacing / 2, y + pinSpacing);
|
||||||
polyline.moveTo(x + pinSpacing, y - pinSpacing);
|
polyline.moveTo(x + pinSpacing, y - pinSpacing);
|
||||||
polyline.lineTo(x + pinSpacing, y + pinSpacing);
|
polyline.lineTo(x + pinSpacing, y + pinSpacing);
|
||||||
polyline.moveTo(x + pinSpacing, y - pinSpacing);
|
|
||||||
polyline.lineTo(x + pinSpacing * 2, y - pinSpacing);
|
|
||||||
polyline.moveTo(x + pinSpacing, y + pinSpacing);
|
|
||||||
polyline.lineTo(x + pinSpacing * 2, y + pinSpacing);
|
|
||||||
body[0] = polyline;
|
body[0] = polyline;
|
||||||
|
|
||||||
polyline = new GeneralPath();
|
polyline = new GeneralPath();
|
||||||
|
|
||||||
|
polyline.moveTo(x + pinSpacing, y - pinSpacing);
|
||||||
|
polyline.lineTo(x + pinSpacing * 2, y - pinSpacing);
|
||||||
|
polyline.moveTo(x + pinSpacing, y + pinSpacing);
|
||||||
|
polyline.lineTo(x + pinSpacing * 2, y + pinSpacing);
|
||||||
polyline.moveTo(x, y);
|
polyline.moveTo(x, y);
|
||||||
polyline.lineTo(x + pinSpacing / 2, y);
|
polyline.lineTo(x + pinSpacing / 2, y);
|
||||||
polyline.moveTo(x + pinSpacing * 2, y - pinSpacing * 2);
|
polyline.moveTo(x + pinSpacing * 2, y - pinSpacing * 2);
|
||||||
@@ -76,7 +76,7 @@ public class MOSFETSymbol extends AbstractTransistorSymbol {
|
|||||||
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
|
@EditableProperty(name = "Channel")
|
||||||
public FETPolarity getPolarity() {
|
public FETPolarity getPolarity() {
|
||||||
return polarity;
|
return polarity;
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -490,6 +490,10 @@
|
|||||||
<changeType>NEW_FEATURE</changeType>
|
<changeType>NEW_FEATURE</changeType>
|
||||||
<description>MOSFET Symbol</description>
|
<description>MOSFET Symbol</description>
|
||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>JFET Symbol</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
<org.diylc.appframework.update.Change>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>NEW_FEATURE</changeType>
|
<changeType>NEW_FEATURE</changeType>
|
||||||
<description>Line connector</description>
|
<description>Line connector</description>
|
||||||
|
|||||||
Reference in New Issue
Block a user