mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
refactor component transformation
This commit is contained in:
@@ -2,12 +2,27 @@ package org.diylc.components;
|
||||
|
||||
import java.awt.geom.GeneralPath;
|
||||
|
||||
/***
|
||||
*
|
||||
* Creates a {@link GeneralPath} with rounded edges. To create a rounded path, follow these steps:
|
||||
*
|
||||
* <ul>
|
||||
* <li>instantiate a {@link RoundedPath}</li>
|
||||
* <li>place a starting point using {@link RoundedPath#moveTo(double, double)}</li>
|
||||
* <li>create a polygon using a series of {@link RoundedPath#lineTo(double, double)} calls</li>
|
||||
* <li>call {@link RoundedPath#getPath()} to get a rounded path</li>
|
||||
* </ul>
|
||||
*
|
||||
* Note that the starting point shouldn't lie on a corner of the polygon if you want that corner to
|
||||
* get rounded too. Instead, place the starting/ending point on one of the polygon sides.
|
||||
*
|
||||
* @author bancika
|
||||
*/
|
||||
public class RoundedPath {
|
||||
|
||||
private GeneralPath path;
|
||||
|
||||
private double prevX = Double.NaN;
|
||||
private double prevY = Double.NaN;
|
||||
boolean isFirst = true;
|
||||
private double x = Double.NaN;
|
||||
private double y = Double.NaN;
|
||||
|
||||
@@ -22,26 +37,24 @@ public class RoundedPath {
|
||||
path.moveTo(x, y);
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.prevX = Double.NaN;
|
||||
this.prevY = Double.NaN;
|
||||
isFirst = true;
|
||||
}
|
||||
|
||||
public final void lineTo(double x, double y) {
|
||||
if (Double.isNaN(prevX)) {
|
||||
if (isFirst) {
|
||||
double theta = Math.atan2(y - this.y, x - this.x);
|
||||
double r = Math.sqrt((y - this.y) * (y - this.y) + (x - this.x) * (x - this.x));
|
||||
path.lineTo(this.x + Math.cos(theta) * (r - radius), this.y + Math.sin(theta) * (r - radius));
|
||||
path.lineTo(this.x + Math.cos(theta) * (r - radius), this.y + Math.sin(theta) * (r - radius));
|
||||
} else {
|
||||
double theta = Math.atan2(y - this.y, x - this.x);
|
||||
double theta = Math.atan2(y - this.y, x - this.x);
|
||||
path.curveTo(this.x, this.y, this.x, this.y, this.x + Math.cos(theta) * radius, this.y + Math.sin(theta) * radius);
|
||||
}
|
||||
|
||||
this.prevX = this.x;
|
||||
this.prevY = this.y;
|
||||
|
||||
isFirst = false;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
|
||||
public GeneralPath getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.diylc.components.boards;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Shape;
|
||||
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -12,7 +13,7 @@ import org.diylc.core.annotations.ComponentDescriptor;
|
||||
|
||||
@ComponentDescriptor(name = "Blank Board", category = "Boards", author = "Branislav Stojkovic",
|
||||
zOrder = IDIYComponent.BOARD, instanceNamePrefix = "Board", description = "Blank circuit board",
|
||||
bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, autoEdit = false)
|
||||
bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, autoEdit = false, transformer = SimpleComponentTransformer.class)
|
||||
public class BlankBoard extends AbstractBoard {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.Shape;
|
||||
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -20,7 +21,8 @@ import org.diylc.utils.Constants;
|
||||
|
||||
@ComponentDescriptor(name = "Eyelet Board", category = "Boards", author = "Branislav Stojkovic",
|
||||
zOrder = IDIYComponent.BOARD, instanceNamePrefix = "Board", description = "Perforated board with eyelets",
|
||||
bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TYPE_NAME)
|
||||
bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TYPE_NAME,
|
||||
transformer = SimpleComponentTransformer.class)
|
||||
public class EyeletBoard extends AbstractBoard {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.Shape;
|
||||
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -22,7 +23,7 @@ import org.diylc.utils.Constants;
|
||||
zOrder = IDIYComponent.BOARD, instanceNamePrefix = "Board",
|
||||
description = "Perforated board as found on some Marshall and Trainwreck amps",
|
||||
bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TAG,
|
||||
keywordTag = "Perf Board")
|
||||
keywordTag = "Perf Board", transformer = SimpleComponentTransformer.class)
|
||||
public class MarshallPerfBoard extends AbstractBoard {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.Shape;
|
||||
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -21,7 +22,7 @@ import org.diylc.utils.Constants;
|
||||
@ComponentDescriptor(name = "Perf Board w/ Pads", category = "Boards", author = "Branislav Stojkovic",
|
||||
zOrder = IDIYComponent.BOARD, instanceNamePrefix = "Board", description = "Perforated board with solder pads",
|
||||
bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TAG,
|
||||
keywordTag = "Perf Board")
|
||||
keywordTag = "Perf Board", transformer = SimpleComponentTransformer.class)
|
||||
public class PerfBoard extends AbstractBoard {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.Shape;
|
||||
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.common.OrientationHV;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -22,11 +23,11 @@ import org.diylc.utils.Constants;
|
||||
@ComponentDescriptor(name = "TriPad Board", category = "Boards", author = "Hauke Juhls", zOrder = IDIYComponent.BOARD,
|
||||
instanceNamePrefix = "Board",
|
||||
description = "Perforated FR4 board with copper strips connecting 3 holes in a row (aka TriPad Board)",
|
||||
keywordPolicy = KeywordPolicy.SHOW_TYPE_NAME)
|
||||
keywordPolicy = KeywordPolicy.SHOW_TYPE_NAME, transformer = SimpleComponentTransformer.class)
|
||||
public class TriPadBoard extends AbstractBoard {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
public static Color BORDER_COLOR = BOARD_COLOR.darker();
|
||||
|
||||
public static Size SPACING = new Size(0.1d, SizeUnit.in);
|
||||
@@ -131,7 +132,7 @@ public class TriPadBoard extends AbstractBoard {
|
||||
}
|
||||
}
|
||||
g2d.setComposite(oldComposite);
|
||||
|
||||
|
||||
super.drawCoordinates(g2d, spacing);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.Shape;
|
||||
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.common.OrientationHV;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -23,7 +24,8 @@ import org.diylc.utils.Constants;
|
||||
@ComponentDescriptor(name = "Vero Board", category = "Boards", author = "Branislav Stojkovic",
|
||||
zOrder = IDIYComponent.BOARD, instanceNamePrefix = "Board",
|
||||
description = "Perforated FR4 board with copper strips connecting all holes in a row",
|
||||
bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TYPE_NAME)
|
||||
bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TYPE_NAME,
|
||||
transformer = SimpleComponentTransformer.class)
|
||||
public class VeroBoard extends AbstractBoard {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -131,16 +133,16 @@ public class VeroBoard extends AbstractBoard {
|
||||
g2d.drawRect(0, 2 / factor, width - 1, height - 4 / factor);
|
||||
g2d.setColor(COPPER_COLOR);
|
||||
g2d.fillRect(1 / factor, width / 4, width - 2 / factor, width / 2);
|
||||
g2d.setColor(COPPER_COLOR.darker());
|
||||
g2d.setColor(COPPER_COLOR.darker());
|
||||
g2d.drawRect(1 / factor, width / 4, width - 2 / factor, width / 2);
|
||||
|
||||
|
||||
g2d.setColor(COPPER_COLOR);
|
||||
g2d.fillRect(1 / factor, 2 / factor, width - 2 / factor, 3 / factor);
|
||||
g2d.fillRect(1 / factor, height - 5 / factor, width - 2 / factor, 3 / factor);
|
||||
g2d.setColor(COPPER_COLOR.darker());
|
||||
g2d.drawRect(1 / factor, 2 / factor, width - 2 / factor, 3 / factor);
|
||||
g2d.drawRect(1 / factor, height - 5 / factor, width - 2 / factor, 3 / factor);
|
||||
|
||||
|
||||
g2d.setColor(Constants.CANVAS_COLOR);
|
||||
g2d.fillOval(width / 3 - 2 / factor, width / 2 - 2 / factor, getClosestOdd(5.0 / factor),
|
||||
getClosestOdd(5.0 / factor));
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Shape;
|
||||
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.PCBLayer;
|
||||
import org.diylc.components.AbstractLeadedComponent;
|
||||
@@ -21,7 +22,7 @@ import org.diylc.core.measures.SizeUnit;
|
||||
@ComponentDescriptor(name = "Copper Trace", author = "Branislav Stojkovic", category = "Connectivity",
|
||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "Trace",
|
||||
description = "Straight copper trace", zOrder = IDIYComponent.TRACE, bomPolicy = BomPolicy.NEVER_SHOW,
|
||||
autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "PCB")
|
||||
autoEdit = false, keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "PCB", transformer = SimpleComponentTransformer.class)
|
||||
public class CopperTrace extends AbstractLeadedComponent<Void> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.CubicCurve2D;
|
||||
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.PCBLayer;
|
||||
import org.diylc.components.AbstractCurvedComponent;
|
||||
@@ -19,7 +20,7 @@ import org.diylc.core.measures.SizeUnit;
|
||||
@ComponentDescriptor(name = "Curved Trace", author = "Branislav Stojkovic", category = "Connectivity",
|
||||
instanceNamePrefix = "Trace", description = "Curved copper trace with two control points",
|
||||
zOrder = IDIYComponent.TRACE, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false,
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "PCB")
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "PCB", transformer = SimpleComponentTransformer.class)
|
||||
public class CurvedTrace extends AbstractCurvedComponent<Void> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.components.AbstractComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -18,7 +19,7 @@ import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@ComponentDescriptor(name = "Dot", category = "Connectivity", author = "Branislav Stojkovic",
|
||||
description = "Connector dot", instanceNamePrefix = "Dot", stretchable = false, zOrder = IDIYComponent.COMPONENT,
|
||||
bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false)
|
||||
bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false, transformer = SimpleComponentTransformer.class)
|
||||
public class Dot extends AbstractComponent<Void> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.components.AbstractComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -21,7 +22,7 @@ import org.diylc.utils.Constants;
|
||||
@ComponentDescriptor(name = "Eyelet", category = "Connectivity", author = "Branislav Stojkovic",
|
||||
description = "Eyelet or turret terminal", instanceNamePrefix = "Eyelet", stretchable = false,
|
||||
zOrder = IDIYComponent.TRACE + 0.1, bomPolicy = BomPolicy.SHOW_ONLY_TYPE_NAME, autoEdit = false,
|
||||
keywordPolicy = KeywordPolicy.SHOW_TYPE_NAME)
|
||||
keywordPolicy = KeywordPolicy.SHOW_TYPE_NAME, transformer = SimpleComponentTransformer.class)
|
||||
public class Eyelet extends AbstractComponent<String> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.Arrays;
|
||||
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.PCBLayer;
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.components.AbstractComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -21,7 +22,7 @@ import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@ComponentDescriptor(name = "Ground Fill", author = "Branislav Stojkovic", category = "Connectivity",
|
||||
instanceNamePrefix = "GF", description = "Polygonal ground fill area", zOrder = IDIYComponent.TRACE,
|
||||
bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false)
|
||||
bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false, transformer = SimpleComponentTransformer.class)
|
||||
public class GroundFill extends AbstractComponent<Void> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.geom.CubicCurve2D;
|
||||
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.components.AbstractCurvedComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -15,7 +16,7 @@ import org.diylc.utils.Constants;
|
||||
|
||||
@ComponentDescriptor(name = "Hookup Wire", author = "Branislav Stojkovic", category = "Connectivity",
|
||||
instanceNamePrefix = "W", description = "Flexible wire with two control points", zOrder = IDIYComponent.COMPONENT,
|
||||
bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false)
|
||||
bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false, transformer = SimpleComponentTransformer.class)
|
||||
public class HookupWire extends AbstractCurvedComponent<Void> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.awt.Shape;
|
||||
|
||||
import org.diylc.common.Display;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.components.AbstractLeadedComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.CreationMethod;
|
||||
@@ -17,7 +18,8 @@ import org.diylc.core.measures.Size;
|
||||
|
||||
@ComponentDescriptor(name = "Jumper", author = "Branislav Stojkovic", category = "Connectivity",
|
||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "J", description = "",
|
||||
zOrder = IDIYComponent.COMPONENT, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false)
|
||||
zOrder = IDIYComponent.COMPONENT, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false,
|
||||
transformer = SimpleComponentTransformer.class)
|
||||
public class Jumper extends AbstractLeadedComponent<Void> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.awt.Shape;
|
||||
|
||||
import org.diylc.common.Display;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.components.AbstractLeadedComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.CreationMethod;
|
||||
@@ -19,7 +20,8 @@ import org.diylc.core.measures.Size;
|
||||
|
||||
@ComponentDescriptor(name = "Line", author = "Branislav Stojkovic", category = "Shapes",
|
||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "LN", description = "",
|
||||
zOrder = IDIYComponent.COMPONENT, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false)
|
||||
zOrder = IDIYComponent.COMPONENT, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false,
|
||||
transformer = SimpleComponentTransformer.class)
|
||||
public class Line extends AbstractLeadedComponent<Void> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
|
||||
import org.diylc.common.PCBLayer;
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.components.AbstractComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -23,7 +24,7 @@ import org.diylc.utils.Constants;
|
||||
@ComponentDescriptor(name = "Solder Pad", category = "Connectivity", author = "Branislav Stojkovic",
|
||||
description = "Copper solder pad, round or square", instanceNamePrefix = "Pad", stretchable = false,
|
||||
zOrder = IDIYComponent.TRACE + 0.1, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false,
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "PCB")
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "PCB", transformer = SimpleComponentTransformer.class)
|
||||
public class SolderPad extends AbstractComponent<Void> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.components.AbstractComponent;
|
||||
import org.diylc.components.boards.AbstractBoard;
|
||||
import org.diylc.components.boards.VeroBoard;
|
||||
@@ -21,7 +22,8 @@ import org.diylc.utils.Constants;
|
||||
|
||||
@ComponentDescriptor(name = "Trace Cut", category = "Connectivity", author = "Branislav Stojkovic",
|
||||
description = "Designates the place where a trace on the vero board needs to be cut", instanceNamePrefix = "Cut",
|
||||
stretchable = false, zOrder = IDIYComponent.BOARD + 1, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false)
|
||||
stretchable = false, zOrder = IDIYComponent.BOARD + 1, bomPolicy = BomPolicy.NEVER_SHOW, autoEdit = false,
|
||||
transformer = SimpleComponentTransformer.class)
|
||||
public class TraceCut extends AbstractComponent<Void> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.diylc.utils.Constants;
|
||||
|
||||
@ComponentDescriptor(name = "Plastic DC Jack", category = "Electromechanical", author = "Branislav Stojkovic",
|
||||
description = "Panel mount plastic DC jack", stretchable = false, zOrder = IDIYComponent.COMPONENT,
|
||||
instanceNamePrefix = "J", autoEdit = false, rotatable = false)
|
||||
instanceNamePrefix = "J", autoEdit = false)
|
||||
public class PlasticDCJack extends AbstractTransparentComponent<String> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
+3
-1
@@ -8,6 +8,7 @@ import java.awt.geom.Rectangle2D;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.components.AbstractLeadedComponent;
|
||||
import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -22,7 +23,8 @@ 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)
|
||||
description = "Axial electrolytic capacitor, similar to Sprague Atom, F&T, etc", zOrder = IDIYComponent.COMPONENT,
|
||||
transformer = SimpleComponentTransformer.class)
|
||||
public class AxialElectrolyticCapacitor extends AbstractLeadedComponent<Capacitance> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Shape;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.components.AbstractLeadedComponent;
|
||||
import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -17,7 +18,8 @@ import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@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)
|
||||
description = "Axial film capacitor, similar to Mallory 150s", zOrder = IDIYComponent.COMPONENT,
|
||||
transformer = SimpleComponentTransformer.class)
|
||||
public class AxialFilmCapacitor extends AbstractLeadedComponent<Capacitance> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Shape;
|
||||
import java.awt.geom.GeneralPath;
|
||||
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.components.AbstractSchematicLeadedSymbol;
|
||||
import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -18,7 +19,7 @@ import org.diylc.core.measures.SizeUnit;
|
||||
@ComponentDescriptor(name = "Capacitor (symbol)", author = "Branislav Stojkovic", category = "Schematics",
|
||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "C",
|
||||
description = "Capacitor schematic symbol with an optional polarity sign", zOrder = IDIYComponent.COMPONENT,
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Schematic")
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Schematic", transformer = SimpleComponentTransformer.class)
|
||||
public class CapacitorSymbol extends AbstractSchematicLeadedSymbol<Capacitance> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Shape;
|
||||
import java.awt.geom.GeneralPath;
|
||||
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.components.AbstractSchematicLeadedSymbol;
|
||||
import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -20,7 +21,7 @@ import org.diylc.core.measures.SizeUnit;
|
||||
@ComponentDescriptor(name = "Inductor (symbol)", author = "Branislav Stojkovic", category = "Schematics",
|
||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "L",
|
||||
description = "Inductor schematic symbol", zOrder = IDIYComponent.COMPONENT,
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Schematic")
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Schematic", transformer = SimpleComponentTransformer.class)
|
||||
public class InductorSymbol extends AbstractSchematicLeadedSymbol<Inductance> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -16,8 +16,7 @@ import org.diylc.components.semiconductors.SymbolFlipping;
|
||||
|
||||
@ComponentDescriptor(name = "Potentiometer (symbol)", author = "MCbx", category = "Schematics",
|
||||
instanceNamePrefix = "VR", description = "Potentiometer symbol", stretchable = false,
|
||||
zOrder = IDIYComponent.COMPONENT, rotatable = true, keywordPolicy = KeywordPolicy.SHOW_TAG,
|
||||
keywordTag = "Schematic")
|
||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Schematic")
|
||||
public class PotentiometerSymbol extends Abstract3LegSymbol {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
+3
-1
@@ -5,6 +5,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Shape;
|
||||
import java.awt.geom.Ellipse2D;
|
||||
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.components.AbstractRadialComponent;
|
||||
import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -17,7 +18,8 @@ import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@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)
|
||||
description = "Standard radial ceramic capacitor", zOrder = IDIYComponent.COMPONENT,
|
||||
transformer = SimpleComponentTransformer.class)
|
||||
public class RadialCeramicDiskCapacitor extends AbstractRadialComponent<Capacitance> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -11,6 +11,7 @@ import java.awt.geom.RoundRectangle2D;
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.components.AbstractRadialComponent;
|
||||
import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -25,7 +26,8 @@ import org.diylc.utils.Constants;
|
||||
|
||||
@ComponentDescriptor(name = "Electrolytic Capacitor (radial)", author = "Branislav Stojkovic", category = "Passive",
|
||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "C",
|
||||
description = "Vertical mounted electrolytic capacitor, polarized or bipolar", zOrder = IDIYComponent.COMPONENT)
|
||||
description = "Vertical mounted electrolytic capacitor, polarized or bipolar", zOrder = IDIYComponent.COMPONENT,
|
||||
transformer = SimpleComponentTransformer.class)
|
||||
public class RadialElectrolytic extends AbstractRadialComponent<Capacitance> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Shape;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.components.AbstractRadialComponent;
|
||||
import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -17,7 +18,8 @@ import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@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)
|
||||
description = "Radial film capacitor, similar to Sprague Orange Drop", zOrder = IDIYComponent.COMPONENT,
|
||||
transformer = SimpleComponentTransformer.class)
|
||||
public class RadialFilmCapacitor extends AbstractRadialComponent<Capacitance> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.awt.geom.Rectangle2D;
|
||||
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.ResistorColorCode;
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.components.AbstractLeadedComponent;
|
||||
import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -19,7 +20,7 @@ import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@ComponentDescriptor(name = "Resistor", author = "Branislav Stojkovic", category = "Passive",
|
||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "R", description = "Resistor layout symbol",
|
||||
zOrder = IDIYComponent.COMPONENT)
|
||||
zOrder = IDIYComponent.COMPONENT, transformer = SimpleComponentTransformer.class)
|
||||
public class Resistor extends AbstractLeadedComponent<Resistance> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Shape;
|
||||
import java.awt.geom.GeneralPath;
|
||||
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.components.AbstractSchematicLeadedSymbol;
|
||||
import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -18,7 +19,7 @@ import org.diylc.core.measures.SizeUnit;
|
||||
@ComponentDescriptor(name = "Resistor (symbol)", author = "Branislav Stojkovic", category = "Schematics",
|
||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "R",
|
||||
description = "Resistor schematic symbol", zOrder = IDIYComponent.COMPONENT,
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Schematic")
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Schematic", transformer = SimpleComponentTransformer.class)
|
||||
public class ResistorSymbol extends AbstractSchematicLeadedSymbol<Resistance> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.diylc.utils.Constants;
|
||||
category = "Schematics",
|
||||
instanceNamePrefix = "L",
|
||||
description = "Transformer coil symbol. Use multiple instances together with \"Transformer Core Symbol\"<br>to draw transformer schematics.",
|
||||
stretchable = false, zOrder = IDIYComponent.COMPONENT, rotatable = true, keywordPolicy = KeywordPolicy.SHOW_TAG,
|
||||
stretchable = false, zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_TAG,
|
||||
keywordTag = "Schematic")
|
||||
public class TransformerCoil extends AbstractComponent<org.diylc.core.measures.Voltage> {
|
||||
|
||||
@@ -226,19 +226,21 @@ public class TransformerCoil extends AbstractComponent<org.diylc.core.measures.V
|
||||
GeneralPath coil = new GeneralPath();
|
||||
|
||||
int coilsPerTap = (int) Math.round(4 * tapSpacing.convertToPixels() / TAP_SPACING.convertToPixels());
|
||||
|
||||
|
||||
double offset = OFFSET.convertToPixels();
|
||||
|
||||
int i = 0;
|
||||
leads.moveTo(this.controlPoints[i].x, this.controlPoints[i].y);
|
||||
leads.lineTo(this.controlPoints[i].x + fx * (spacing + offset), this.controlPoints[i].y + fy * (spacing + offset));
|
||||
leads
|
||||
.lineTo(this.controlPoints[i].x + fx * (spacing + offset), this.controlPoints[i].y + fy * (spacing + offset));
|
||||
leads.moveTo(this.controlPoints[i + 1].x, this.controlPoints[i + 1].y);
|
||||
leads.lineTo(this.controlPoints[i + 1].x + fx * (spacing + offset), this.controlPoints[i + 1].y + fy * (spacing + offset));
|
||||
leads.lineTo(this.controlPoints[i + 1].x + fx * (spacing + offset), this.controlPoints[i + 1].y + fy
|
||||
* (spacing + offset));
|
||||
|
||||
double dx = this.controlPoints[i + 1].getX() - this.controlPoints[i].getX();
|
||||
double dy = this.controlPoints[i + 1].getY() - this.controlPoints[i].getY();
|
||||
double d = Math.max(Math.abs(dx), Math.abs(dy)) / coilsPerTap;
|
||||
|
||||
|
||||
double x1 = this.controlPoints[i].getX() + fx * (spacing + d + offset);
|
||||
double y1 = this.controlPoints[i].getY() + fy * (spacing + d + offset);
|
||||
double x2 = this.controlPoints[i + 1].getX() + fx * (spacing + d + offset);
|
||||
@@ -246,16 +248,13 @@ public class TransformerCoil extends AbstractComponent<org.diylc.core.measures.V
|
||||
double dxa = x2 - x1;
|
||||
double dya = y2 - y1;
|
||||
|
||||
coil.moveTo(this.controlPoints[i].getX() + fx * (spacing + offset), this.controlPoints[i].getY() + fy * (spacing + offset));
|
||||
coil.moveTo(this.controlPoints[i].getX() + fx * (spacing + offset), this.controlPoints[i].getY() + fy
|
||||
* (spacing + offset));
|
||||
|
||||
for (int j = 0; j < coilsPerTap; j++) {
|
||||
coil.curveTo(
|
||||
x1 + dxa / coilsPerTap * j,
|
||||
y1 + dya / coilsPerTap * j,
|
||||
x1 + dxa / coilsPerTap * (j + 1),
|
||||
y1 + dya / coilsPerTap * (j + 1),
|
||||
this.controlPoints[i].getX() + fx * (spacing + offset) + dx / coilsPerTap * (j + 1),
|
||||
this.controlPoints[i].getY() + fy * (spacing + offset) + dy / coilsPerTap * (j + 1));
|
||||
coil.curveTo(x1 + dxa / coilsPerTap * j, y1 + dya / coilsPerTap * j, x1 + dxa / coilsPerTap * (j + 1), y1 + dya
|
||||
/ coilsPerTap * (j + 1), this.controlPoints[i].getX() + fx * (spacing + offset) + dx / coilsPerTap
|
||||
* (j + 1), this.controlPoints[i].getY() + fy * (spacing + offset) + dy / coilsPerTap * (j + 1));
|
||||
}
|
||||
body = new Shape[2];
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.diylc.utils.Constants;
|
||||
category = "Schematics",
|
||||
instanceNamePrefix = "T",
|
||||
description = "Transformer core symbol. Use multiple instances together with \"Transformer Coil Symbol\"<br>to draw transformer schematics.",
|
||||
stretchable = true, zOrder = IDIYComponent.COMPONENT, rotatable = true, keywordPolicy = KeywordPolicy.SHOW_TAG,
|
||||
stretchable = true, zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_TAG,
|
||||
creationMethod = CreationMethod.POINT_BY_POINT, keywordTag = "Schematic")
|
||||
public class TransformerCore extends AbstractComponent<Void> {
|
||||
|
||||
@@ -99,7 +99,8 @@ public class TransformerCore extends AbstractComponent<Void> {
|
||||
}
|
||||
|
||||
double theta =
|
||||
Math.atan2(this.controlPoints[1].y - this.controlPoints[0].y, this.controlPoints[1].x - this.controlPoints[0].x) + Math.PI / 2;
|
||||
Math.atan2(this.controlPoints[1].y - this.controlPoints[0].y, this.controlPoints[1].x - this.controlPoints[0].x)
|
||||
+ Math.PI / 2;
|
||||
double spacing = SPACING.convertToPixels();
|
||||
// System.out.println(theta);
|
||||
|
||||
|
||||
@@ -16,8 +16,7 @@ import org.diylc.core.annotations.KeywordPolicy;
|
||||
|
||||
@ComponentDescriptor(name = "BJT (symbol)", author = "Branislav Stojkovic", category = "Schematics",
|
||||
instanceNamePrefix = "Q", description = "Bipolar junction transistor schematic symbol", stretchable = false,
|
||||
zOrder = IDIYComponent.COMPONENT, rotatable = true, keywordPolicy = KeywordPolicy.SHOW_TAG_AND_VALUE,
|
||||
keywordTag = "Schematic")
|
||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_TAG_AND_VALUE, keywordTag = "Schematic")
|
||||
public class BJTSymbol extends Abstract3LegSymbol {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.awt.geom.Rectangle2D;
|
||||
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.components.AbstractLeadedComponent;
|
||||
import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -19,7 +20,8 @@ import org.diylc.utils.Constants;
|
||||
|
||||
@ComponentDescriptor(name = "Diode (glass)", author = "Branislav Stojkovic", category = "Semiconductors",
|
||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "D",
|
||||
description = "Glass diode, like most small signal diodes.", zOrder = IDIYComponent.COMPONENT)
|
||||
description = "Glass diode, like most small signal diodes.", zOrder = IDIYComponent.COMPONENT,
|
||||
transformer = SimpleComponentTransformer.class)
|
||||
public class DiodeGlass extends AbstractLeadedComponent<String> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -112,7 +114,7 @@ public class DiodeGlass extends AbstractLeadedComponent<String> {
|
||||
int length = getClosestOdd(getLength().convertToPixels());
|
||||
// draw the inside
|
||||
if (!outlineMode) {
|
||||
g2d.setColor(getInsideColor());
|
||||
g2d.setColor(getInsideColor());
|
||||
int width = getClosestOdd(getWidth().convertToPixels());
|
||||
int insideLength = getClosestOdd(length - 0.2 * width);
|
||||
int insideWidth = getClosestOdd(width * 0.8);
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.awt.geom.Rectangle2D;
|
||||
|
||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||
import org.diylc.common.IPlugInPort;
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.components.AbstractLeadedComponent;
|
||||
import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -19,7 +20,8 @@ import org.diylc.utils.Constants;
|
||||
|
||||
@ComponentDescriptor(name = "Diode (plastic)", author = "Branislav Stojkovic", category = "Semiconductors",
|
||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "D",
|
||||
description = "Plastic diode, like most rectifier, zener, schottky, etc.", zOrder = IDIYComponent.COMPONENT)
|
||||
description = "Plastic diode, like most rectifier, zener, schottky, etc.", zOrder = IDIYComponent.COMPONENT,
|
||||
transformer = SimpleComponentTransformer.class)
|
||||
public class DiodePlastic extends AbstractLeadedComponent<String> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
@@ -13,7 +14,8 @@ import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@ComponentDescriptor(name = "Diode (symbol)", author = "Branislav Stojkovic", category = "Schematics",
|
||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "D", description = "Diode schematic symbol",
|
||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Schematic")
|
||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Schematic",
|
||||
transformer = SimpleComponentTransformer.class)
|
||||
public class DiodeSymbol extends AbstractDiodeSymbol {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -33,8 +33,7 @@ import org.diylc.utils.Constants;
|
||||
|
||||
@ComponentDescriptor(name = "IC (symbol)", author = "Branislav Stojkovic", category = "Schematics",
|
||||
instanceNamePrefix = "IC", description = "IC symbol with 3 or 5 contacts", stretchable = false,
|
||||
zOrder = IDIYComponent.COMPONENT, rotatable = false, keywordPolicy = KeywordPolicy.SHOW_TAG_AND_VALUE,
|
||||
keywordTag = "Schematic")
|
||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_TAG_AND_VALUE, keywordTag = "Schematic")
|
||||
public class ICSymbol extends AbstractTransparentComponent<String> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -14,8 +14,7 @@ import org.diylc.core.annotations.KeywordPolicy;
|
||||
|
||||
@ComponentDescriptor(name = "JFET (symbol)", author = "Branislav Stojkovic", category = "Schematics",
|
||||
instanceNamePrefix = "Q", description = "JFET transistor schematic symbol", stretchable = false,
|
||||
zOrder = IDIYComponent.COMPONENT, rotatable = true, keywordPolicy = KeywordPolicy.SHOW_TAG_AND_VALUE,
|
||||
keywordTag = "Schematic")
|
||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_TAG_AND_VALUE, keywordTag = "Schematic")
|
||||
public class JFETSymbol extends Abstract3LegSymbol {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.awt.geom.Ellipse2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.components.AbstractLeadedComponent;
|
||||
import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
@@ -18,7 +19,7 @@ import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@ComponentDescriptor(name = "LED", author = "Branislav Stojkovic", category = "Semiconductors",
|
||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "D", description = "Light Emitting Diode",
|
||||
zOrder = IDIYComponent.COMPONENT)
|
||||
zOrder = IDIYComponent.COMPONENT, transformer = SimpleComponentTransformer.class)
|
||||
public class LED extends AbstractLeadedComponent<String> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.awt.Polygon;
|
||||
import java.awt.geom.AffineTransform;
|
||||
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
@@ -12,7 +13,8 @@ import org.diylc.core.annotations.KeywordPolicy;
|
||||
|
||||
@ComponentDescriptor(name = "LED (symbol)", author = "Branislav Stojkovic", category = "Schematics",
|
||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "D", description = "Diode schematic symbol",
|
||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Schematic")
|
||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Schematic",
|
||||
transformer = SimpleComponentTransformer.class)
|
||||
public class LEDSymbol extends DiodeSymbol {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -14,8 +14,7 @@ import org.diylc.core.annotations.KeywordPolicy;
|
||||
|
||||
@ComponentDescriptor(name = "MOSFET (symbol)", author = "Branislav Stojkovic", category = "Schematics",
|
||||
instanceNamePrefix = "Q", description = "MOSFET transistor schematic symbol", stretchable = false,
|
||||
zOrder = IDIYComponent.COMPONENT, rotatable = true, keywordPolicy = KeywordPolicy.SHOW_TAG_AND_VALUE,
|
||||
keywordTag = "Schematic")
|
||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_TAG_AND_VALUE, keywordTag = "Schematic")
|
||||
public class MOSFETSymbol extends Abstract3LegSymbol {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
+4
-3
@@ -4,6 +4,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
@@ -11,10 +12,10 @@ import org.diylc.core.annotations.KeywordPolicy;
|
||||
import org.diylc.core.measures.Size;
|
||||
import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@ComponentDescriptor(name = "Schottky Siode (symbol)", author = "Branislav Stojkovic",
|
||||
category = "Schematics", creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "D",
|
||||
@ComponentDescriptor(name = "Schottky Siode (symbol)", author = "Branislav Stojkovic", category = "Schematics",
|
||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "D",
|
||||
description = "Schottky diode schematic symbol", zOrder = IDIYComponent.COMPONENT,
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Schematic")
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Schematic", transformer = SimpleComponentTransformer.class)
|
||||
public class SchottkyDiodeSymbol extends AbstractDiodeSymbol {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.core.CreationMethod;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
@@ -14,7 +15,7 @@ import org.diylc.core.measures.SizeUnit;
|
||||
@ComponentDescriptor(name = "Zener Diode (symbol)", author = "Branislav Stojkovic", category = "Schematics",
|
||||
creationMethod = CreationMethod.POINT_BY_POINT, instanceNamePrefix = "D",
|
||||
description = "Zener diode schematic symbol", zOrder = IDIYComponent.COMPONENT,
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Schematic")
|
||||
keywordPolicy = KeywordPolicy.SHOW_TAG, keywordTag = "Schematic", transformer = SimpleComponentTransformer.class)
|
||||
public class ZenerDiodeSymbol extends AbstractDiodeSymbol {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.awt.Composite;
|
||||
import java.awt.Graphics2D;
|
||||
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -14,7 +15,7 @@ import org.diylc.core.annotations.ComponentDescriptor;
|
||||
|
||||
@ComponentDescriptor(name = "Ellipse", author = "Branislav Stojkovic", category = "Shapes", instanceNamePrefix = "ELL",
|
||||
description = "Elliptical area", zOrder = IDIYComponent.COMPONENT, flexibleZOrder = true,
|
||||
bomPolicy = BomPolicy.SHOW_ALL_NAMES, autoEdit = false)
|
||||
bomPolicy = BomPolicy.SHOW_ALL_NAMES, autoEdit = false, transformer = SimpleComponentTransformer.class)
|
||||
public class Ellipse extends AbstractShape {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.awt.Point;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -18,7 +19,8 @@ import org.diylc.core.annotations.EditableProperty;
|
||||
|
||||
@ComponentDescriptor(name = "Polygon", author = "Branislav Stojkovic", category = "Shapes",
|
||||
instanceNamePrefix = "POLY", description = "Polygonal area", zOrder = IDIYComponent.COMPONENT,
|
||||
flexibleZOrder = true, bomPolicy = BomPolicy.SHOW_ALL_NAMES, autoEdit = false)
|
||||
flexibleZOrder = true, bomPolicy = BomPolicy.SHOW_ALL_NAMES, autoEdit = false,
|
||||
transformer = SimpleComponentTransformer.class)
|
||||
public class Polygon extends AbstractShape {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.awt.Composite;
|
||||
import java.awt.Graphics2D;
|
||||
|
||||
import org.diylc.common.ObjectCache;
|
||||
import org.diylc.common.SimpleComponentTransformer;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.IDrawingObserver;
|
||||
@@ -17,7 +18,8 @@ import org.diylc.core.measures.SizeUnit;
|
||||
|
||||
@ComponentDescriptor(name = "Rectangle", author = "Branislav Stojkovic", category = "Shapes",
|
||||
instanceNamePrefix = "RECT", description = "Ractangular area, with or withouth rounded edges",
|
||||
zOrder = IDIYComponent.COMPONENT, flexibleZOrder = true, bomPolicy = BomPolicy.SHOW_ALL_NAMES, autoEdit = false)
|
||||
zOrder = IDIYComponent.COMPONENT, flexibleZOrder = true, bomPolicy = BomPolicy.SHOW_ALL_NAMES, autoEdit = false,
|
||||
transformer = SimpleComponentTransformer.class)
|
||||
public class Rectangle extends AbstractShape {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -17,17 +17,17 @@ import org.diylc.core.annotations.KeywordPolicy;
|
||||
|
||||
@ComponentDescriptor(name = "Diode (symbol)", author = "Branislav Stojkovic", category = "Schematics",
|
||||
instanceNamePrefix = "V", description = "Diode tube symbol", stretchable = false, zOrder = IDIYComponent.COMPONENT,
|
||||
rotatable = false, keywordPolicy = KeywordPolicy.SHOW_VALUE)
|
||||
keywordPolicy = KeywordPolicy.SHOW_VALUE)
|
||||
public class DiodeSymbol extends AbstractTubeSymbol {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
protected boolean directlyHeated = false;
|
||||
|
||||
public DiodeSymbol() {
|
||||
super();
|
||||
this.controlPoints = new Point[] {new Point(0, 0), new Point(0, 0), new Point(0, 0), new Point(0, 0),
|
||||
new Point(0, 0)};
|
||||
this.controlPoints =
|
||||
new Point[] {new Point(0, 0), new Point(0, 0), new Point(0, 0), new Point(0, 0), new Point(0, 0)};
|
||||
updateControlPoints();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.diylc.core.annotations.KeywordPolicy;
|
||||
|
||||
@ComponentDescriptor(name = "Pentode (symbol)", author = "Branislav Stojkovic", category = "Schematics",
|
||||
instanceNamePrefix = "V", description = "Pentode tube symbol", stretchable = false,
|
||||
zOrder = IDIYComponent.COMPONENT, rotatable = false, keywordPolicy = KeywordPolicy.SHOW_VALUE)
|
||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE)
|
||||
public class PentodeSymbol extends AbstractTubeSymbol {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -25,8 +25,9 @@ public class PentodeSymbol extends AbstractTubeSymbol {
|
||||
|
||||
public PentodeSymbol() {
|
||||
super();
|
||||
this.controlPoints = new Point[] {new Point(0, 0), new Point(0, 0), new Point(0, 0), new Point(0, 0),
|
||||
new Point(0, 0), new Point(0, 0), new Point(0, 0)};
|
||||
this.controlPoints =
|
||||
new Point[] {new Point(0, 0), new Point(0, 0), new Point(0, 0), new Point(0, 0), new Point(0, 0),
|
||||
new Point(0, 0), new Point(0, 0)};
|
||||
updateControlPoints();
|
||||
}
|
||||
|
||||
@@ -103,8 +104,9 @@ public class PentodeSymbol extends AbstractTubeSymbol {
|
||||
polyline.lineTo(x + pinSpacing * 5, y - pinSpacing * 5 / 4);
|
||||
polyline.curveTo(x + pinSpacing * 21 / 4, y - pinSpacing * 5 / 4, x + pinSpacing * 21 / 4, y - pinSpacing * 3
|
||||
/ 4, x + pinSpacing * 5, y - pinSpacing * 3 / 4);
|
||||
polyline.moveTo(x + pinSpacing * 5, y - pinSpacing * 3 / 4);
|
||||
polyline.curveTo(x + pinSpacing * 5, y + pinSpacing * 3 / 8, x + pinSpacing * 5, y + pinSpacing * 3 / 8, x + pinSpacing * 4, y + pinSpacing * 3 / 8);
|
||||
polyline.moveTo(x + pinSpacing * 5, y - pinSpacing * 3 / 4);
|
||||
polyline.curveTo(x + pinSpacing * 5, y + pinSpacing * 3 / 8, x + pinSpacing * 5, y + pinSpacing * 3 / 8, x
|
||||
+ pinSpacing * 4, y + pinSpacing * 3 / 8);
|
||||
}
|
||||
|
||||
// plate
|
||||
@@ -205,7 +207,7 @@ public class PentodeSymbol extends AbstractTubeSymbol {
|
||||
|
||||
public void setExposeSuppressorGrid(boolean exposeSuppressorGrid) {
|
||||
this.exposeSuppressorGrid = exposeSuppressorGrid;
|
||||
|
||||
|
||||
refreshDrawing();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.diylc.core.annotations.KeywordPolicy;
|
||||
|
||||
@ComponentDescriptor(name = "Triode (symbol)", author = "Branislav Stojkovic", category = "Schematics",
|
||||
instanceNamePrefix = "V", description = "Triode tube symbol", stretchable = false,
|
||||
zOrder = IDIYComponent.COMPONENT, rotatable = false, keywordPolicy = KeywordPolicy.SHOW_VALUE)
|
||||
zOrder = IDIYComponent.COMPONENT, keywordPolicy = KeywordPolicy.SHOW_VALUE)
|
||||
public class TriodeSymbol extends AbstractTubeSymbol {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -25,8 +25,8 @@ public class TriodeSymbol extends AbstractTubeSymbol {
|
||||
|
||||
public TriodeSymbol() {
|
||||
super();
|
||||
this.controlPoints = new Point[] {new Point(0, 0), new Point(0, 0), new Point(0, 0), new Point(0, 0),
|
||||
new Point(0, 0)};
|
||||
this.controlPoints =
|
||||
new Point[] {new Point(0, 0), new Point(0, 0), new Point(0, 0), new Point(0, 0), new Point(0, 0)};
|
||||
updateControlPoints();
|
||||
}
|
||||
|
||||
|
||||
@@ -729,6 +729,7 @@ public class V1FileParser implements IOldFileParser {
|
||||
|
||||
private long randSeed = 0;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private int randInt(int range) {
|
||||
long newSeed = randSeed * 0x08088405 + 1;
|
||||
randSeed = newSeed;
|
||||
|
||||
Reference in New Issue
Block a user