single coil improvement

This commit is contained in:
bancika
2017-01-25 11:24:47 +01:00
parent 2c4aba1557
commit fc7fd2aed8
2 changed files with 42 additions and 13 deletions
@@ -68,7 +68,7 @@ public class SingleCoilPickup extends AbstractTransparentComponent<String> {
private static Size RAIL_WIDTH = new Size(1.5d, SizeUnit.mm); private static Size RAIL_WIDTH = new Size(1.5d, SizeUnit.mm);
private static Size RAIL_LENGTH = new Size(60d, SizeUnit.mm); private static Size RAIL_LENGTH = new Size(60d, SizeUnit.mm);
private static Size RAIL_SPACING = new Size(7.5d, SizeUnit.mm); private static Size COIL_SPACING = new Size(7.5d, SizeUnit.mm);
private String value = ""; private String value = "";
private Point controlPoint = new Point(0, 0); private Point controlPoint = new Point(0, 0);
@@ -252,12 +252,30 @@ public class SingleCoilPickup extends AbstractTransparentComponent<String> {
/ 2 - poleSize / 2, poleSize, poleSize); / 2 - poleSize / 2, poleSize, poleSize);
poleArea.add(new Area(pole)); poleArea.add(new Area(pole));
} }
} else { } else if (getPolePieceType() == PolePieceType.RodHumbucker) {
int poleSize = (int) POLE_SIZE.convertToPixels() / 2;
int poleSpacing = (int) POLE_SPACING.convertToPixels();
int poleMargin = (length - poleSpacing * 5) / 2;
int coilSpacing = (int) COIL_SPACING.convertToPixels();
for (int i = 0; i < 6; i++) {
poleArea.add(new Area(new Ellipse2D.Double(x - length / 2 + poleMargin + i * poleSpacing - poleSize / 2, y
- coilOffset - width / 2 - poleSize / 2 - coilSpacing / 2, poleSize, poleSize)));
poleArea.add(new Area(new Ellipse2D.Double(x - length / 2 + poleMargin + i * poleSpacing - poleSize / 2, y
- coilOffset - width / 2 - poleSize / 2 + coilSpacing / 2, poleSize, poleSize)));
}
} else if (getPolePieceType() == PolePieceType.RailHumbucker) {
int railWidth = (int) RAIL_WIDTH.convertToPixels(); int railWidth = (int) RAIL_WIDTH.convertToPixels();
int railSpacing = (int) RAIL_SPACING.convertToPixels(); int railSpacing = (int) COIL_SPACING.convertToPixels();
int railLength = (int) RAIL_LENGTH.convertToPixels(); int railLength = (int) RAIL_LENGTH.convertToPixels();
poleArea.add(new Area(new Rectangle2D.Double(x - railLength / 2, y - coilOffset - width / 2 - railSpacing / 2 - railWidth / 2, railLength, railWidth))); poleArea.add(new Area(new Rectangle2D.Double(x - railLength / 2, y - coilOffset - width / 2 - railSpacing / 2
poleArea.add(new Area(new Rectangle2D.Double(x - railLength / 2, y - coilOffset - width / 2 + railSpacing / 2 - railWidth / 2, railLength, railWidth))); - railWidth / 2, railLength, railWidth)));
poleArea.add(new Area(new Rectangle2D.Double(x - railLength / 2, y - coilOffset - width / 2 + railSpacing / 2
- railWidth / 2, railLength, railWidth)));
} else if (getPolePieceType() == PolePieceType.Rail) {
int railWidth = 2 * (int) RAIL_WIDTH.convertToPixels();
int railLength = (int) RAIL_LENGTH.convertToPixels();
poleArea.add(new Area(new RoundRectangle2D.Double(x - railLength / 2, y - coilOffset - width / 2 - railWidth
/ 2, railLength, railWidth, railWidth / 2, railWidth / 2)));
} }
body[2] = poleArea; body[2] = poleArea;
@@ -433,6 +451,17 @@ public class SingleCoilPickup extends AbstractTransparentComponent<String> {
} }
public enum PolePieceType { public enum PolePieceType {
Rods, Rails; Rods("Single Rods"), Rail("Single Rail"), RailHumbucker("Dual Rail Humbucker"), RodHumbucker("Dual Rods");
private String label;
private PolePieceType(String label) {
this.label = label;
}
@Override
public String toString() {
return label;
}
} }
} }
+1 -1
View File
@@ -1588,7 +1588,7 @@
</org.diylc.appframework.update.Change> </org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change> <org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType> <changeType>IMPROVEMENT</changeType>
<description>Select single coil pickup pole pieces (rods or rails) and pole piece color</description> <description>Editable single coil pickup pole pieces (rods or rails) and pole piece color</description>
</org.diylc.appframework.update.Change> </org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change> <org.diylc.appframework.update.Change>
<changeType>BUG_FIX</changeType> <changeType>BUG_FIX</changeType>