mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 09:12:09 +10:00
remove fuse param for IEC
This commit is contained in:
@@ -83,7 +83,6 @@ public class IECSocket extends AbstractTransparentComponent<String> {
|
|||||||
protected String name;
|
protected String name;
|
||||||
protected String value;
|
protected String value;
|
||||||
private Orientation orientation = Orientation.DEFAULT;
|
private Orientation orientation = Orientation.DEFAULT;
|
||||||
private boolean hasFuse = false;
|
|
||||||
|
|
||||||
private Color bodyColor = BODY_COLOR;
|
private Color bodyColor = BODY_COLOR;
|
||||||
private Color borderColor = BORDER_COLOR;
|
private Color borderColor = BORDER_COLOR;
|
||||||
@@ -186,16 +185,6 @@ public class IECSocket extends AbstractTransparentComponent<String> {
|
|||||||
body = null;
|
body = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EditableProperty(name = "Fuse")
|
|
||||||
public boolean getHasFuse() {
|
|
||||||
return hasFuse;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHasFuse(boolean hasFuse) {
|
|
||||||
this.hasFuse = hasFuse;
|
|
||||||
body = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
|
||||||
IDrawingObserver drawingObserver) {
|
IDrawingObserver drawingObserver) {
|
||||||
@@ -278,59 +267,55 @@ public class IECSocket extends AbstractTransparentComponent<String> {
|
|||||||
|
|
||||||
body = new Area[3];
|
body = new Area[3];
|
||||||
|
|
||||||
if (hasFuse) {
|
cutoutRadius = SIMPLE_CUTOUT_RADIUS.convertToPixels();
|
||||||
|
baseRadius = SIMPLE_BASE_RADIUS.convertToPixels();
|
||||||
|
cutoutLength = SIMPLE_CUTOUT_LENGTH.convertToPixels();
|
||||||
|
cutoutWidth = SIMPLE_CUTOUT_WIDTH.convertToPixels();
|
||||||
|
cutoutSlant = SIMPLE_CUTOUT_SLANT.convertToPixels();
|
||||||
|
baseLength = SIMPLE_BASE_LENGTH.convertToPixels();
|
||||||
|
length = SIMPLE_LENGTH.convertToPixels();
|
||||||
|
outerRadius = SIMPLE_OUTER_RADIUS.convertToPixels();
|
||||||
|
|
||||||
} else {
|
Point[] outerPoints = new Point[] {
|
||||||
cutoutRadius = SIMPLE_CUTOUT_RADIUS.convertToPixels();
|
new Point((int) Math.round(firstPoint.x), (int) Math.round(firstPoint.y + vSpacing / 2 - baseWidth / 2)),
|
||||||
baseRadius = SIMPLE_BASE_RADIUS.convertToPixels();
|
new Point((int) Math.round(firstPoint.x + baseLength / 2), (int) Math.round(firstPoint.y + vSpacing / 2 - baseWidth / 2)),
|
||||||
cutoutLength = SIMPLE_CUTOUT_LENGTH.convertToPixels();
|
new Point((int) Math.round(firstPoint.x + length / 2), (int) Math.round(firstPoint.y + vSpacing / 2)),
|
||||||
cutoutWidth = SIMPLE_CUTOUT_WIDTH.convertToPixels();
|
new Point((int) Math.round(firstPoint.x + baseLength / 2), (int) Math.round(firstPoint.y + vSpacing / 2 + baseWidth / 2)),
|
||||||
cutoutSlant = SIMPLE_CUTOUT_SLANT.convertToPixels();
|
new Point((int) Math.round(firstPoint.x - baseLength / 2), (int) Math.round(firstPoint.y + vSpacing / 2 + baseWidth / 2)),
|
||||||
baseLength = SIMPLE_BASE_LENGTH.convertToPixels();
|
new Point((int) Math.round(firstPoint.x - length / 2), (int) Math.round(firstPoint.y + vSpacing / 2)),
|
||||||
length = SIMPLE_LENGTH.convertToPixels();
|
new Point((int) Math.round(firstPoint.x - baseLength / 2), (int) Math.round(firstPoint.y + vSpacing / 2 - baseWidth / 2)),
|
||||||
outerRadius = SIMPLE_OUTER_RADIUS.convertToPixels();
|
};
|
||||||
|
|
||||||
Point[] outerPoints = new Point[] {
|
double[] outerRadiuses = new double[] {
|
||||||
new Point((int) Math.round(firstPoint.x), (int) Math.round(firstPoint.y + vSpacing / 2 - baseWidth / 2)),
|
baseRadius / 2,
|
||||||
new Point((int) Math.round(firstPoint.x + baseLength / 2), (int) Math.round(firstPoint.y + vSpacing / 2 - baseWidth / 2)),
|
outerRadius,
|
||||||
new Point((int) Math.round(firstPoint.x + length / 2), (int) Math.round(firstPoint.y + vSpacing / 2)),
|
baseRadius / 2,
|
||||||
new Point((int) Math.round(firstPoint.x + baseLength / 2), (int) Math.round(firstPoint.y + vSpacing / 2 + baseWidth / 2)),
|
baseRadius / 2,
|
||||||
new Point((int) Math.round(firstPoint.x - baseLength / 2), (int) Math.round(firstPoint.y + vSpacing / 2 + baseWidth / 2)),
|
outerRadius,
|
||||||
new Point((int) Math.round(firstPoint.x - length / 2), (int) Math.round(firstPoint.y + vSpacing / 2)),
|
baseRadius / 2
|
||||||
new Point((int) Math.round(firstPoint.x - baseLength / 2), (int) Math.round(firstPoint.y + vSpacing / 2 - baseWidth / 2)),
|
};
|
||||||
};
|
|
||||||
|
|
||||||
double[] outerRadiuses = new double[] {
|
body[0] = new Area(new RoundedPolygon(outerPoints, outerRadiuses));
|
||||||
baseRadius / 2,
|
body[0].subtract(new Area(new Ellipse2D.Double(firstPoint.x - holeSpacing / 2 - holeDiameter / 2, firstPoint.y + vSpacing / 2 - holeDiameter / 2, holeDiameter, holeDiameter)));
|
||||||
outerRadius,
|
body[0].subtract(new Area(new Ellipse2D.Double(firstPoint.x + holeSpacing / 2 - holeDiameter / 2, firstPoint.y + vSpacing / 2 - holeDiameter / 2, holeDiameter, holeDiameter)));
|
||||||
baseRadius / 2,
|
|
||||||
baseRadius / 2,
|
|
||||||
outerRadius,
|
|
||||||
baseRadius / 2
|
|
||||||
};
|
|
||||||
|
|
||||||
body[0] = new Area(new RoundedPolygon(outerPoints, outerRadiuses));
|
body[1] = new Area(new RoundRectangle2D.Double(firstPoint.x - baseLength / 2, firstPoint.y + vSpacing / 2 - baseWidth / 2, baseLength, baseWidth, baseRadius, baseRadius));
|
||||||
body[0].subtract(new Area(new Ellipse2D.Double(firstPoint.x - holeSpacing / 2 - holeDiameter / 2, firstPoint.y + vSpacing / 2 - holeDiameter / 2, holeDiameter, holeDiameter)));
|
|
||||||
body[0].subtract(new Area(new Ellipse2D.Double(firstPoint.x + holeSpacing / 2 - holeDiameter / 2, firstPoint.y + vSpacing / 2 - holeDiameter / 2, holeDiameter, holeDiameter)));
|
|
||||||
|
|
||||||
body[1] = new Area(new RoundRectangle2D.Double(firstPoint.x - baseLength / 2, firstPoint.y + vSpacing / 2 - baseWidth / 2, baseLength, baseWidth, baseRadius, baseRadius));
|
Point[] cutoutPoints = new Point[] {
|
||||||
|
new Point(firstPoint.x, (int) (firstPoint.y + vSpacing / 2 - cutoutWidth / 2)),
|
||||||
|
new Point((int) (firstPoint.x + cutoutLength / 2 - cutoutSlant), (int) (firstPoint.y + vSpacing / 2 - cutoutWidth / 2)),
|
||||||
|
new Point((int) (firstPoint.x + cutoutLength / 2), (int) (firstPoint.y + vSpacing / 2 - cutoutWidth / 2 + cutoutSlant)),
|
||||||
|
new Point((int) (firstPoint.x + cutoutLength / 2), (int) (firstPoint.y + vSpacing / 2 + cutoutWidth / 2)),
|
||||||
|
new Point((int) (firstPoint.x - cutoutLength / 2), (int) (firstPoint.y + vSpacing / 2 + cutoutWidth / 2)),
|
||||||
|
new Point((int) (firstPoint.x - cutoutLength / 2), (int) (firstPoint.y + vSpacing / 2 - cutoutWidth / 2 + cutoutSlant)),
|
||||||
|
new Point((int) (firstPoint.x - cutoutLength / 2 + cutoutSlant), (int) (firstPoint.y + vSpacing / 2 - cutoutWidth / 2)),
|
||||||
|
};
|
||||||
|
|
||||||
Point[] cutoutPoints = new Point[] {
|
double[] cutoutRadiuses = new double[] {
|
||||||
new Point(firstPoint.x, (int) (firstPoint.y + vSpacing / 2 - cutoutWidth / 2)),
|
cutoutRadius,
|
||||||
new Point((int) (firstPoint.x + cutoutLength / 2 - cutoutSlant), (int) (firstPoint.y + vSpacing / 2 - cutoutWidth / 2)),
|
};
|
||||||
new Point((int) (firstPoint.x + cutoutLength / 2), (int) (firstPoint.y + vSpacing / 2 - cutoutWidth / 2 + cutoutSlant)),
|
|
||||||
new Point((int) (firstPoint.x + cutoutLength / 2), (int) (firstPoint.y + vSpacing / 2 + cutoutWidth / 2)),
|
|
||||||
new Point((int) (firstPoint.x - cutoutLength / 2), (int) (firstPoint.y + vSpacing / 2 + cutoutWidth / 2)),
|
|
||||||
new Point((int) (firstPoint.x - cutoutLength / 2), (int) (firstPoint.y + vSpacing / 2 - cutoutWidth / 2 + cutoutSlant)),
|
|
||||||
new Point((int) (firstPoint.x - cutoutLength / 2 + cutoutSlant), (int) (firstPoint.y + vSpacing / 2 - cutoutWidth / 2)),
|
|
||||||
};
|
|
||||||
|
|
||||||
double[] cutoutRadiuses = new double[] {
|
body[2] = new Area(new RoundedPolygon(cutoutPoints, cutoutRadiuses));
|
||||||
cutoutRadius,
|
|
||||||
};
|
|
||||||
|
|
||||||
body[2] = new Area(new RoundedPolygon(cutoutPoints, cutoutRadiuses));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (orientation != Orientation.DEFAULT) {
|
if (orientation != Orientation.DEFAULT) {
|
||||||
double theta = 0;
|
double theta = 0;
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user