Search in sources :

Example 21 with Vector

use of de.neemann.digital.draw.graphics.Vector in project Digital by hneemann.

the class OutputShape method drawTo.

@Override
public void drawTo(Graphic graphic, Style highLight) {
    if (graphic.isFlagSet(Graphic.LATEX)) {
        Vector center = new Vector(LATEX_RAD.x, 0);
        graphic.drawCircle(center.sub(LATEX_RAD), center.add(LATEX_RAD), Style.NORMAL);
        Vector textPos = new Vector(SIZE2 + LATEX_RAD.x, 0);
        graphic.drawText(textPos, textPos.add(1, 0), label, Orientation.LEFTCENTER, Style.INOUT);
    } else {
        Style style = Style.NORMAL;
        if (value != null) {
            style = Style.getWireStyle(value);
            if (value.getBits() > 1) {
                Vector textPos = new Vector(1 + SIZE, -4 - SIZE);
                graphic.drawText(textPos, textPos.add(1, 0), format.formatToView(value), Orientation.CENTERBOTTOM, Style.NORMAL);
            }
        }
        Vector center = new Vector(1 + SIZE, 0);
        graphic.drawCircle(center.sub(RAD), center.add(RAD), style);
        graphic.drawCircle(center.sub(RADL), center.add(RADL), Style.NORMAL);
        Vector textPos = new Vector(SIZE * 3, 0);
        graphic.drawText(textPos, textPos.add(1, 0), label, Orientation.LEFTCENTER, Style.INOUT);
    }
}
Also used : Style(de.neemann.digital.draw.graphics.Style) Vector(de.neemann.digital.draw.graphics.Vector)

Example 22 with Vector

use of de.neemann.digital.draw.graphics.Vector in project Digital by hneemann.

the class PullDownShape method drawTo.

@Override
public void drawTo(Graphic graphic, Style highLight) {
    graphic.drawPolygon(new Polygon(true).add(-WIDTH2, 1).add(-WIDTH2, HEIGHT).add(WIDTH2, HEIGHT).add(WIDTH2, 1), Style.NORMAL);
    graphic.drawLine(new Vector(0, HEIGHT), new Vector(0, SIZE * 2), Style.NORMAL);
    graphic.drawLine(new Vector(-SIZE2, SIZE * 2), new Vector(SIZE2, SIZE * 2), Style.THICK);
}
Also used : Polygon(de.neemann.digital.draw.graphics.Polygon) Vector(de.neemann.digital.draw.graphics.Vector)

Example 23 with Vector

use of de.neemann.digital.draw.graphics.Vector in project Digital by hneemann.

the class PullUpShape method drawTo.

@Override
public void drawTo(Graphic graphic, Style highLight) {
    graphic.drawPolygon(new Polygon(true).add(-WIDTH2, -1).add(-WIDTH2, -HEIGHT).add(WIDTH2, -HEIGHT).add(WIDTH2, -1), Style.NORMAL);
    graphic.drawLine(new Vector(0, -HEIGHT), new Vector(0, DOWNSHIFT - SIZE * 2 - SIZE2), Style.NORMAL);
    graphic.drawPolygon(new Polygon(false).add(-SIZE2, DOWNSHIFT - SIZE * 2).add(0, DOWNSHIFT - SIZE * 2 - SIZE * 2 / 3).add(SIZE2, DOWNSHIFT - SIZE * 2), Style.NORMAL);
}
Also used : Polygon(de.neemann.digital.draw.graphics.Polygon) Vector(de.neemann.digital.draw.graphics.Vector)

Example 24 with Vector

use of de.neemann.digital.draw.graphics.Vector in project Digital by hneemann.

the class DiodeShape method drawTo.

@Override
public void drawTo(Graphic graphic, Style highLight) {
    Style style = blown ? Style.DASH : Style.NORMAL;
    graphic.drawPolygon(new Polygon(true).add(-SIZE2, -SIZE + 1).add(SIZE2, -SIZE + 1).add(0, -1), style);
    graphic.drawLine(new Vector(-SIZE2, -1), new Vector(SIZE2, -1), style);
}
Also used : Style(de.neemann.digital.draw.graphics.Style) Polygon(de.neemann.digital.draw.graphics.Polygon) Vector(de.neemann.digital.draw.graphics.Vector)

Example 25 with Vector

use of de.neemann.digital.draw.graphics.Vector in project Digital by hneemann.

the class DriverShape method getPins.

@Override
public Pins getPins() {
    if (pins == null) {
        pins = new Pins();
        pins.add(new Pin(new Vector(-SIZE, 0), inputs.get(0)));
        pins.add(new Pin(new Vector(0, bottom ? SIZE : -SIZE), inputs.get(1)));
        pins.add(new Pin(new Vector(SIZE, 0), outputs.get(0)));
    }
    return pins;
}
Also used : Pin(de.neemann.digital.draw.elements.Pin) Pins(de.neemann.digital.draw.elements.Pins) Vector(de.neemann.digital.draw.graphics.Vector)

Aggregations

Vector (de.neemann.digital.draw.graphics.Vector)63 Wire (de.neemann.digital.draw.elements.Wire)13 Polygon (de.neemann.digital.draw.graphics.Polygon)12 VisualElement (de.neemann.digital.draw.elements.VisualElement)9 Style (de.neemann.digital.draw.graphics.Style)8 Circuit (de.neemann.digital.draw.elements.Circuit)6 Pin (de.neemann.digital.draw.elements.Pin)3 Pins (de.neemann.digital.draw.elements.Pins)3 ArrayList (java.util.ArrayList)3 Rotation (de.neemann.digital.core.element.Rotation)2 ElementLibrary (de.neemann.digital.draw.library.ElementLibrary)2 ElementNotFoundException (de.neemann.digital.draw.library.ElementNotFoundException)2 ShapeFactory (de.neemann.digital.draw.shapes.ShapeFactory)2 IOException (java.io.IOException)2 NodeException (de.neemann.digital.core.NodeException)1 ObservableValue (de.neemann.digital.core.ObservableValue)1 Movable (de.neemann.digital.draw.elements.Movable)1 GraphicMinMax (de.neemann.digital.draw.graphics.GraphicMinMax)1 Orientation (de.neemann.digital.draw.graphics.Orientation)1 Transform (de.neemann.digital.draw.graphics.Transform)1