mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 09:12:09 +10:00
Select single coil pickup pole pieces (rods or rails) and pole piece
color
This commit is contained in:
Binary file not shown.
@@ -66,13 +66,19 @@ public class SingleCoilPickup extends AbstractTransparentComponent<String> {
|
|||||||
private static Size POLE_SIZE = new Size(4d, SizeUnit.mm);
|
private static Size POLE_SIZE = new Size(4d, SizeUnit.mm);
|
||||||
private static Size POLE_SPACING = new Size(11.68d, SizeUnit.mm);
|
private static Size POLE_SPACING = new Size(11.68d, 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_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);
|
||||||
transient Shape[] body;
|
transient Shape[] body;
|
||||||
private Orientation orientation = Orientation.DEFAULT;
|
private Orientation orientation = Orientation.DEFAULT;
|
||||||
private Color color = BODY_COLOR;
|
private Color color = BODY_COLOR;
|
||||||
|
private Color poleColor = METAL_COLOR;
|
||||||
private Color baseColor = BASE_COLOR;
|
private Color baseColor = BASE_COLOR;
|
||||||
private SingleCoilType type = SingleCoilType.Stratocaster;
|
private SingleCoilType type = SingleCoilType.Stratocaster;
|
||||||
|
private PolePieceType polePieceType = PolePieceType.Rods;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
||||||
@@ -135,9 +141,9 @@ public class SingleCoilPickup extends AbstractTransparentComponent<String> {
|
|||||||
g2d.draw(body[3]);
|
g2d.draw(body[3]);
|
||||||
|
|
||||||
if (componentState != ComponentState.DRAGGING && !outlineMode) {
|
if (componentState != ComponentState.DRAGGING && !outlineMode) {
|
||||||
g2d.setColor(METAL_COLOR.darker());
|
g2d.setColor(getPoleColor().darker());
|
||||||
g2d.draw(body[2]);
|
g2d.draw(body[2]);
|
||||||
g2d.setColor(METAL_COLOR);
|
g2d.setColor(getPoleColor());
|
||||||
g2d.fill(body[2]);
|
g2d.fill(body[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,16 +241,25 @@ public class SingleCoilPickup extends AbstractTransparentComponent<String> {
|
|||||||
|
|
||||||
body[1] = new Area(new Ellipse2D.Double(x - pointSize / 2, y - pointSize / 2, pointSize, pointSize));
|
body[1] = new Area(new Ellipse2D.Double(x - pointSize / 2, y - pointSize / 2, pointSize, pointSize));
|
||||||
|
|
||||||
int poleSize = (int) POLE_SIZE.convertToPixels();
|
|
||||||
int poleSpacing = (int) POLE_SPACING.convertToPixels();
|
|
||||||
int poleMargin = (length - poleSpacing * 5) / 2;
|
|
||||||
Area poleArea = new Area();
|
Area poleArea = new Area();
|
||||||
for (int i = 0; i < 6; i++) {
|
if (getPolePieceType() == PolePieceType.Rods) {
|
||||||
Ellipse2D pole =
|
int poleSize = (int) POLE_SIZE.convertToPixels();
|
||||||
new Ellipse2D.Double(x - length / 2 + poleMargin + i * poleSpacing - poleSize / 2, y - coilOffset - width
|
int poleSpacing = (int) POLE_SPACING.convertToPixels();
|
||||||
/ 2 - poleSize / 2, poleSize, poleSize);
|
int poleMargin = (length - poleSpacing * 5) / 2;
|
||||||
poleArea.add(new Area(pole));
|
for (int i = 0; i < 6; i++) {
|
||||||
|
Ellipse2D pole =
|
||||||
|
new Ellipse2D.Double(x - length / 2 + poleMargin + i * poleSpacing - poleSize / 2, y - coilOffset - width
|
||||||
|
/ 2 - poleSize / 2, poleSize, poleSize);
|
||||||
|
poleArea.add(new Area(pole));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
int railWidth = (int) RAIL_WIDTH.convertToPixels();
|
||||||
|
int railSpacing = (int) RAIL_SPACING.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 - railWidth / 2, railLength, railWidth)));
|
||||||
}
|
}
|
||||||
|
|
||||||
body[2] = poleArea;
|
body[2] = poleArea;
|
||||||
|
|
||||||
body[3] =
|
body[3] =
|
||||||
@@ -320,6 +335,19 @@ public class SingleCoilPickup extends AbstractTransparentComponent<String> {
|
|||||||
body = null;
|
body = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Pole Pieces")
|
||||||
|
public PolePieceType getPolePieceType() {
|
||||||
|
if (polePieceType == null)
|
||||||
|
polePieceType = PolePieceType.Rods;
|
||||||
|
return polePieceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPolePieceType(PolePieceType polePieceType) {
|
||||||
|
this.polePieceType = polePieceType;
|
||||||
|
// Invalidate the body
|
||||||
|
body = null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getControlPointCount() {
|
public int getControlPointCount() {
|
||||||
return 1;
|
return 1;
|
||||||
@@ -389,7 +417,22 @@ public class SingleCoilPickup extends AbstractTransparentComponent<String> {
|
|||||||
this.baseColor = baseColor;
|
this.baseColor = baseColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Pole Color")
|
||||||
|
public Color getPoleColor() {
|
||||||
|
if (poleColor == null)
|
||||||
|
poleColor = METAL_COLOR;
|
||||||
|
return poleColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPoleColor(Color poleColor) {
|
||||||
|
this.poleColor = poleColor;
|
||||||
|
}
|
||||||
|
|
||||||
public enum SingleCoilType {
|
public enum SingleCoilType {
|
||||||
Stratocaster, Telecaster;
|
Stratocaster, Telecaster;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum PolePieceType {
|
||||||
|
Rods, Rails;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -1586,9 +1586,13 @@
|
|||||||
<changeType>IMPROVEMENT</changeType>
|
<changeType>IMPROVEMENT</changeType>
|
||||||
<description>Improved resistor rendering to look more realistic</description>
|
<description>Improved resistor rendering to look more realistic</description>
|
||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>IMPROVEMENT</changeType>
|
||||||
|
<description>Select 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>
|
||||||
<changeType>BUG_FIX</changeType>
|
<changeType>BUG_FIX</changeType>
|
||||||
<description>Component type gets selected while expanding folders in component tree</description>
|
<description>Component type gets selected while expanding folders in the component tree</description>
|
||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
</changes>
|
</changes>
|
||||||
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||||
|
|||||||
Reference in New Issue
Block a user