Search in sources :

Example 16 with Vector

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

the class NetListTest method testTunnel.

public void testTunnel() throws Exception {
    Circuit c = new Circuit();
    c.add(new Wire(new Vector(1, 1), new Vector(2, 1)));
    addTunnel(c, new Vector(2, 1), "A");
    c.add(new Wire(new Vector(3, 1), new Vector(4, 1)));
    addTunnel(c, new Vector(3, 1), "A");
    NetList ns = new NetList(c);
    assertEquals(1, ns.size());
}
Also used : Circuit(de.neemann.digital.draw.elements.Circuit) Wire(de.neemann.digital.draw.elements.Wire) Vector(de.neemann.digital.draw.graphics.Vector)

Example 17 with Vector

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

the class FGFETShapeN method drawTo.

@Override
public void drawTo(Graphic graphic, Style highLight) {
    super.drawTo(graphic, highLight);
    if (programmed)
        graphic.drawLine(new Vector(6, 2 * SIZE - 4), new Vector(6, 4), CHARGED_GATE);
    else
        graphic.drawLine(new Vector(6, 2 * SIZE - 4), new Vector(6, 4), Style.THIN);
    // the arrow
    graphic.drawLine(new Vector(SIZE2 + 8, SIZE), new Vector(SIZE + 3, SIZE), Style.THIN);
    graphic.drawPolygon(new Polygon(true).add(SIZE2 + 5, SIZE).add(SIZE - SIZE2 / 3 + 3, SIZE - SIZE2 / 4).add(SIZE - SIZE2 / 3 + 3, SIZE + SIZE2 / 4), Style.THIN_FILLED);
}
Also used : Polygon(de.neemann.digital.draw.graphics.Polygon) Vector(de.neemann.digital.draw.graphics.Vector)

Example 18 with Vector

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

the class FGFETShapeP method drawTo.

@Override
public void drawTo(Graphic graphic, Style highLight) {
    super.drawTo(graphic, highLight);
    if (programmed)
        graphic.drawLine(new Vector(6, 2 * SIZE - 4), new Vector(6, 4), CHARGED_GATE);
    else
        graphic.drawLine(new Vector(6, 2 * SIZE - 4), new Vector(6, 4), Style.THIN);
    // the arrow
    graphic.drawLine(new Vector(SIZE2 + 1, SIZE), new Vector(SIZE2 + 7, SIZE), Style.THIN);
    graphic.drawPolygon(new Polygon(true).add(SIZE - SIZE2 / 3 + 5, SIZE).add(SIZE2 + 7, SIZE - SIZE2 / 4).add(SIZE2 + 7, SIZE + SIZE2 / 4), Style.THIN_FILLED);
}
Also used : Polygon(de.neemann.digital.draw.graphics.Polygon) Vector(de.neemann.digital.draw.graphics.Vector)

Example 19 with Vector

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

the class LEDShape method drawTo.

@Override
public void drawTo(Graphic graphic, Style heighLight) {
    boolean fill = true;
    if (value != null) {
        fill = false;
        if (!value.isHighZ() && (value.getValue() != 0))
            fill = true;
    }
    Vector rad = new Vector(size - 2, size - 2);
    Vector radL = new Vector(size, size);
    Vector center = new Vector(1 + size, 0);
    graphic.drawCircle(center.sub(radL), center.add(radL), Style.FILLED);
    if (fill)
        graphic.drawCircle(center.sub(rad), center.add(rad), onStyle);
    Vector textPos = new Vector(2 * size + SIZE, 0);
    graphic.drawText(textPos, textPos.add(1, 0), label, Orientation.LEFTCENTER, Style.NORMAL);
}
Also used : Vector(de.neemann.digital.draw.graphics.Vector)

Example 20 with Vector

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

the class LightBulbShape method drawTo.

@Override
public void drawTo(Graphic graphic, Style highLight) {
    if (a != null && b != null) {
        boolean on = !a.isHighZ() && !b.isHighZ() && (a.getBool() != b.getBool());
        if (on)
            graphic.drawCircle(new Vector(-SIZE + BORDER + 1, BORDER + 1), new Vector(SIZE - BORDER - 1, 2 * SIZE - BORDER - 1), style);
    } else {
        graphic.drawLine(CENTER.add(-RAD, -RAD), CENTER.add(RAD, RAD), Style.NORMAL);
        graphic.drawLine(CENTER.add(-RAD, RAD), CENTER.add(RAD, -RAD), Style.NORMAL);
    }
    graphic.drawCircle(new Vector(-SIZE + BORDER, BORDER), new Vector(SIZE - BORDER, 2 * SIZE - BORDER), Style.NORMAL);
}
Also used : 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