diff --git a/diylc/diylc-library/lib/diylc-core.jar b/diylc/diylc-library/lib/diylc-core.jar index 1c978f44..fa11494d 100644 Binary files a/diylc/diylc-library/lib/diylc-core.jar and b/diylc/diylc-library/lib/diylc-core.jar differ diff --git a/diylc/diylc-library/src/org/diylc/components/semiconductors/BridgeRectifier.java b/diylc/diylc-library/src/org/diylc/components/semiconductors/BridgeRectifier.java index 17bc21ca..590be5e1 100644 --- a/diylc/diylc-library/src/org/diylc/components/semiconductors/BridgeRectifier.java +++ b/diylc/diylc-library/src/org/diylc/components/semiconductors/BridgeRectifier.java @@ -31,6 +31,7 @@ import java.awt.Rectangle; import java.awt.geom.AffineTransform; import java.awt.geom.Area; import java.awt.geom.Ellipse2D; +import java.awt.geom.Path2D; import java.awt.geom.Rectangle2D; import java.awt.geom.RoundRectangle2D; @@ -41,8 +42,8 @@ import org.diylc.common.IPlugInPort; import org.diylc.common.ObjectCache; import org.diylc.common.Orientation; import org.diylc.common.VerticalAlignment; -import org.diylc.components.AbstractTransparentComponent; import org.diylc.components.AbstractLeadedComponent.LabelOriantation; +import org.diylc.components.AbstractTransparentComponent; import org.diylc.components.transform.DIL_ICTransformer; import org.diylc.core.ComponentState; import org.diylc.core.IDIYComponent; @@ -75,14 +76,17 @@ public class BridgeRectifier extends AbstractTransparentComponent { private static int[] MINI2_LABEL_SPACING_X = new int[] { 1, -1, 1, -1 }; private static Size MINI_ROUND_DIAMETER = new Size(9.1d, SizeUnit.mm); - private static Size MINI_ROUND_SPACING = new Size(0.2d, SizeUnit.in); - + private static Size MINI_ROUND_SPACING = new Size(0.2d, SizeUnit.in); private static int[] MINI_ROUND_LABEL_SPACING_Y = new int[] { 1, 1, -1, -1 }; private static Size INLINE_LENGTH = new Size(23.2d, SizeUnit.mm); private static Size INLINE_WIDTH = new Size(2.7d, SizeUnit.mm); private static Size INLINE_SPACING = new Size(0.2d, SizeUnit.in); - private static int[] INLINE_LABEL_SPACING_Y = new int[] { -1, -1, 1, 1 }; + private static int[] INLINE_LABEL_SPACING_Y = new int[] { -1, -1, 1, 1 }; + + private static Size BR3_LENGTH = new Size(0.6d, SizeUnit.in); + private static Size BR3_SPACING = new Size(0.425d, SizeUnit.in); + private static int[] BR3_LABEL_SPACING_Y = new int[] { 1, 1, -1, -1 }; public static Color BODY_COLOR = Color.gray; public static Color BORDER_COLOR = Color.gray.darker(); @@ -90,7 +94,8 @@ public class BridgeRectifier extends AbstractTransparentComponent { public static Color PIN_BORDER_COLOR = PIN_COLOR.darker(); public static Color LABEL_COLOR = Color.white; public static int EDGE_RADIUS = 6; - public static Size PIN_SIZE = new Size(0.04d, SizeUnit.in); + public static Size SQUARE_PIN_SIZE = new Size(0.04d, SizeUnit.in); + public static Size ROUND_PIN_SIZE = new Size(0.032d, SizeUnit.in); public static Size INDENT_SIZE = new Size(0.07d, SizeUnit.in); private String value = ""; @@ -211,7 +216,13 @@ public class BridgeRectifier extends AbstractTransparentComponent { controlPoints[1].setLocation(firstPoint.x, firstPoint.y + vSpacing); controlPoints[2].setLocation(firstPoint.x, firstPoint.y + 2 * vSpacing); controlPoints[3].setLocation(firstPoint.x, firstPoint.y + 3 * vSpacing); - break; + break; + case SquareBR3: + hSpacing = vSpacing = (int) BR3_SPACING.convertToPixels(); + controlPoints[1].setLocation(firstPoint.x + hSpacing, firstPoint.y); + controlPoints[2].setLocation(firstPoint.x, firstPoint.y + vSpacing); + controlPoints[3].setLocation(firstPoint.x + hSpacing, firstPoint.y + vSpacing); + break; } if (orientation != Orientation.DEFAULT) { @@ -235,6 +246,7 @@ public class BridgeRectifier extends AbstractTransparentComponent { } } + @SuppressWarnings("incomplete-switch") public Area[] getBody() { if (body == null) { body = new Area[2]; @@ -259,6 +271,9 @@ public class BridgeRectifier extends AbstractTransparentComponent { length = (int) INLINE_WIDTH.convertToPixels(); width = (int) INLINE_LENGTH.convertToPixels(); break; + case SquareBR3: + length = width = (int) BR3_LENGTH.convertToPixels(); + break; } if (orientation == Orientation._90 || orientation == Orientation._270) { @@ -276,6 +291,36 @@ public class BridgeRectifier extends AbstractTransparentComponent { case MiniRound1: case MiniRound2: body[0] = new Area(new Ellipse2D.Double(centerX - length / 2, centerY - width / 2, length, width)); + break; + case SquareBR3: + Path2D path = new Path2D.Double(); + double margin = (BR3_LENGTH.convertToPixels() - BR3_SPACING.convertToPixels()) / 2; + path.moveTo(centerX - width / 2 + margin, centerY - width / 2); + path.lineTo(centerX + width / 2, centerY - width / 2); + path.lineTo(centerX + width / 2, centerY + width / 2); + path.lineTo(centerX - width / 2, centerY + width / 2); + path.lineTo(centerX - width / 2, centerY - width / 2 + margin); + path.closePath(); + body[0] = new Area(path); + + if (orientation != Orientation.DEFAULT) { + double theta = 0; + switch (orientation) { + case _90: + theta = Math.PI / 2; + break; + case _180: + theta = Math.PI; + break; + case _270: + theta = Math.PI * 3 / 2; + break; + } + AffineTransform rotation = AffineTransform.getRotateInstance(theta, centerX, centerY); + + body[0].transform(rotation); + } + break; } } @@ -291,21 +336,18 @@ public class BridgeRectifier extends AbstractTransparentComponent { } Area mainArea = getBody()[0]; - int pinSize = (int) PIN_SIZE.convertToPixels() / 2 * 2; - - // smaller pin for round - if (rectifierType == RectifierType.InLine || rectifierType == RectifierType.MiniRound1 || rectifierType == RectifierType.MiniRound2) - pinSize *= 0.8; + PinShape pinShape = rectifierType.getPinShape(); + int pinSize = (int) (pinShape == PinShape.Round ? ROUND_PIN_SIZE.convertToPixels() : SQUARE_PIN_SIZE.convertToPixels()) / 2 * 2; if (!outlineMode) { for (Point point : controlPoints) { g2d.setColor(PIN_COLOR); - if (rectifierType == RectifierType.InLine || rectifierType == RectifierType.MiniRound1 || rectifierType == RectifierType.MiniRound2) + if (pinShape == PinShape.Round) g2d.fillOval(point.x - pinSize / 2, point.y - pinSize / 2, pinSize, pinSize); else g2d.fillRect(point.x - pinSize / 2, point.y - pinSize / 2, pinSize, pinSize); g2d.setColor(PIN_BORDER_COLOR); - if (rectifierType == RectifierType.InLine || rectifierType == RectifierType.MiniRound1 || rectifierType == RectifierType.MiniRound2) + if (pinShape == PinShape.Round) g2d.drawOval(point.x - pinSize / 2, point.y - pinSize / 2, pinSize, pinSize); else g2d.drawRect(point.x - pinSize / 2, point.y - pinSize / 2, pinSize, pinSize); @@ -431,6 +473,9 @@ public class BridgeRectifier extends AbstractTransparentComponent { case InLine: dy = pinSize * INLINE_LABEL_SPACING_Y[i]; break; + case SquareBR3: + dy = pinSize * BR3_LABEL_SPACING_Y[i]; + break; } dx = (int) (1.5 * dx); @@ -459,6 +504,7 @@ public class BridgeRectifier extends AbstractTransparentComponent { break; case MiniRound1: case MiniRound2: + case SquareBR3: switch (orientation) { case _90: int p1 = dx; @@ -600,11 +646,19 @@ public class BridgeRectifier extends AbstractTransparentComponent { public static enum RectifierType { - MiniDIP1("DFM 1"), MiniDIP2("DFM 2"), MiniRound1("Round WOG 1"), MiniRound2("Round WOG 2"), InLine("In-Line D-44"); + MiniDIP1("DFM A", PinShape.Square), + MiniDIP2("DFM B", PinShape.Square), + MiniRound1("Round WOG A", PinShape.Round), + MiniRound2("Round WOG B", PinShape.Round), + InLine("In-Line D-44", PinShape.Round), + SquareBR3("Square BR-3", PinShape.Round); private String label; - private RectifierType(String label) { + private PinShape pinShape; + + private RectifierType(String label, PinShape pinShape) { this.label = label; + this.pinShape = pinShape; } @Override @@ -612,5 +666,12 @@ public class BridgeRectifier extends AbstractTransparentComponent { return label; } + public PinShape getPinShape() { + return pinShape; + } + } + + private static enum PinShape { + Square, Round } } diff --git a/diylc/diylc-swing/library/main.jar b/diylc/diylc-swing/library/main.jar index e14544ff..8483f882 100644 Binary files a/diylc/diylc-swing/library/main.jar and b/diylc/diylc-swing/library/main.jar differ diff --git a/diylc/diylc-swing/variants.xml b/diylc/diylc-swing/variants.xml index f34d3a89..4ce44d06 100644 --- a/diylc/diylc-swing/variants.xml +++ b/diylc/diylc-swing/variants.xml @@ -18,6 +18,14 @@ Alpha 127 + + Model + + + + Orientation + DEFAULT + Pole Color @@ -27,14 +35,6 @@ 255 - - Orientation - DEFAULT - - - Model - - Type Stratocaster @@ -73,16 +73,16 @@ 127 - Pole Color - + Model + Orientation DEFAULT - Model - + Pole Color + Type @@ -117,16 +117,16 @@ 127 - Pole Color - + Model + Orientation DEFAULT - Model - + Pole Color + Type @@ -161,16 +161,16 @@ 127 - Pole Color - + Model + Orientation DEFAULT - Model - + Pole Color + Type @@ -205,16 +205,16 @@ 127 - Pole Color - + Model + Orientation DEFAULT - Model - + Pole Color + Type @@ -249,16 +249,16 @@ 127 - Pole Color - + Model + Orientation DEFAULT - Model - + Pole Color + Type @@ -289,10 +289,6 @@ DPDT - - Alpha - 127 - Body @@ -302,10 +298,18 @@ 255 + + Alpha + 127 + Orientation VERTICAL + + Type + DPDT + Border @@ -315,10 +319,6 @@ 255 - - Type - DPDT - Spacing @@ -359,25 +359,25 @@ SPDT - Alpha - 127 + Body + - Body - + Alpha + 127 Orientation VERTICAL - - Border - - Type SPDT + + Border + + Spacing @@ -574,230 +574,6 @@ - - Semiconductors.Bridge Rectifier - - - Miniature Rectangular - - - Label Orientation - Directional - - - Alpha - 127 - - - Body - - 128 - 128 - 128 - 255 - - - - Value - - - - Orientation - DEFAULT - - - Type - MiniDIP1 - - - Border - - 89 - 89 - 89 - 255 - - - - Voltage - - - - Display - BOTH - - - Label - - 255 - 255 - 255 - 255 - - - - Current - - - - - - 0 - 0 - - - 60 - 0 - - - 60 - 40 - - - 0 - 40 - - - false - - - Miniature Round - - - Label Orientation - Directional - - - Alpha - 100 - - - Body - - - - Value - - - - Orientation - DEFAULT - - - Type - MiniRound1 - - - Border - - - - Voltage - - - - Display - BOTH - - - Label - - - - Current - - - - - - 0 - 0 - - - 40 - 0 - - - 40 - 40 - - - 0 - 40 - - - false - - - In-line - - - Label Orientation - Directional - - - Alpha - 100 - - - Body - - - - Value - - - - Orientation - DEFAULT - - - Type - InLine - - - Border - - - - Voltage - - - - Display - BOTH - - - Label - - - - Current - - - - - - 0 - 0 - - - 0 - 40 - - - 0 - 80 - - - 0 - 120 - - - false - - - Passive.Potentiometer @@ -982,6 +758,316 @@ + + Semiconductors.Bridge Rectifier + + + Miniature Rectangular + + + Label Orientation + Directional + + + Value + + + + Body + + 128 + 128 + 128 + 255 + + + + Alpha + 127 + + + Orientation + DEFAULT + + + Border + + 89 + 89 + 89 + 255 + + + + Type + MiniDIP1 + + + Display + BOTH + + + Voltage + + + + Label + + 255 + 255 + 255 + 255 + + + + Current + + + + + + 0 + 0 + + + 60 + 0 + + + 60 + 40 + + + 0 + 40 + + + false + + + Miniature Round + + + Label Orientation + Directional + + + Value + + + + Body + + + + Alpha + 100 + + + Orientation + DEFAULT + + + Border + + + + Type + MiniRound1 + + + Display + BOTH + + + Voltage + + + + Label + + + + Current + + + + + + 0 + 0 + + + 40 + 0 + + + 40 + 40 + + + 0 + 40 + + + false + + + In-line + + + Label Orientation + Directional + + + Value + + + + Body + + + + Alpha + 100 + + + Orientation + DEFAULT + + + Border + + + + Type + InLine + + + Display + BOTH + + + Voltage + + + + Label + + + + Current + + + + + + 0 + 0 + + + 0 + 40 + + + 0 + 80 + + + 0 + 120 + + + false + + + Square BR-3 + + + Label Orientation + Horizontal + + + Alpha + 100 + + + Body + + 128 + 128 + 128 + 255 + + + + Value + + + + Orientation + DEFAULT + + + Type + SquareBR3 + + + Border + + 89 + 89 + 89 + 255 + + + + Voltage + + + + Display + BOTH + + + Label + + 255 + 255 + 255 + 255 + + + + Current + + 3.0 + A + + + + + + 0 + 0 + + + 85 + 0 + + + 0 + 85 + + + 85 + 85 + + + false + + + Passive.Multi-Section Capacitor @@ -1005,10 +1091,8 @@ - Value - - - + Alpha + 127 Body @@ -1020,8 +1104,10 @@ - Alpha - 127 + Value + + + Orientation @@ -1036,14 +1122,14 @@ 255 - - Voltage - - Display BOTH + + Voltage + + Label @@ -1095,8 +1181,12 @@ - Alpha - 127 + Value + + + + + Body @@ -1108,12 +1198,8 @@ - Value - - - - - + Alpha + 127 Orientation @@ -1128,14 +1214,14 @@ 255 - - Display - BOTH - Voltage + + Display + BOTH + Label @@ -1195,13 +1281,8 @@ - Value - - - - - - + Alpha + 127 Body @@ -1213,8 +1294,13 @@ - Alpha - 127 + Value + + + + + + Orientation @@ -1229,14 +1315,14 @@ 255 - - Voltage - - Display BOTH + + Voltage + + Label @@ -1292,19 +1378,19 @@ - Value - - - - + Alpha + 127 Body - Alpha - 127 + Value + + + + Orientation @@ -1314,14 +1400,14 @@ Border - - Voltage - - Display BOTH + + Voltage + + Label @@ -1349,241 +1435,6 @@ - - Semiconductors.DIP IC - - - DIP8 - - - Row Spacing - - 0.3 - in - - - - Pins - _8 - - - Alpha - 127 - - - Body - - - - Value - - - - Orientation - DEFAULT - - - Border - - 89 - 89 - 89 - 255 - - - - Display - BOTH - - - Label - - - - Display Pin #s - NO - - - Indent - - 89 - 89 - 89 - 255 - - - - Pin Spacing - - 0.1 - in - - - - - - 0 - 0 - - - 0 - 20 - - - 0 - 40 - - - 0 - 60 - - - 60 - 0 - - - 60 - 20 - - - 60 - 40 - - - 60 - 60 - - - false - - - DIP16 - - - Row Spacing - - 0.3 - in - - - - Pins - _16 - - - Alpha - 127 - - - Body - - - - Value - - - - Orientation - DEFAULT - - - Border - - - - Display - BOTH - - - Label - - - - Display Pin #s - NO - - - Indent - - - - Pin Spacing - - 0.1 - in - - - - - - 0 - 0 - - - 0 - 20 - - - 0 - 40 - - - 0 - 60 - - - 0 - 80 - - - 0 - 100 - - - 0 - 120 - - - 0 - 140 - - - 60 - 0 - - - 60 - 20 - - - 60 - 40 - - - 60 - 60 - - - 60 - 80 - - - 60 - 100 - - - 60 - 120 - - - 60 - 140 - - - false - - - Passive.Resistor @@ -2480,20 +2331,255 @@ + + Semiconductors.DIP IC + + + DIP8 + + + Pins + _8 + + + Row Spacing + + 0.3 + in + + + + Value + + + + Body + + + + Alpha + 127 + + + Orientation + DEFAULT + + + Border + + 89 + 89 + 89 + 255 + + + + Display + BOTH + + + Label + + + + Display Pin #s + NO + + + Indent + + 89 + 89 + 89 + 255 + + + + Pin Spacing + + 0.1 + in + + + + + + 0 + 0 + + + 0 + 20 + + + 0 + 40 + + + 0 + 60 + + + 60 + 0 + + + 60 + 20 + + + 60 + 40 + + + 60 + 60 + + + false + + + DIP16 + + + Pins + _16 + + + Row Spacing + + 0.3 + in + + + + Value + + + + Body + + + + Alpha + 127 + + + Orientation + DEFAULT + + + Border + + + + Display + BOTH + + + Label + + + + Display Pin #s + NO + + + Indent + + + + Pin Spacing + + 0.1 + in + + + + + + 0 + 0 + + + 0 + 20 + + + 0 + 40 + + + 0 + 60 + + + 0 + 80 + + + 0 + 100 + + + 0 + 120 + + + 0 + 140 + + + 60 + 0 + + + 60 + 20 + + + 60 + 40 + + + 60 + 60 + + + 60 + 80 + + + 60 + 100 + + + 60 + 120 + + + 60 + 140 + + + false + + + Tubes.Tube Socket Noval - - Base - B9A - Angle 0 + + Base + B9A + Alpha 127 @@ -2559,14 +2645,14 @@ Octal - - Base - OCTAL - Angle 0 + + Base + OCTAL + Alpha 127 @@ -2628,6 +2714,10 @@ Covered PAF-Style + + Alpha + 127 + Bobin 1 @@ -2637,18 +2727,6 @@ 255 - - Alpha - 127 - - - Model - - - - Orientation - DEFAULT - Pole Color @@ -2658,6 +2736,14 @@ 255 + + Orientation + DEFAULT + + + Model + + Bobin 2 @@ -2704,10 +2790,6 @@ Uncovered PAF-Style - - Alpha - 127 - Bobin 1 @@ -2717,6 +2799,18 @@ 255 + + Alpha + 127 + + + Model + + + + Orientation + DEFAULT + Pole Color @@ -2726,14 +2820,6 @@ 255 - - Orientation - DEFAULT - - - Model - - Bobin 2 @@ -2780,10 +2866,6 @@ EMG-style - - Alpha - 127 - Bobin 1 @@ -2793,6 +2875,18 @@ 255 + + Alpha + 127 + + + Model + + + + Orientation + DEFAULT + Pole Color @@ -2802,14 +2896,6 @@ 255 - - Orientation - DEFAULT - - - Model - - Bobin 2 @@ -2856,6 +2942,10 @@ Filtertron-style + + Alpha + 127 + Bobin 1 @@ -2865,18 +2955,6 @@ 255 - - Alpha - 127 - - - Model - - - - Orientation - DEFAULT - Pole Color @@ -2886,6 +2964,14 @@ 255 + + Orientation + DEFAULT + + + Model + + Bobin 2 @@ -2899,14 +2985,14 @@ Type Filtertron - - Cover - true - Legs false + + Cover + true + Pole Pieces 1 Screws