cleanup relay

This commit is contained in:
bancika
2016-12-23 13:22:24 +01:00
parent 3fbec7fb13
commit 58a794e8a7
4 changed files with 2 additions and 14 deletions
Binary file not shown.
@@ -190,7 +190,7 @@ public class SubminiatureDILRelay extends AbstractTransparentComponent<String> {
int dx2; int dx2;
int dy2; int dy2;
for (int i = 0; i < pinCount.getValue(); i++) { for (int i = 0; i < pinCount.getValue(); i++) {
int spacing = i == 0 ? 0 : sectionSpacing + (i - 1) * pinSpacing; int spacing = i == pinCount.getValue() - 1 ? sectionSpacing + (i - 1) * pinSpacing : i * pinSpacing;
switch (orientation) { switch (orientation) {
case DEFAULT: case DEFAULT:
dx1 = 0; dx1 = 0;
@@ -227,12 +227,8 @@ public class SubminiatureDILRelay extends AbstractTransparentComponent<String> {
public Area[] getBody() { public Area[] getBody() {
if (body == null) { if (body == null) {
body = new Area[2]; body = new Area[2];
int x = controlPoints[0].x;
int y = controlPoints[0].y;
int pinSize = (int) PIN_SIZE.convertToPixels(); int pinSize = (int) PIN_SIZE.convertToPixels();
int pinSpacing = (int) this.pinSpacing.convertToPixels();
int rowSpacing = (int) this.rowSpacing.convertToPixels();
int minX = Integer.MAX_VALUE; int minX = Integer.MAX_VALUE;
int maxX = Integer.MIN_VALUE; int maxX = Integer.MIN_VALUE;
@@ -255,29 +251,21 @@ public class SubminiatureDILRelay extends AbstractTransparentComponent<String> {
int indentationSize = getClosestOdd(INDENT_SIZE.convertToPixels()); int indentationSize = getClosestOdd(INDENT_SIZE.convertToPixels());
switch (orientation) { switch (orientation) {
case DEFAULT: case DEFAULT:
x += pinSize / 2;
y -= pinSpacing / 2;
indentation = indentation =
new Area(new Rectangle2D.Double(minX + width / 2 - indentationSize / 2, minY - indentationSize / 2 new Area(new Rectangle2D.Double(minX + width / 2 - indentationSize / 2, minY - indentationSize / 2
- pinSize, indentationSize, indentationSize)); - pinSize, indentationSize, indentationSize));
break; break;
case _90: case _90:
x -= (pinSpacing / 2) + width - pinSpacing;
y += pinSize / 2;
indentation = indentation =
new Area(new Rectangle2D.Double(minX + width - indentationSize / 2 + pinSize, minY + height / 2 new Area(new Rectangle2D.Double(minX + width - indentationSize / 2 + pinSize, minY + height / 2
- indentationSize / 2, indentationSize, indentationSize)); - indentationSize / 2, indentationSize, indentationSize));
break; break;
case _180: case _180:
x -= rowSpacing - pinSize / 2;
y -= (pinSpacing / 2) + height - pinSpacing;
indentation = indentation =
new Area(new Rectangle2D.Double(minX + width / 2 - indentationSize / 2, minY + height - indentationSize new Area(new Rectangle2D.Double(minX + width / 2 - indentationSize / 2, minY + height - indentationSize
/ 2 + pinSize, indentationSize, indentationSize)); / 2 + pinSize, indentationSize, indentationSize));
break; break;
case _270: case _270:
x -= pinSpacing / 2;
y += pinSize / 2 - rowSpacing;
indentation = indentation =
new Area(new Rectangle2D.Double(minX - indentationSize / 2 - pinSize, minY + height / 2 - indentationSize new Area(new Rectangle2D.Double(minX - indentationSize / 2 - pinSize, minY + height / 2 - indentationSize
/ 2, indentationSize, indentationSize)); / 2, indentationSize, indentationSize));
@@ -291,7 +279,7 @@ public class SubminiatureDILRelay extends AbstractTransparentComponent<String> {
* pinSize, EDGE_RADIUS, EDGE_RADIUS)); * pinSize, EDGE_RADIUS, EDGE_RADIUS));
body[1] = indentation; body[1] = indentation;
if (indentation != null) { if (indentation != null) {
indentation.intersect(body[0]); indentation.intersect(body[0]);
} }
} }
return body; return body;
Binary file not shown.
Binary file not shown.