From bdfd130fb7c251fec1bf8d1f4dffc42c9841887d Mon Sep 17 00:00:00 2001 From: Bane Stojkovic Date: Tue, 8 Nov 2022 00:02:57 +0100 Subject: [PATCH] Added 'Tubular Beveled' shape option to Resistor component and added Dale CCF55 and CCF60 variants --- .../src/org/diylc/presenter/update.xml | 4 + .../src/org/diylc/presenter/variants.xml | 150 ++++++++++++++++++ .../diylc/components/passive/Resistor.java | 21 ++- 3 files changed, 169 insertions(+), 6 deletions(-) diff --git a/diylc/diylc-core/src/org/diylc/presenter/update.xml b/diylc/diylc-core/src/org/diylc/presenter/update.xml index dec46b29..ca623f9f 100644 --- a/diylc/diylc-core/src/org/diylc/presenter/update.xml +++ b/diylc/diylc-core/src/org/diylc/presenter/update.xml @@ -4138,6 +4138,10 @@ NEW_FEATURE Radial Mica Capacitor - added standard models from Cornell Dubilier CD10, CD15, CD19, CD30, CD42, CDV19, CDV30 datasheet + + NEW_FEATURE + Added 'Tubular Beveled' shape option to Resistor component and added Dale CCF55 and CCF60 variants + https://github.com/bancika/diy-layout-creator/releases diff --git a/diylc/diylc-core/src/org/diylc/presenter/variants.xml b/diylc/diylc-core/src/org/diylc/presenter/variants.xml index ca4add1e..025054d8 100644 --- a/diylc/diylc-core/src/org/diylc/presenter/variants.xml +++ b/diylc/diylc-core/src/org/diylc/presenter/variants.xml @@ -920,6 +920,156 @@ false 2022-10-30T13:25:15.3894874 + + Dale CCF55 + + + Power Rating + + + + Shape + Tubular_Beveled + + + Color + + + + Moveable Label + false + + + Label Orientation + Directional + + + Reverse (standing) + false + + + Font Size Override + + + + Lead Color + + + + Length + + + + Label Color + + + + Value + + + + Alpha + 127 + + + Color code + _5_BAND + + + Width + + + + Border + + + + Display + NAME + + + + + + + false + 2022-11-07T23:50:13.9473581 + + + Dale CCF60 + + + Power Rating + + + + Shape + Tubular_Beveled + + + Color + + + + Moveable Label + false + + + Label Orientation + Directional + + + Reverse (standing) + false + + + Font Size Override + + + + Lead Color + + + + Length + + + + Label Color + + + + Value + + + + Alpha + 127 + + + Color code + _5_BAND + + + Width + + + + Border + + + + Display + NAME + + + + + + + false + 2022-11-07T23:48:34.7774065 + diff --git a/diylc/diylc-library/src/org/diylc/components/passive/Resistor.java b/diylc/diylc-library/src/org/diylc/components/passive/Resistor.java index d99261b3..eb6f7c0b 100644 --- a/diylc/diylc-library/src/org/diylc/components/passive/Resistor.java +++ b/diylc/diylc-library/src/org/diylc/components/passive/Resistor.java @@ -29,6 +29,7 @@ import java.awt.geom.Area; import java.awt.geom.Ellipse2D; import java.awt.geom.Line2D; import java.awt.geom.Rectangle2D; +import java.awt.geom.RoundRectangle2D; import org.diylc.common.ObjectCache; import org.diylc.common.ResistorColorCode; import org.diylc.components.AbstractLeadedComponent; @@ -157,17 +158,20 @@ public class Resistor extends AbstractLeadedComponent { } @Override - protected Shape getBodyShape() { - if (getShape() == ResistorShape.Standard) { - double length = getLength().convertToPixels(); - double width = getClosestOdd(getWidth().convertToPixels()); + protected Shape getBodyShape() { + double length = getLength().convertToPixels(); + double width = getClosestOdd(getWidth().convertToPixels()); + ResistorShape shape = getShape(); + if (shape == ResistorShape.Standard) { Rectangle2D rect = new Rectangle2D.Double(width / 2, width / 10, length - width, width * 8 / 10); Area a = new Area(rect); a.add(new Area(new Ellipse2D.Double(0, 0, width, width))); a.add(new Area(new Ellipse2D.Double(length - width, 0, width, width))); return a; + } else if (shape == ResistorShape.Tubular_Beveled) { + return new RoundRectangle2D.Double(0f, 0f, length, width, width * 2 / 3, width * 2 / 3); } - return new Rectangle2D.Double(0f, 0f, getLength().convertToPixels(), getClosestOdd(getWidth().convertToPixels())); + return new Rectangle2D.Double(0f, 0f, length, width); } @Override @@ -216,6 +220,11 @@ public class Resistor extends AbstractLeadedComponent { } public enum ResistorShape { - Tubular, Standard + Tubular, Tubular_Beveled, Standard; + + @Override + public String toString() { + return super.toString().replace('_', ' '); + } } }