Fixed missing shape problem: Now you can pick a missing element.

This commit is contained in:
hneemann 2016-04-09 11:29:04 +02:00
parent 7d8ed67842
commit ed89113fbd
4 changed files with 10 additions and 7 deletions

View File

@ -14,7 +14,7 @@ import de.neemann.digital.draw.graphics.Vector;
* @author hneemann * @author hneemann
*/ */
public class BreakShape implements Shape { public class BreakShape implements Shape {
public static final int SIZE = GenericShape.SIZE * 3 / 4; private static final int SIZE = GenericShape.SIZE * 3 / 4;
private static final int SIZEQ = SIZE / 2; private static final int SIZEQ = SIZE / 2;
private static final Vector RAD = new Vector(SIZE, SIZE); private static final Vector RAD = new Vector(SIZE, SIZE);
private static final Vector D1 = new Vector(SIZEQ, -SIZEQ); private static final Vector D1 = new Vector(SIZEQ, -SIZEQ);

View File

@ -3,13 +3,15 @@ package de.neemann.digital.draw.shapes;
import de.neemann.digital.draw.graphics.Graphic; import de.neemann.digital.draw.graphics.Graphic;
/** /**
* Interface implemented by the elements which can draw itself at a {@link Graphic} instance.
*
* @author hneemann * @author hneemann
*/ */
public interface Drawable { public interface Drawable {
/** /**
* Draws a element depending on its state * Draws a element depending on its state
* @param graphic interface to draw to
* *
* @param graphic interface to draw to
*/ */
void drawTo(Graphic graphic, boolean highLight); void drawTo(Graphic graphic, boolean highLight);
} }

View File

@ -18,8 +18,8 @@ import static de.neemann.digital.draw.shapes.OutputShape.SIZE;
* @author hneemann * @author hneemann
*/ */
public class LEDShape implements Shape { public class LEDShape implements Shape {
public static final Vector RAD = new Vector(SIZE - 2, SIZE - 2); private static final Vector RAD = new Vector(SIZE - 2, SIZE - 2);
public static final Vector RADL = new Vector(SIZE, SIZE); private static final Vector RADL = new Vector(SIZE, SIZE);
private final String label; private final String label;
private Style onStyle; private Style onStyle;
private IOState ioState; private IOState ioState;

View File

@ -36,9 +36,10 @@ public class MissingShape implements Shape {
@Override @Override
public void drawTo(Graphic graphic, boolean highLight) { public void drawTo(Graphic graphic, boolean highLight) {
Style style = Style.SHAPE_PIN; Style style = Style.SHAPE_PIN;
graphic.drawLine(new Vector(0, 0), new Vector(0, style.getFontSize()), style); graphic.drawLine(new Vector(0, 0), new Vector(style.getFontSize() * 10, 0), style);
graphic.drawText(new Vector(0, 0), new Vector(1, 0), message, Orientation.LEFTBOTTOM, style); graphic.drawLine(new Vector(0, 0), new Vector(0, style.getFontSize() * 2), style);
graphic.drawText(new Vector(4, 4), new Vector(5, 4), message, Orientation.LEFTTOP, style);
if (cause != null && cause.length() > 0) if (cause != null && cause.length() > 0)
graphic.drawText(new Vector(0, style.getFontSize()), new Vector(1, style.getFontSize()), cause, Orientation.LEFTBOTTOM, style); graphic.drawText(new Vector(4, 4 + style.getFontSize()), new Vector(5, 4 + style.getFontSize()), cause, Orientation.LEFTTOP, style);
} }
} }