Search in sources :

Example 46 with Vector

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);
}
Also used : Vector(de.neemann.digital.draw.graphics.Vector)

Example 47 with Vector

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);
}
Also used : Style(de.neemann.digital.draw.graphics.Style) Polygon(de.neemann.digital.draw.graphics.Polygon) Vector(de.neemann.digital.draw.graphics.Vector)

Example 48 with Vector

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);
}
Also used : Style(de.neemann.digital.draw.graphics.Style) Polygon(de.neemann.digital.draw.graphics.Polygon) Vector(de.neemann.digital.draw.graphics.Vector)

Example 49 with Vector

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);
}
Also used : Polygon(de.neemann.digital.draw.graphics.Polygon) Vector(de.neemann.digital.draw.graphics.Vector)

Example 50 with Vector

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