Added "Duodecar B12C" tube socket type

This commit is contained in:
bancika
2020-04-04 18:52:10 +02:00
parent 571391f27c
commit 0e95d4883a
3 changed files with 25 additions and 4 deletions
@@ -2858,6 +2858,10 @@
<changeType>NEW_FEATURE</changeType> <changeType>NEW_FEATURE</changeType>
<description>Added few out-of-the-box building blocks that can be deleted if unwanted</description> <description>Added few out-of-the-box building blocks that can be deleted if unwanted</description>
</org.diylc.appframework.update.Change> </org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>NEW_FEATURE</changeType>
<description>Added "Duodecar B12C" tube socket type</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change> <org.diylc.appframework.update.Change>
<changeType>BUG_FIX</changeType> <changeType>BUG_FIX</changeType>
<description>Choosing a default theme in the Config menut causes the app to fail to start and some components to fail to render</description> <description>Choosing a default theme in the Config menut causes the app to fail to start and some components to fail to render</description>
@@ -64,10 +64,15 @@ public class TubeSocket extends AbstractTransparentComponent<String> {
private static final Size B7G_PIN_SPACING = new Size(12d, SizeUnit.mm); private static final Size B7G_PIN_SPACING = new Size(12d, SizeUnit.mm);
private static final Size B7G_CUTOUT_DIAMETER = new Size(4d, SizeUnit.mm); private static final Size B7G_CUTOUT_DIAMETER = new Size(4d, SizeUnit.mm);
private static final Size B9A_CUTOUT_DIAMETER = new Size(5.5d, SizeUnit.mm); private static final Size B9A_CUTOUT_DIAMETER = new Size(5.5d, SizeUnit.mm);
private static final Size B12C_HOLE_SIZE = new Size(10d, SizeUnit.mm);
private static final Size B12C_CUTOUT_DIAMETER = new Size(5.5d, SizeUnit.mm);
private static final Size B12C_PIN_SPACING_PCB = new Size(25d, SizeUnit.mm);
private static final Size B12C_PIN_SPACING_CHASSIS = new Size(22d, SizeUnit.mm);
private static final Size OCTAL_DIAMETER = new Size(25d, SizeUnit.mm); private static final Size OCTAL_DIAMETER = new Size(25d, SizeUnit.mm);
private static final Size B9A_DIAMETER = new Size(3 / 4d, SizeUnit.in); private static final Size B9A_DIAMETER = new Size(3 / 4d, SizeUnit.in);
private static final Size B7G_DIAMETER = new Size(17d, SizeUnit.mm); private static final Size B7G_DIAMETER = new Size(17d, SizeUnit.mm);
private static final Size B12C_DIAMETER = new Size(30d, SizeUnit.mm);
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -181,6 +186,11 @@ public class TubeSocket extends AbstractTransparentComponent<String> {
pinCount = 9; pinCount = 9;
pinSpacing = getClosestOdd(getMount() == Mount.PCB ? B9A_PIN_SPACING_PCB.convertToPixels() : B9A_PIN_SPACING_CHASSIS.convertToPixels()); pinSpacing = getClosestOdd(getMount() == Mount.PCB ? B9A_PIN_SPACING_PCB.convertToPixels() : B9A_PIN_SPACING_CHASSIS.convertToPixels());
hasEmptySpace = true; hasEmptySpace = true;
break;
case B12C:
pinCount = 12;
pinSpacing = getClosestOdd(getMount() == Mount.PCB ? B12C_PIN_SPACING_PCB.convertToPixels() : B12C_PIN_SPACING_CHASSIS.convertToPixels());
hasEmptySpace = true;
break; break;
default: default:
throw new RuntimeException("Unexpected base: " + base); throw new RuntimeException("Unexpected base: " + base);
@@ -211,6 +221,9 @@ public class TubeSocket extends AbstractTransparentComponent<String> {
break; break;
case OCTAL: case OCTAL:
bodyDiameter = getClosestOdd(OCTAL_DIAMETER.convertToPixels()); bodyDiameter = getClosestOdd(OCTAL_DIAMETER.convertToPixels());
break;
case B12C:
bodyDiameter = getClosestOdd(B12C_DIAMETER.convertToPixels());
break; break;
default: default:
throw new RuntimeException("Unexpected base: " + base); throw new RuntimeException("Unexpected base: " + base);
@@ -220,7 +233,7 @@ public class TubeSocket extends AbstractTransparentComponent<String> {
new Ellipse2D.Double(controlPoints[0].x - bodyDiameter / 2, controlPoints[0].y - bodyDiameter / 2, new Ellipse2D.Double(controlPoints[0].x - bodyDiameter / 2, controlPoints[0].y - bodyDiameter / 2,
bodyDiameter, bodyDiameter); bodyDiameter, bodyDiameter);
Area bodyArea = new Area(body); Area bodyArea = new Area(body);
int holeSize = getClosestOdd(HOLE_SIZE.convertToPixels()); int holeSize = getClosestOdd(base == Base.B12C ? B12C_HOLE_SIZE.convertToPixels() : HOLE_SIZE.convertToPixels());
bodyArea.subtract(new Area(new Ellipse2D.Double(controlPoints[0].x - holeSize / 2, controlPoints[0].y - holeSize bodyArea.subtract(new Area(new Ellipse2D.Double(controlPoints[0].x - holeSize / 2, controlPoints[0].y - holeSize
/ 2, holeSize, holeSize))); / 2, holeSize, holeSize)));
@@ -239,7 +252,11 @@ public class TubeSocket extends AbstractTransparentComponent<String> {
double cutoutDiameter = getClosestOdd(B7G_CUTOUT_DIAMETER.convertToPixels()); double cutoutDiameter = getClosestOdd(B7G_CUTOUT_DIAMETER.convertToPixels());
bodyArea.subtract(new Area(new Ellipse2D.Double(controlPoints[0].x - cutoutDiameter / 2, controlPoints[0].y - bodyDiameter / 2 - cutoutDiameter * 3 / 4, cutoutDiameter, cutoutDiameter))); bodyArea.subtract(new Area(new Ellipse2D.Double(controlPoints[0].x - cutoutDiameter / 2, controlPoints[0].y - bodyDiameter / 2 - cutoutDiameter * 3 / 4, cutoutDiameter, cutoutDiameter)));
bodyArea.subtract(new Area(new Ellipse2D.Double(controlPoints[0].x - cutoutDiameter / 2, controlPoints[0].y + bodyDiameter / 2 - cutoutDiameter / 4, cutoutDiameter, cutoutDiameter))); bodyArea.subtract(new Area(new Ellipse2D.Double(controlPoints[0].x - cutoutDiameter / 2, controlPoints[0].y + bodyDiameter / 2 - cutoutDiameter / 4, cutoutDiameter, cutoutDiameter)));
} } else if (base == Base.B12C && getMount() == Mount.CHASSIS) {
double cutoutDiameter = getClosestOdd(B12C_CUTOUT_DIAMETER.convertToPixels());
bodyArea.subtract(new Area(new Ellipse2D.Double(controlPoints[0].x - cutoutDiameter / 2, controlPoints[0].y - bodyDiameter / 2 - cutoutDiameter * 3 / 4, cutoutDiameter, cutoutDiameter)));
bodyArea.subtract(new Area(new Ellipse2D.Double(controlPoints[0].x - cutoutDiameter / 2, controlPoints[0].y + bodyDiameter / 2 - cutoutDiameter / 4, cutoutDiameter, cutoutDiameter)));
}
body = bodyArea; body = bodyArea;
} }
@@ -388,7 +405,7 @@ public class TubeSocket extends AbstractTransparentComponent<String> {
@EditableProperty(name = "Electrode Labels") @EditableProperty(name = "Electrode Labels")
public String getElectrodeLabels() { public String getElectrodeLabels() {
if (electrodeLabels == null) if (electrodeLabels == null)
electrodeLabels = "1,2,3,4,5,6,7,8,9"; electrodeLabels = "1,2,3,4,5,6,7,8,9,10,11,12";
return electrodeLabels; return electrodeLabels;
} }
@@ -423,7 +440,7 @@ public class TubeSocket extends AbstractTransparentComponent<String> {
} }
public static enum Base { public static enum Base {
B9A("Noval B9A"), OCTAL("Octal"), B7G("Small-button B7G"); B9A("Noval B9A"), OCTAL("Octal"), B7G("Small-button B7G"), B12C("Duodecar B12C");
String name; String name;
Binary file not shown.