From 2a35bcdb0f4eb431352b4a9e2a1ad13e6641f4b2 Mon Sep 17 00:00:00 2001 From: hneemann Date: Sat, 11 Mar 2017 20:12:00 +0100 Subject: [PATCH] minor changes to pull up and pull down resistors --- .../digital/draw/shapes/PullDownShape.java | 19 +++++++++++++------ .../digital/draw/shapes/PullUpShape.java | 13 +++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/main/java/de/neemann/digital/draw/shapes/PullDownShape.java b/src/main/java/de/neemann/digital/draw/shapes/PullDownShape.java index 6e1f3729a..c2173aa45 100644 --- a/src/main/java/de/neemann/digital/draw/shapes/PullDownShape.java +++ b/src/main/java/de/neemann/digital/draw/shapes/PullDownShape.java @@ -19,7 +19,14 @@ import static de.neemann.digital.draw.shapes.GenericShape.SIZE2; * Created by hneemann on 01.11.16. */ public class PullDownShape implements Shape { - private static final int SIZE4 = SIZE / 4; + /** + * half the width of the resistor + */ + public static final int WIDTH2 = SIZE2 - 3; + /** + * height of the resistor + */ + public static final int HEIGHT = SIZE + SIZE / 3; private final PinDescriptions outputs; @@ -49,14 +56,14 @@ public class PullDownShape implements Shape { public void drawTo(Graphic graphic, boolean highLight) { graphic.drawPolygon( new Polygon(true) - .add(-SIZE4, 1) - .add(-SIZE4, SIZE) - .add(SIZE4, SIZE) - .add(SIZE4, 1), + .add(-WIDTH2, 1) + .add(-WIDTH2, HEIGHT) + .add(WIDTH2, HEIGHT) + .add(WIDTH2, 1), Style.NORMAL ); int o = 8; - graphic.drawLine(new Vector(0, SIZE), new Vector(0, SIZE + SIZE2 + o), Style.NORMAL); + graphic.drawLine(new Vector(0, HEIGHT), new Vector(0, SIZE + SIZE2 + o), Style.NORMAL); graphic.drawLine(new Vector(-SIZE2, SIZE + SIZE2 + o), new Vector(SIZE2, SIZE + SIZE2 + o), Style.THICK); } diff --git a/src/main/java/de/neemann/digital/draw/shapes/PullUpShape.java b/src/main/java/de/neemann/digital/draw/shapes/PullUpShape.java index 78488c7ca..a193a3aba 100644 --- a/src/main/java/de/neemann/digital/draw/shapes/PullUpShape.java +++ b/src/main/java/de/neemann/digital/draw/shapes/PullUpShape.java @@ -13,13 +13,14 @@ import de.neemann.digital.draw.graphics.Vector; import static de.neemann.digital.draw.shapes.GenericShape.SIZE; import static de.neemann.digital.draw.shapes.GenericShape.SIZE2; +import static de.neemann.digital.draw.shapes.PullDownShape.HEIGHT; +import static de.neemann.digital.draw.shapes.PullDownShape.WIDTH2; /** * A pull up resistor shape. * Created by hneemann on 01.11.16. */ public class PullUpShape implements Shape { - private static final int SIZE4 = SIZE / 4; private final PinDescriptions outputs; @@ -48,14 +49,14 @@ public class PullUpShape implements Shape { public void drawTo(Graphic graphic, boolean highLight) { graphic.drawPolygon( new Polygon(true) - .add(-SIZE4, -1) - .add(-SIZE4, -SIZE) - .add(SIZE4, -SIZE) - .add(SIZE4, -1), + .add(-WIDTH2, -1) + .add(-WIDTH2, -HEIGHT) + .add(WIDTH2, -HEIGHT) + .add(WIDTH2, -1), Style.NORMAL ); int o = 4; - graphic.drawLine(new Vector(0, -SIZE), new Vector(0, -SIZE - SIZE - o), Style.NORMAL); + graphic.drawLine(new Vector(0, -HEIGHT), new Vector(0, -SIZE - SIZE - o), Style.NORMAL); graphic.drawPolygon( new Polygon(false) .add(-SIZE2, -SIZE - SIZE2 - o)