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);
}
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);
}
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);
}
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());
}
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();
}
Aggregations