diff --git a/src/main/java/de/neemann/digital/draw/shapes/RealLEDShape.java b/src/main/java/de/neemann/digital/draw/shapes/RealLEDShape.java index 028d01168..311b771ef 100644 --- a/src/main/java/de/neemann/digital/draw/shapes/RealLEDShape.java +++ b/src/main/java/de/neemann/digital/draw/shapes/RealLEDShape.java @@ -14,10 +14,7 @@ import de.neemann.digital.core.element.PinDescriptions; import de.neemann.digital.draw.elements.IOState; import de.neemann.digital.draw.elements.Pin; import de.neemann.digital.draw.elements.Pins; -import de.neemann.digital.draw.graphics.Graphic; -import de.neemann.digital.draw.graphics.Polygon; -import de.neemann.digital.draw.graphics.Style; -import de.neemann.digital.draw.graphics.Vector; +import de.neemann.digital.draw.graphics.*; import static de.neemann.digital.draw.shapes.GenericShape.SIZE; @@ -32,6 +29,7 @@ public class RealLEDShape implements Shape { private static final int RAD = SIZE * 3 / 4; private final PinDescriptions inputs; private final Style style; + private final String label; private ObservableValue aValue; private ObservableValue cValue; private Value a; @@ -47,6 +45,7 @@ public class RealLEDShape implements Shape { public RealLEDShape(ElementAttributes attr, PinDescriptions inputs, PinDescriptions outputs) { this.inputs = inputs; style = Style.NORMAL.deriveFillStyle(attr.get(Keys.COLOR)); + label = attr.getLabel(); } @Override @@ -83,12 +82,14 @@ public class RealLEDShape implements Shape { Style.NORMAL ); graphic.drawLine(new Vector(0, SIZE * 4 - SIZE2), new Vector(0, SIZE * 4), Style.NORMAL); + Vector textPos = new Vector(SIZE + SIZE2, SIZE); + graphic.drawText(textPos, textPos.add(1, 0), label, Orientation.LEFTCENTER, Style.NORMAL); if (a == null || c == null) { graphic.drawPolygon( new Polygon(true) - .add(-SIZE2, -SIZE + 1 + SIZE + SIZE2) - .add(SIZE2, -SIZE + 1 + SIZE + SIZE2) + .add(-SIZE2, 1 + SIZE2) + .add(SIZE2, 1 + SIZE2) .add(0, -1 + SIZE + SIZE2), Style.NORMAL ); @@ -96,18 +97,17 @@ public class RealLEDShape implements Shape { graphic.drawLine(new Vector(0, -1 + SIZE + SIZE2), new Vector(0, SIZE * 4 - HEIGHT - SIZE2), Style.NORMAL); graphic.drawLine(new Vector(0, 0), new Vector(0, -1 + SIZE2), Style.NORMAL); - graphic.drawLine(new Vector(SIZE - 1, SIZE2 + 1), new Vector(SIZE2, SIZE), Style.THIN); - graphic.drawLine(new Vector(SIZE - 3, SIZE2), new Vector(SIZE, SIZE2), Style.THIN); - graphic.drawLine(new Vector(SIZE, SIZE2 + 3), new Vector(SIZE, SIZE2), Style.THIN); - graphic.drawLine(new Vector(SIZE - 1 + 4, SIZE2 + 1 + 4), new Vector(SIZE2 + 4, SIZE + 4), Style.THIN); - graphic.drawLine(new Vector(SIZE - 3 + 4, SIZE2 + 4), new Vector(SIZE + 4, SIZE2 + 4), Style.THIN); - graphic.drawLine(new Vector(SIZE + 4, SIZE2 + 3 + 4), new Vector(SIZE + 4, SIZE2 + 4), Style.THIN); + graphic.drawLine(new Vector(SIZE - 0, SIZE2 + 2), new Vector(SIZE2 + 1, SIZE + 1), Style.THIN); + graphic.drawLine(new Vector(SIZE - 2, SIZE2 + 1), new Vector(SIZE + 1, SIZE2 + 1), Style.THIN); + graphic.drawLine(new Vector(SIZE + 1, SIZE2 + 4), new Vector(SIZE + 1, SIZE2 + 1), Style.THIN); + graphic.drawLine(new Vector(SIZE + 6, SIZE2 + 8), new Vector(SIZE2 + 7, SIZE + 7), Style.THIN); + graphic.drawLine(new Vector(SIZE + 4, SIZE2 + 7), new Vector(SIZE + 7, SIZE2 + 7), Style.THIN); + graphic.drawLine(new Vector(SIZE + 7, SIZE2 + 10), new Vector(SIZE + 7, SIZE2 + 7), Style.THIN); } else { Vector center = new Vector(0, SIZE); Vector rad = new Vector(RAD, RAD); - graphic.drawLine(new Vector(0, SIZE * 4 - SIZE2 - HEIGHT), new Vector(0, SIZE * 2 - 4), Style.NORMAL); - graphic.drawLine(new Vector(0, 0), new Vector(0, 5), Style.NORMAL); + graphic.drawLine(new Vector(0, SIZE * 4 - SIZE2 - HEIGHT), new Vector(0, 0), Style.NORMAL); graphic.drawCircle(center.sub(rad), center.add(rad), Style.FILLED); if (a.getBool() && !c.getBool()) {