diff --git a/diylc/diylc-library/src/org/diylc/components/electromechanical/IECSocket.java b/diylc/diylc-library/src/org/diylc/components/electromechanical/IECSocket.java index a5b945e4..c40aac3f 100644 --- a/diylc/diylc-library/src/org/diylc/components/electromechanical/IECSocket.java +++ b/diylc/diylc-library/src/org/diylc/components/electromechanical/IECSocket.java @@ -82,8 +82,7 @@ public class IECSocket extends AbstractTransparentComponent { transient protected Area[] body; protected String name; protected String value; - private Orientation orientation = Orientation.DEFAULT; - private boolean hasFuse = false; + private Orientation orientation = Orientation.DEFAULT; private Color bodyColor = BODY_COLOR; private Color borderColor = BORDER_COLOR; @@ -186,16 +185,6 @@ public class IECSocket extends AbstractTransparentComponent { body = null; } - @EditableProperty(name = "Fuse") - public boolean getHasFuse() { - return hasFuse; - } - - public void setHasFuse(boolean hasFuse) { - this.hasFuse = hasFuse; - body = null; - } - @Override public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project, IDrawingObserver drawingObserver) { @@ -277,60 +266,56 @@ public class IECSocket extends AbstractTransparentComponent { double holeSpacing = HOLE_SPACING.convertToPixels(); body = new Area[3]; + + 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(); - if (hasFuse) { - - } else { - 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(); - - Point[] outerPoints = new Point[] { - new Point((int) Math.round(firstPoint.x), (int) Math.round(firstPoint.y + vSpacing / 2 - baseWidth / 2)), - new Point((int) Math.round(firstPoint.x + baseLength / 2), (int) Math.round(firstPoint.y + vSpacing / 2 - baseWidth / 2)), - new Point((int) Math.round(firstPoint.x + length / 2), (int) Math.round(firstPoint.y + vSpacing / 2)), - new Point((int) Math.round(firstPoint.x + baseLength / 2), (int) Math.round(firstPoint.y + vSpacing / 2 + baseWidth / 2)), - new Point((int) Math.round(firstPoint.x - baseLength / 2), (int) Math.round(firstPoint.y + vSpacing / 2 + baseWidth / 2)), - new Point((int) Math.round(firstPoint.x - length / 2), (int) Math.round(firstPoint.y + vSpacing / 2)), - new Point((int) Math.round(firstPoint.x - baseLength / 2), (int) Math.round(firstPoint.y + vSpacing / 2 - baseWidth / 2)), - }; - - double[] outerRadiuses = new double[] { - baseRadius / 2, - outerRadius, - baseRadius / 2, - baseRadius / 2, - outerRadius, - baseRadius / 2 - }; - - body[0] = new Area(new RoundedPolygon(outerPoints, outerRadiuses)); - 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)), - }; - - double[] cutoutRadiuses = new double[] { - cutoutRadius, - }; - - body[2] = new Area(new RoundedPolygon(cutoutPoints, cutoutRadiuses)); - } + Point[] outerPoints = new Point[] { + new Point((int) Math.round(firstPoint.x), (int) Math.round(firstPoint.y + vSpacing / 2 - baseWidth / 2)), + new Point((int) Math.round(firstPoint.x + baseLength / 2), (int) Math.round(firstPoint.y + vSpacing / 2 - baseWidth / 2)), + new Point((int) Math.round(firstPoint.x + length / 2), (int) Math.round(firstPoint.y + vSpacing / 2)), + new Point((int) Math.round(firstPoint.x + baseLength / 2), (int) Math.round(firstPoint.y + vSpacing / 2 + baseWidth / 2)), + new Point((int) Math.round(firstPoint.x - baseLength / 2), (int) Math.round(firstPoint.y + vSpacing / 2 + baseWidth / 2)), + new Point((int) Math.round(firstPoint.x - length / 2), (int) Math.round(firstPoint.y + vSpacing / 2)), + new Point((int) Math.round(firstPoint.x - baseLength / 2), (int) Math.round(firstPoint.y + vSpacing / 2 - baseWidth / 2)), + }; + + double[] outerRadiuses = new double[] { + baseRadius / 2, + outerRadius, + baseRadius / 2, + baseRadius / 2, + outerRadius, + baseRadius / 2 + }; + + body[0] = new Area(new RoundedPolygon(outerPoints, outerRadiuses)); + 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)), + }; + + double[] cutoutRadiuses = new double[] { + cutoutRadius, + }; + + body[2] = new Area(new RoundedPolygon(cutoutPoints, cutoutRadiuses)); if (orientation != Orientation.DEFAULT) { double theta = 0; diff --git a/diylc/diylc-swing/lib/diylc-core.jar b/diylc/diylc-swing/lib/diylc-core.jar index 73b37672..ca39ce1e 100644 Binary files a/diylc/diylc-swing/lib/diylc-core.jar and b/diylc/diylc-swing/lib/diylc-core.jar differ diff --git a/diylc/diylc-swing/library/main.jar b/diylc/diylc-swing/library/main.jar index 6b06cff9..7f1eab26 100644 Binary files a/diylc/diylc-swing/library/main.jar and b/diylc/diylc-swing/library/main.jar differ