Added 'Tubular Beveled' shape option to Resistor component and added Dale CCF55 and CCF60 variants

This commit is contained in:
Bane Stojkovic
2022-11-08 00:02:57 +01:00
parent 5cc652331e
commit bdfd130fb7
3 changed files with 169 additions and 6 deletions
@@ -4138,6 +4138,10 @@
<changeType>NEW_FEATURE</changeType>
<description>Radial Mica Capacitor - added standard models from Cornell Dubilier CD10, CD15, CD19, CD30, CD42, CDV19, CDV30 datasheet</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>NEW_FEATURE</changeType>
<description>Added 'Tubular Beveled' shape option to Resistor component and added Dale CCF55 and CCF60 variants</description>
</org.diylc.appframework.update.Change>
</changes>
<url>https://github.com/bancika/diy-layout-creator/releases</url>
</org.diylc.appframework.update.Version>
@@ -920,6 +920,156 @@
<defaultFlag>false</defaultFlag>
<createdOn>2022-10-30T13:25:15.3894874</createdOn>
</org.diylc.core.Template>
<org.diylc.core.Template>
<name>Dale CCF55</name>
<values>
<entry>
<string>Power Rating</string>
<null/>
</entry>
<entry>
<string>Shape</string>
<diylc.passive.Resistor_-ResistorShape>Tubular_Beveled</diylc.passive.Resistor_-ResistorShape>
</entry>
<entry>
<string>Color</string>
<awt-color hex="d37d5b"/>
</entry>
<entry>
<string>Moveable Label</string>
<boolean>false</boolean>
</entry>
<entry>
<string>Label Orientation</string>
<diylc.AbstractLeadedComponent_-LabelOriantation>Directional</diylc.AbstractLeadedComponent_-LabelOriantation>
</entry>
<entry>
<string>Reverse (standing)</string>
<boolean>false</boolean>
</entry>
<entry>
<string>Font Size Override</string>
<null/>
</entry>
<entry>
<string>Lead Color</string>
<awt-color hex="cccccc"/>
</entry>
<entry>
<string>Length</string>
<org.diylc.core.measures.Size value="6.22" unit="mm"/>
</entry>
<entry>
<string>Label Color</string>
<awt-color hex="000000"/>
</entry>
<entry>
<string>Value</string>
<null/>
</entry>
<entry>
<string>Alpha</string>
<byte>127</byte>
</entry>
<entry>
<string>Color code</string>
<org.diylc.common.ResistorColorCode>_5_BAND</org.diylc.common.ResistorColorCode>
</entry>
<entry>
<string>Width</string>
<org.diylc.core.measures.Size value="2.29" unit="mm"/>
</entry>
<entry>
<string>Border</string>
<awt-color hex="a04c2b"/>
</entry>
<entry>
<string>Display</string>
<org.diylc.common.Display>NAME</org.diylc.common.Display>
</entry>
</values>
<points>
<point x="0.0" y="0.0"/>
<point x="1.1" y="0.0"/>
</points>
<defaultFlag>false</defaultFlag>
<createdOn>2022-11-07T23:50:13.9473581</createdOn>
</org.diylc.core.Template>
<org.diylc.core.Template>
<name>Dale CCF60</name>
<values>
<entry>
<string>Power Rating</string>
<null/>
</entry>
<entry>
<string>Shape</string>
<diylc.passive.Resistor_-ResistorShape>Tubular_Beveled</diylc.passive.Resistor_-ResistorShape>
</entry>
<entry>
<string>Color</string>
<awt-color hex="d37d5b"/>
</entry>
<entry>
<string>Moveable Label</string>
<boolean>false</boolean>
</entry>
<entry>
<string>Label Orientation</string>
<diylc.AbstractLeadedComponent_-LabelOriantation>Directional</diylc.AbstractLeadedComponent_-LabelOriantation>
</entry>
<entry>
<string>Reverse (standing)</string>
<boolean>false</boolean>
</entry>
<entry>
<string>Font Size Override</string>
<null/>
</entry>
<entry>
<string>Lead Color</string>
<awt-color hex="cccccc"/>
</entry>
<entry>
<string>Length</string>
<org.diylc.core.measures.Size value="8.75" unit="mm"/>
</entry>
<entry>
<string>Label Color</string>
<awt-color hex="000000"/>
</entry>
<entry>
<string>Value</string>
<null/>
</entry>
<entry>
<string>Alpha</string>
<byte>127</byte>
</entry>
<entry>
<string>Color code</string>
<org.diylc.common.ResistorColorCode>_5_BAND</org.diylc.common.ResistorColorCode>
</entry>
<entry>
<string>Width</string>
<org.diylc.core.measures.Size value="3.53" unit="mm"/>
</entry>
<entry>
<string>Border</string>
<awt-color hex="a04c2b"/>
</entry>
<entry>
<string>Display</string>
<org.diylc.common.Display>NAME</org.diylc.common.Display>
</entry>
</values>
<points>
<point x="0.0" y="0.0"/>
<point x="1.1" y="0.0"/>
</points>
<defaultFlag>false</defaultFlag>
<createdOn>2022-11-07T23:48:34.7774065</createdOn>
</org.diylc.core.Template>
</list>
</entry>
<entry>
@@ -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<Resistance> {
}
@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<Resistance> {
}
public enum ResistorShape {
Tubular, Standard
Tubular, Tubular_Beveled, Standard;
@Override
public String toString() {
return super.toString().replace('_', ' ');
}
}
}