mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-12 02:02:16 +10:00
jack outline
This commit is contained in:
+58
-48
@@ -43,7 +43,7 @@ public class CliffJack1_4 extends AbstractTransparentComponent<String> {
|
||||
private static Color NUT_COLOR = Color.decode("#999999");
|
||||
private static Color BORDER_COLOR = Color.black;
|
||||
private static Color LABEL_COLOR = Color.white;
|
||||
private static Size BODY_WIDTH = new Size(3/4d, SizeUnit.in);
|
||||
private static Size BODY_WIDTH = new Size(3 / 4d, SizeUnit.in);
|
||||
private static Size BODY_LENGTH = new Size(0.9d, SizeUnit.in);
|
||||
private static Size TAIL_LENGTH = new Size(0.1d, SizeUnit.in);
|
||||
|
||||
@@ -78,7 +78,8 @@ public class CliffJack1_4 extends AbstractTransparentComponent<String> {
|
||||
// Apply rotation if necessary
|
||||
double angle = getAngle();
|
||||
if (angle != 0) {
|
||||
AffineTransform rotation = AffineTransform.getRotateInstance(angle, x, y);
|
||||
AffineTransform rotation = AffineTransform.getRotateInstance(angle,
|
||||
x, y);
|
||||
for (int i = 1; i < controlPoints.length; i++) {
|
||||
rotation.transform(controlPoints[i], controlPoints[i]);
|
||||
}
|
||||
@@ -114,32 +115,33 @@ public class CliffJack1_4 extends AbstractTransparentComponent<String> {
|
||||
int bodyWidth = (int) BODY_WIDTH.convertToPixels();
|
||||
int centerX = (controlPoints[0].x + controlPoints[3].x) / 2;
|
||||
int centerY = (controlPoints[0].y + controlPoints[3].y) / 2;
|
||||
body[0] = new Rectangle(centerX - bodyLength / 2, centerY - bodyWidth / 2, bodyLength,
|
||||
bodyWidth);
|
||||
body[0] = new Rectangle(centerX - bodyLength / 2, centerY
|
||||
- bodyWidth / 2, bodyLength, bodyWidth);
|
||||
|
||||
int tailLength = (int) TAIL_LENGTH.convertToPixels();
|
||||
body[1] = new RoundRectangle2D.Double(centerX - bodyLength / 2 - tailLength, centerY
|
||||
- bodyWidth / 4, tailLength * 2, bodyWidth / 2, tailLength, tailLength);
|
||||
body[1] = new RoundRectangle2D.Double(centerX - bodyLength / 2
|
||||
- tailLength, centerY - bodyWidth / 4, tailLength * 2,
|
||||
bodyWidth / 2, tailLength, tailLength);
|
||||
Area tailArea = new Area(body[1]);
|
||||
tailArea.subtract(new Area(body[0]));
|
||||
body[1] = tailArea;
|
||||
|
||||
body[2] = new Rectangle(centerX + bodyLength / 2, centerY - bodyWidth / 4, tailLength,
|
||||
bodyWidth / 2);
|
||||
body[2] = new Rectangle(centerX + bodyLength / 2, centerY
|
||||
- bodyWidth / 4, tailLength, bodyWidth / 2);
|
||||
|
||||
body[3] = new Rectangle(centerX + bodyLength / 2 + tailLength, centerY - bodyWidth / 4,
|
||||
tailLength, bodyWidth / 2);
|
||||
body[3] = new Rectangle(centerX + bodyLength / 2 + tailLength,
|
||||
centerY - bodyWidth / 4, tailLength, bodyWidth / 2);
|
||||
tailArea = new Area(body[3]);
|
||||
int radius = bodyLength / 2 + tailLength * 2;
|
||||
tailArea.intersect(new Area(new Ellipse2D.Double(centerX - radius, centerY - radius,
|
||||
radius * 2, radius * 2)));
|
||||
tailArea.intersect(new Area(new Ellipse2D.Double(centerX - radius,
|
||||
centerY - radius, radius * 2, radius * 2)));
|
||||
body[3] = tailArea;
|
||||
|
||||
// Apply rotation if necessary
|
||||
double angle = getAngle();
|
||||
if (angle != 0) {
|
||||
AffineTransform rotation = AffineTransform.getRotateInstance(angle, centerX,
|
||||
centerY);
|
||||
AffineTransform rotation = AffineTransform.getRotateInstance(
|
||||
angle, centerX, centerY);
|
||||
for (int i = 0; i < body.length; i++) {
|
||||
if (body[i] != null) {
|
||||
Area area = new Area(body[i]);
|
||||
@@ -157,12 +159,13 @@ public class CliffJack1_4 extends AbstractTransparentComponent<String> {
|
||||
for (int i = 0; i < getControlPointCount(); i++) {
|
||||
Point point = getControlPoint(i);
|
||||
Rectangle pin;
|
||||
if (orientation == Orientation.DEFAULT || orientation == Orientation._180) {
|
||||
pin = new Rectangle(point.x - pinWidth / 2, point.y - pinThickness / 2,
|
||||
pinWidth, pinThickness);
|
||||
if (orientation == Orientation.DEFAULT
|
||||
|| orientation == Orientation._180) {
|
||||
pin = new Rectangle(point.x - pinWidth / 2, point.y
|
||||
- pinThickness / 2, pinWidth, pinThickness);
|
||||
} else {
|
||||
pin = new Rectangle(point.x - pinThickness / 2, point.y - pinWidth / 2,
|
||||
pinThickness, pinWidth);
|
||||
pin = new Rectangle(point.x - pinThickness / 2, point.y
|
||||
- pinWidth / 2, pinThickness, pinWidth);
|
||||
}
|
||||
pins.add(new Area(pin));
|
||||
}
|
||||
@@ -173,34 +176,38 @@ public class CliffJack1_4 extends AbstractTransparentComponent<String> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode,
|
||||
Project project, IDrawingObserver drawingObserver) {
|
||||
public void draw(Graphics2D g2d, ComponentState componentState,
|
||||
boolean outlineMode, Project project,
|
||||
IDrawingObserver drawingObserver) {
|
||||
Shape[] body = getBody();
|
||||
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
if (componentState != ComponentState.DRAGGING) {
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha
|
||||
/ MAX_ALPHA));
|
||||
g2d.setComposite(AlphaComposite.getInstance(
|
||||
AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BODY_COLOR);
|
||||
g2d
|
||||
.setColor(outlineMode ? Constants.TRANSPARENT_COLOR
|
||||
: BODY_COLOR);
|
||||
for (int i = 0; i < body.length - 1; i++) {
|
||||
// Nut is brighter colored.
|
||||
if (i == body.length - 2)
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : NUT_COLOR);
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR
|
||||
: NUT_COLOR);
|
||||
g2d.fill(body[i]);
|
||||
}
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
Color finalBorderColor;
|
||||
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(
|
||||
IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||
if (outlineMode) {
|
||||
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(
|
||||
IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||
finalBorderColor = componentState == ComponentState.SELECTED
|
||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : theme
|
||||
.getOutlineColor();
|
||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||
: theme.getOutlineColor();
|
||||
} else {
|
||||
finalBorderColor = componentState == ComponentState.SELECTED
|
||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||
@@ -214,18 +221,19 @@ public class CliffJack1_4 extends AbstractTransparentComponent<String> {
|
||||
|
||||
// Pins are the last piece.
|
||||
Shape pins = body[body.length - 1];
|
||||
g2d.setColor(METAL_COLOR);
|
||||
g2d.fill(pins);
|
||||
g2d.setColor(METAL_COLOR.darker());
|
||||
if (!outlineMode) {
|
||||
g2d.setColor(METAL_COLOR);
|
||||
g2d.fill(pins);
|
||||
}
|
||||
g2d.setColor(outlineMode ? theme.getOutlineColor() : METAL_COLOR
|
||||
.darker());
|
||||
g2d.draw(pins);
|
||||
|
||||
Color finalLabelColor;
|
||||
if (outlineMode) {
|
||||
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(
|
||||
IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||
finalLabelColor = componentState == ComponentState.SELECTED
|
||||
|| componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED : theme
|
||||
.getOutlineColor();
|
||||
|| componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED
|
||||
: theme.getOutlineColor();
|
||||
} else {
|
||||
finalLabelColor = componentState == ComponentState.SELECTED
|
||||
|| componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED
|
||||
@@ -235,8 +243,8 @@ public class CliffJack1_4 extends AbstractTransparentComponent<String> {
|
||||
g2d.setFont(LABEL_FONT);
|
||||
int centerX = (controlPoints[0].x + controlPoints[3].x) / 2;
|
||||
int centerY = (controlPoints[0].y + controlPoints[3].y) / 2;
|
||||
drawCenteredText(g2d, name, centerX, centerY, HorizontalAlignment.CENTER,
|
||||
VerticalAlignment.CENTER);
|
||||
drawCenteredText(g2d, name, centerX, centerY,
|
||||
HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -245,23 +253,25 @@ public class CliffJack1_4 extends AbstractTransparentComponent<String> {
|
||||
int tailWidth = getClosestOdd(width * 3 / 9);
|
||||
|
||||
g2d.setColor(BODY_COLOR);
|
||||
g2d.fillRoundRect((width - tailWidth) / 2, height / 2, tailWidth, height / 2 - 2 * 32
|
||||
/ height, 4 * 32 / width, 4 * 32 / width);
|
||||
g2d.fillRoundRect((width - tailWidth) / 2, height / 2, tailWidth,
|
||||
height / 2 - 2 * 32 / height, 4 * 32 / width, 4 * 32 / width);
|
||||
g2d.setColor(BORDER_COLOR);
|
||||
g2d.drawRoundRect((width - tailWidth) / 2, height / 2, tailWidth, height / 2 - 2 * 32
|
||||
/ height, 4 * 32 / width, 4 * 32 / width);
|
||||
g2d.drawRoundRect((width - tailWidth) / 2, height / 2, tailWidth,
|
||||
height / 2 - 2 * 32 / height, 4 * 32 / width, 4 * 32 / width);
|
||||
|
||||
g2d.setColor(NUT_COLOR);
|
||||
g2d.fillRoundRect((width - tailWidth) / 2, 2 * 32 / height, tailWidth, height / 2,
|
||||
4 * 32 / width, 4 * 32 / width);
|
||||
g2d.fillRoundRect((width - tailWidth) / 2, 2 * 32 / height, tailWidth,
|
||||
height / 2, 4 * 32 / width, 4 * 32 / width);
|
||||
g2d.setColor(BORDER_COLOR);
|
||||
g2d.drawRoundRect((width - tailWidth) / 2, 2 * 32 / height, tailWidth, height / 2,
|
||||
4 * 32 / width, 4 * 32 / width);
|
||||
g2d.drawRoundRect((width - tailWidth) / 2, 2 * 32 / height, tailWidth,
|
||||
height / 2, 4 * 32 / width, 4 * 32 / width);
|
||||
|
||||
g2d.setColor(BODY_COLOR);
|
||||
g2d.fillRect((width - bodyWidth) / 2, height / 7 + 1, bodyWidth, height * 5 / 7);
|
||||
g2d.fillRect((width - bodyWidth) / 2, height / 7 + 1, bodyWidth,
|
||||
height * 5 / 7);
|
||||
g2d.setColor(BORDER_COLOR);
|
||||
g2d.drawRect((width - bodyWidth) / 2, height / 7 + 1, bodyWidth, height * 5 / 7);
|
||||
g2d.drawRect((width - bodyWidth) / 2, height / 7 + 1, bodyWidth,
|
||||
height * 5 / 7);
|
||||
|
||||
g2d.setColor(METAL_COLOR);
|
||||
int pinX1 = getClosestOdd((width - bodyWidth * 3 / 4) / 2);
|
||||
|
||||
+9
-10
@@ -294,22 +294,23 @@ public class MiniRelay extends AbstractTransparentComponent<String> {
|
||||
g2d.fill(mainArea);
|
||||
g2d.setComposite(oldComposite);
|
||||
|
||||
if (!outlineMode) {
|
||||
int pinSize = (int) PIN_SIZE.convertToPixels() / 2 * 2;
|
||||
for (Point point : controlPoints) {
|
||||
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(
|
||||
IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||
int pinSize = (int) PIN_SIZE.convertToPixels() / 2 * 2;
|
||||
for (Point point : controlPoints) {
|
||||
if (!outlineMode) {
|
||||
g2d.setColor(PIN_COLOR);
|
||||
g2d.fillOval(point.x - pinSize / 2, point.y - pinSize / 2,
|
||||
pinSize, pinSize);
|
||||
g2d.setColor(PIN_BORDER_COLOR);
|
||||
g2d.fillOval(point.x - pinSize / 2, point.y - pinSize / 2,
|
||||
pinSize, pinSize);
|
||||
}
|
||||
g2d.setColor(outlineMode ? theme.getOutlineColor()
|
||||
: PIN_BORDER_COLOR);
|
||||
g2d.drawOval(point.x - pinSize / 2, point.y - pinSize / 2, pinSize,
|
||||
pinSize);
|
||||
}
|
||||
|
||||
Color finalBorderColor;
|
||||
if (outlineMode) {
|
||||
Theme theme = (Theme) ConfigurationManager.getInstance()
|
||||
.readObject(IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||
finalBorderColor = componentState == ComponentState.SELECTED
|
||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||
: theme.getOutlineColor();
|
||||
@@ -335,8 +336,6 @@ public class MiniRelay extends AbstractTransparentComponent<String> {
|
||||
g2d.setFont(LABEL_FONT);
|
||||
Color finalLabelColor;
|
||||
if (outlineMode) {
|
||||
Theme theme = (Theme) ConfigurationManager.getInstance()
|
||||
.readObject(IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||
finalLabelColor = componentState == ComponentState.SELECTED
|
||||
|| componentState == ComponentState.DRAGGING ? LABEL_COLOR_SELECTED
|
||||
: theme.getOutlineColor();
|
||||
|
||||
+63
-43
@@ -42,7 +42,8 @@ public class PlasticDCJack extends AbstractTransparentComponent<String> {
|
||||
private static Color BORDER_COLOR = Color.black;
|
||||
private static Color MARKING_COLOR = Color.lightGray;
|
||||
|
||||
private Point[] controlPoints = new Point[] { new Point(0, 0), new Point(0, 0), new Point(0, 0) };
|
||||
private Point[] controlPoints = new Point[] { new Point(0, 0),
|
||||
new Point(0, 0), new Point(0, 0) };
|
||||
private String value = "";
|
||||
private DCPolarity polarity = DCPolarity.CENTER_NEGATIVE;
|
||||
transient private Shape[] body;
|
||||
@@ -71,23 +72,24 @@ public class PlasticDCJack extends AbstractTransparentComponent<String> {
|
||||
int y = controlPoints[0].y;
|
||||
int spacing = (int) SPACING.convertToPixels();
|
||||
int diameter = getClosestOdd(DIAMETER.convertToPixels());
|
||||
body[0] = new Ellipse2D.Double(x - diameter / 2, y + spacing - diameter / 2, diameter,
|
||||
diameter);
|
||||
body[0] = new Ellipse2D.Double(x - diameter / 2, y + spacing
|
||||
- diameter / 2, diameter, diameter);
|
||||
|
||||
int rectWidth = (int) (diameter / Math.sqrt(2)) - 2;
|
||||
body[1] = new Rectangle(x - rectWidth / 2, y + spacing - rectWidth / 2, rectWidth,
|
||||
rectWidth);
|
||||
body[1] = new Rectangle(x - rectWidth / 2, y + spacing - rectWidth
|
||||
/ 2, rectWidth, rectWidth);
|
||||
|
||||
int lugWidth = getClosestOdd(LUG_WIDTH.convertToPixels());
|
||||
int lugThickness = getClosestOdd(LUG_THICKNESS.convertToPixels());
|
||||
|
||||
Point groundPoint = controlPoints[controlPoints.length - 1];
|
||||
Area groundLug = new Area(new Ellipse2D.Double(groundPoint.x + spacing - lugWidth / 2,
|
||||
groundPoint.y - lugWidth / 2, lugWidth, lugWidth));
|
||||
groundLug.add(new Area(new Rectangle(groundPoint.x, groundPoint.y - lugWidth / 2,
|
||||
spacing, lugWidth)));
|
||||
groundLug.subtract(new Area(new Ellipse2D.Double(
|
||||
groundPoint.x + spacing - lugWidth / 6, groundPoint.y - lugWidth / 6,
|
||||
Area groundLug = new Area(new Ellipse2D.Double(groundPoint.x
|
||||
+ spacing - lugWidth / 2, groundPoint.y - lugWidth / 2,
|
||||
lugWidth, lugWidth));
|
||||
groundLug.add(new Area(new Rectangle(groundPoint.x, groundPoint.y
|
||||
- lugWidth / 2, spacing, lugWidth)));
|
||||
groundLug.subtract(new Area(new Ellipse2D.Double(groundPoint.x
|
||||
+ spacing - lugWidth / 6, groundPoint.y - lugWidth / 6,
|
||||
lugWidth / 3, lugWidth / 3)));
|
||||
body[2] = groundLug;
|
||||
|
||||
@@ -95,11 +97,14 @@ public class PlasticDCJack extends AbstractTransparentComponent<String> {
|
||||
for (int i = 0; i < controlPoints.length; i++) {
|
||||
Point point = controlPoints[i];
|
||||
if (i == getControlPointCount() - 1) {
|
||||
lugArea.add(new Area(new Rectangle(point.x - lugThickness / 2, point.y
|
||||
- lugWidth / 2, lugThickness, lugWidth)));
|
||||
lugArea.add(new Area(
|
||||
new Rectangle(point.x - lugThickness / 2, point.y
|
||||
- lugWidth / 2, lugThickness, lugWidth)));
|
||||
} else {
|
||||
lugArea.add(new Area(new Rectangle(point.x - lugWidth / 2, point.y
|
||||
- lugThickness / 2, lugWidth, lugThickness)));
|
||||
lugArea
|
||||
.add(new Area(new Rectangle(point.x - lugWidth / 2,
|
||||
point.y - lugThickness / 2, lugWidth,
|
||||
lugThickness)));
|
||||
}
|
||||
}
|
||||
body[3] = lugArea;
|
||||
@@ -108,18 +113,21 @@ public class PlasticDCJack extends AbstractTransparentComponent<String> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode,
|
||||
Project project, IDrawingObserver drawingObserver) {
|
||||
public void draw(Graphics2D g2d, ComponentState componentState,
|
||||
boolean outlineMode, Project project,
|
||||
IDrawingObserver drawingObserver) {
|
||||
Shape[] body = getBody();
|
||||
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
if (componentState != ComponentState.DRAGGING) {
|
||||
Composite oldComposite = g2d.getComposite();
|
||||
if (alpha < MAX_ALPHA) {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha
|
||||
/ MAX_ALPHA));
|
||||
g2d.setComposite(AlphaComposite.getInstance(
|
||||
AlphaComposite.SRC_OVER, 1f * alpha / MAX_ALPHA));
|
||||
}
|
||||
g2d.setColor(outlineMode ? Constants.TRANSPARENT_COLOR : BODY_COLOR);
|
||||
g2d
|
||||
.setColor(outlineMode ? Constants.TRANSPARENT_COLOR
|
||||
: BODY_COLOR);
|
||||
g2d.fill(body[0]);
|
||||
if (!outlineMode) {
|
||||
g2d.setColor(PHENOLIC_COLOR);
|
||||
@@ -128,16 +136,17 @@ public class PlasticDCJack extends AbstractTransparentComponent<String> {
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
|
||||
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(
|
||||
IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||
Color finalBorderColor;
|
||||
if (outlineMode) {
|
||||
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(
|
||||
IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||
finalBorderColor = componentState == ComponentState.SELECTED
|
||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : theme
|
||||
.getOutlineColor();
|
||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||
: theme.getOutlineColor();
|
||||
} else {
|
||||
finalBorderColor = componentState == ComponentState.SELECTED
|
||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : BORDER_COLOR;
|
||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||
: BORDER_COLOR;
|
||||
}
|
||||
|
||||
g2d.setColor(finalBorderColor);
|
||||
@@ -150,21 +159,25 @@ public class PlasticDCJack extends AbstractTransparentComponent<String> {
|
||||
g2d.fill(body[2]);
|
||||
g2d.setColor(METAL_COLOR.darker());
|
||||
g2d.draw(body[2]);
|
||||
|
||||
g2d.setColor(METAL_COLOR);
|
||||
g2d.fill(body[3]);
|
||||
}
|
||||
|
||||
g2d.setColor(METAL_COLOR);
|
||||
g2d.fill(body[3]);
|
||||
g2d.setColor(METAL_COLOR.darker());
|
||||
g2d.setColor(outlineMode ? theme.getOutlineColor() : METAL_COLOR
|
||||
.darker());
|
||||
g2d.draw(body[3]);
|
||||
|
||||
if (!outlineMode && getPolarity() != DCPolarity.NONE) {
|
||||
int spacing = (int) SPACING.convertToPixels();
|
||||
g2d.setColor(MARKING_COLOR);
|
||||
g2d.setFont(LABEL_FONT.deriveFont(12f));
|
||||
drawCenteredText(g2d, getPolarity() == DCPolarity.CENTER_NEGATIVE ? "+" : "-",
|
||||
drawCenteredText(g2d,
|
||||
getPolarity() == DCPolarity.CENTER_NEGATIVE ? "+" : "-",
|
||||
controlPoints[0].x, controlPoints[0].y - spacing * 7 / 16,
|
||||
HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
drawCenteredText(g2d, getPolarity() == DCPolarity.CENTER_NEGATIVE ? "_" : "+",
|
||||
drawCenteredText(g2d,
|
||||
getPolarity() == DCPolarity.CENTER_NEGATIVE ? "_" : "+",
|
||||
controlPoints[2].x, controlPoints[2].y - spacing * 3 / 4,
|
||||
HorizontalAlignment.CENTER, VerticalAlignment.CENTER);
|
||||
}
|
||||
@@ -175,25 +188,32 @@ public class PlasticDCJack extends AbstractTransparentComponent<String> {
|
||||
int margin = 2 * 32 / width;
|
||||
int diameter = getClosestOdd(width - margin);
|
||||
g2d.setColor(BODY_COLOR);
|
||||
g2d.fillOval((width - diameter) / 2, (height - diameter) / 2, diameter, diameter);
|
||||
g2d.fillOval((width - diameter) / 2, (height - diameter) / 2, diameter,
|
||||
diameter);
|
||||
g2d.setColor(BORDER_COLOR);
|
||||
g2d.drawOval((width - diameter) / 2, (height - diameter) / 2, diameter, diameter);
|
||||
int rectWidth = getClosestOdd(((width - 2 * margin) / Math.sqrt(2)) - margin / 2);
|
||||
g2d.drawOval((width - diameter) / 2, (height - diameter) / 2, diameter,
|
||||
diameter);
|
||||
int rectWidth = getClosestOdd(((width - 2 * margin) / Math.sqrt(2))
|
||||
- margin / 2);
|
||||
g2d.setColor(PHENOLIC_COLOR);
|
||||
g2d.fillRect((width - rectWidth) / 2, (height - rectWidth) / 2, rectWidth, rectWidth);
|
||||
g2d.fillRect((width - rectWidth) / 2, (height - rectWidth) / 2,
|
||||
rectWidth, rectWidth);
|
||||
g2d.setColor(PHENOLIC_COLOR.darker());
|
||||
g2d.drawRect((width - rectWidth) / 2, (height - rectWidth) / 2, rectWidth, rectWidth);
|
||||
g2d.drawRect((width - rectWidth) / 2, (height - rectWidth) / 2,
|
||||
rectWidth, rectWidth);
|
||||
int lugWidth = 4 * 32 / width;
|
||||
g2d.setColor(METAL_COLOR);
|
||||
g2d.drawLine((width - lugWidth) / 2, height / 3, (width + lugWidth) / 2, height / 3);
|
||||
g2d
|
||||
.drawLine(width * 2 / 3, (height - lugWidth) / 2, width * 2 / 3,
|
||||
(height + lugWidth) / 2);
|
||||
g2d.fillOval((width - lugWidth) / 2, height * 2 / 3 - lugWidth / 2, lugWidth, lugWidth);
|
||||
g2d.fillRect(width / 2 - lugWidth * 3 / 2, height * 2 / 3 - lugWidth / 2, lugWidth * 3 / 2,
|
||||
lugWidth);
|
||||
g2d.drawLine((width - lugWidth) / 2, height / 3,
|
||||
(width + lugWidth) / 2, height / 3);
|
||||
g2d.drawLine(width * 2 / 3, (height - lugWidth) / 2, width * 2 / 3,
|
||||
(height + lugWidth) / 2);
|
||||
g2d.fillOval((width - lugWidth) / 2, height * 2 / 3 - lugWidth / 2,
|
||||
lugWidth, lugWidth);
|
||||
g2d.fillRect(width / 2 - lugWidth * 3 / 2, height * 2 / 3 - lugWidth
|
||||
/ 2, lugWidth * 3 / 2, lugWidth);
|
||||
g2d.setColor(PHENOLIC_COLOR);
|
||||
g2d.fillOval((width - margin) / 2, height * 2 / 3 - margin / 2, margin, margin);
|
||||
g2d.fillOval((width - margin) / 2, height * 2 / 3 - margin / 2, margin,
|
||||
margin);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user