Search in sources :

Example 26 with Vector

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

the class FETShapeP method drawTo.

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

Example 27 with Vector

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

the class ConstShape method drawTo.

@Override
public void drawTo(Graphic graphic, Style heighLight) {
    Vector textPos = new Vector(-3, 0);
    graphic.drawText(textPos, textPos.add(1, 0), value, Orientation.RIGHTCENTER, Style.NORMAL);
}
Also used : Vector(de.neemann.digital.draw.graphics.Vector)

Example 28 with Vector

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

the class DelayShape method drawTo.

@Override
public void drawTo(Graphic graphic, Style heighLight) {
    graphic.drawPolygon(new Polygon(true).add(1, -SIZE2).add(SIZE * 2 - 1, -SIZE2).add(SIZE * 2 - 1, SIZE2).add(1, SIZE2), Style.NORMAL);
    graphic.drawLine(new Vector(SIZE2, 0), new Vector(SIZE * 2 - SIZE2, 0), Style.THIN);
    int bar = SIZE2 / 2;
    graphic.drawLine(new Vector(SIZE2, bar), new Vector(SIZE2, -bar), Style.THIN);
    graphic.drawLine(new Vector(SIZE * 2 - SIZE2, bar), new Vector(SIZE * 2 - SIZE2, -bar), Style.THIN);
}
Also used : Polygon(de.neemann.digital.draw.graphics.Polygon) Vector(de.neemann.digital.draw.graphics.Vector)

Example 29 with Vector

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

the class FragmentExpressionTest method testBox.

public void testBox() throws Exception {
    ShapeFactory shapeFactory = new ShapeFactory(new ElementLibrary());
    FragmentVisualElement ve = new FragmentVisualElement(FlipflopJK.DESCRIPTION, shapeFactory);
    FragmentExpression fe = new FragmentExpression(ve, new FragmentVisualElement(Tunnel.DESCRIPTION, shapeFactory));
    fe.setPos(new Vector(0, 0));
    Box box = fe.doLayout();
    assertEquals(SIZE * 3, box.getHeight());
    assertEquals(SIZE * 4, box.getWidth());
}
Also used : ElementLibrary(de.neemann.digital.draw.library.ElementLibrary) ShapeFactory(de.neemann.digital.draw.shapes.ShapeFactory) Vector(de.neemann.digital.draw.graphics.Vector)

Example 30 with Vector

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

the class TestInGUI method testMoveSelectedComponent.

public void testMoveSelectedComponent() {
    new GuiTester().mouseMove(110, 110).add(new GuiTester.WindowCheck<>(Main.class, (gt, main) -> {
        final CircuitComponent cc = main.getCircuitComponent();
        final VisualElement ve = new VisualElement(And.DESCRIPTION.getName()).setShapeFactory(cc.getLibrary().getShapeFactory());
        cc.setPartToInsert(ve);
    })).mouseClick(InputEvent.BUTTON1_MASK).mouseMove(100, 100).mouseClick(InputEvent.BUTTON1_MASK).mouseMove(400, 400).mouseClick(InputEvent.BUTTON1_MASK).add(new GuiTester.WindowCheck<>(Main.class, (gt, main) -> {
        final Circuit c = main.getCircuitComponent().getCircuit();
        assertEquals(1, c.getElements().size());
        final Vector pos = c.getElements().get(0).getPos();
        assertTrue(pos.x > 300);
        assertTrue(pos.y > 300);
    })).execute();
}
Also used : VisualElement(de.neemann.digital.draw.elements.VisualElement) Circuit(de.neemann.digital.draw.elements.Circuit) 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