use of de.neemann.digital.draw.graphics.Vector in project Digital by hneemann.
the class BreakShape method drawTo.
@Override
public void drawTo(Graphic graphic, Style highLight) {
Vector center = new Vector(2 + SIZE, 0);
graphic.drawCircle(center.sub(RAD), center.add(RAD), Style.NORMAL);
graphic.drawLine(center.sub(D1), center.add(D1), Style.NORMAL);
graphic.drawLine(center.sub(D2), center.add(D2), Style.NORMAL);
Vector textPos = new Vector(SIZE * 3, 0);
graphic.drawText(textPos, textPos.add(1, 0), label, Orientation.LEFTCENTER, Style.NORMAL);
}
use of de.neemann.digital.draw.graphics.Vector in project Digital by hneemann.
the class DiodeBackwardShape 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);
}
use of de.neemann.digital.draw.graphics.Vector in project Digital by hneemann.
the class DiodeForewardShape method drawTo.
@Override
public void drawTo(Graphic graphic, Style highLight) {
Style style = blown ? Style.DASH : Style.NORMAL;
graphic.drawPolygon(new Polygon(true).add(-SIZE2, 1).add(SIZE2, 1).add(0, SIZE - 1), style);
graphic.drawLine(new Vector(-SIZE2, SIZE - 1), new Vector(SIZE2, SIZE - 1), style);
}
use of de.neemann.digital.draw.graphics.Vector in project Digital by hneemann.
the class FETShapeN method drawTo.
@Override
public void drawTo(Graphic graphic, Style highLight) {
super.drawTo(graphic, highLight);
// the arrow
graphic.drawLine(new Vector(SIZE2 + 5, SIZE), new Vector(SIZE, SIZE), Style.THIN);
graphic.drawPolygon(new Polygon(true).add(SIZE2 + 2, SIZE).add(SIZE - SIZE2 / 3, SIZE - SIZE2 / 4).add(SIZE - SIZE2 / 3, SIZE + SIZE2 / 4), Style.THIN_FILLED);
}
use of de.neemann.digital.draw.graphics.Vector in project Digital by hneemann.
the class WireContainsTest method testHorizontal.
public void testHorizontal() {
Wire w = new Wire(new Vector(0, 0), new Vector(10, 0));
assertFalse(w.contains(new Vector(-5, 0), 5));
assertFalse(w.contains(new Vector(15, 0), 5));
assertFalse(w.contains(new Vector(5, 5), 5));
assertFalse(w.contains(new Vector(5, -5), 5));
assertTrue(w.contains(new Vector(5, 2), 5));
assertTrue(w.contains(new Vector(5, -2), 5));
}
Aggregations