/// <inheritdoc /> protected override void Draw(SvgDrawing drawing) { var normal = new Vector2(NormalX.Value, NormalY.Value); var tf = new Transform(X.Value, Y.Value, normal, normal.Perpendicular * Scale.Value); drawing.Polygon(new[] { new Vector2(-8, 11), new Vector2(8, 11), new Vector2(8, -11), new Vector2(-8, -11) }); drawing.Polyline(new[] { new Vector2(-8, -4), new Vector2(-6, -6), new Vector2(-8, -8) }); drawing.Text("D", new Vector2(-7, 5.5), new Vector2(1, 0), 3, 0.5); drawing.Text("C", new Vector2(-5, -5.5), new Vector2(1, 0), 3, 0.5); drawing.Text("Q", new Vector2(7, 5.5), new Vector2(-1, 0), 3, 0.5); if (Pins.IsUsed("nq")) { drawing.Text("NQ", new Vector2(7, -5.5), new Vector2(-1, 0), 3, 0.5); } if (!string.IsNullOrWhiteSpace(Label)) { drawing.Text(Label, new Vector2(10, 8), new Vector2(1, 1)); } }
/// <inheritdoc/> protected override void Draw(SvgDrawing drawing) { drawing.Segments(new[] { new Vector2(0, 11), new Vector2(0, 9), new Vector2(-6, 6), new Vector2(6, 6), new Vector2(-6, 4), new Vector2(6, 4) }); drawing.Circle(new Vector2(0, 7.5), 1.5); drawing.Polyline(new[] { new Vector2(-8, 0), new Vector2(-4, 0), new Vector2(-4, 4) }); drawing.Polyline(new[] { new Vector2(8, 0), new Vector2(4, 0), new Vector2(4, 4) }); if (Pins.IsUsed("b")) { drawing.Line(new Vector2(0, 4), new Vector2(0, 0)); if (!string.IsNullOrEmpty(Label)) { drawing.Text(Label, new Vector2(-3, -3), new Vector2(-1, -1)); } } else if (!string.IsNullOrEmpty(Label)) { drawing.Text(Label, new Vector2(0, -3), new Vector2(0, -1)); } }
private void DrawMotor(SvgDrawing drawing) { drawing.Circle(new(), 5); drawing.Text("M", new(), new()); if (!string.IsNullOrWhiteSpace(Label)) { drawing.Text(Label, new(0, 5), new(0, 1)); } }
/// <inheritdoc/> protected override void Draw(SvgDrawing drawing) { drawing.Polygon(new[] { new Vector2(-5, -8), new Vector2(5, -4), new Vector2(5, 4), new Vector2(-5, 8) }); drawing.Text("1", new Vector2(-4, -4), new Vector2(1, 0), 3, 0.5); drawing.Text("0", new Vector2(-4, 4), new Vector2(1, 0), 3, 0.5); if (!string.IsNullOrWhiteSpace(Label)) { drawing.Text(Label, new Vector2(5, 5), new Vector2(1, 1)); } }
/// <inheritdoc/> protected override void Draw(SvgDrawing drawing) { drawing.Polyline(new[] { new Vector2(-8, -8), new Vector2(8, 0), new Vector2(-8, 8), new Vector2(-8, -8) }); drawing.Segments(new[] { // Plus new Vector2(-6, -4), new Vector2(-4, -4), // Minus new Vector2(-5, 5), new Vector2(-5, 3), new Vector2(-6, 4), new Vector2(-4, 4) }); if (Pins.IsUsed("vn")) { drawing.Line(new Vector2(0, -4), new Vector2(0, -6)); } if (Pins.IsUsed("vp")) { drawing.Line(new Vector2(0, 4), new Vector2(0, 6)); } if (!string.IsNullOrWhiteSpace(Label)) { drawing.Text(Label, new Vector2(5, 5), new Vector2(1, 1)); } }
private void DrawSwitch(SvgDrawing drawing, bool t1, bool t2, bool swapped) { // Wires drawing.Path(b => b.MoveTo(-8, 0).LineTo(-6, 0) .MoveTo(6, 4).LineTo(8, 4) .MoveTo(6, -4).LineTo(8, -4), new("wire")); // Terminals drawing.Circle(new(-5, 0), 1); drawing.Circle(new(5, 4), 1); drawing.Circle(new(5, -4), 1); // Switch position if (!t1 && !t2) { drawing.Line(new(-4, 0), new(5, 0)); } else if (t1) { drawing.Line(new(-4, 0), new(4, swapped ? -4 : 4)); } else { drawing.Line(new(-4, 0), new(4, swapped ? 4 : -4)); } // Label if (!string.IsNullOrWhiteSpace(Label)) { drawing.Text(Label, new(-6, 6), new(-1, 1)); } }
private void DrawLabel(SvgDrawing drawing) { if (!string.IsNullOrWhiteSpace(Label)) { drawing.Text(Label, new(0, 4), new(0, 1)); } }
/// <inheritdoc/> protected override void Draw(SvgDrawing drawing) { drawing.Polyline(new Vector2[] { new Vector2(-8, 0), new Vector2(-6, 0), new Vector2(-5, -4), new Vector2(-3, 4), new Vector2(-1, -4), new Vector2(1, 4), new Vector2(3, -4), new Vector2(5, 4), new Vector2(6, 0), new Vector2(8, 0) }); if (Pins.IsUsed("c")) { drawing.Line(new Vector2(0, 4), new Vector2(0, 8)); drawing.Polygon(new[] { new Vector2(0, 4), new Vector2(-1, 7), new Vector2(1, 7) }); } // Depending on the orientation, let's anchor the text differently if (!string.IsNullOrWhiteSpace(Label)) { drawing.Text(Label, new Vector2(0, -7), new Vector2(0, -1)); } }
private void Draw(SvgDrawing drawing, bool straight) { drawing.Line(new(-Crossings - 2, 0), new(Crossings + 2, 0), new("wire")); if (Crossings > 0) { drawing.Path(b => { for (int i = 0; i < Crossings; i++) { double x = i * 2 - Crossings + 1; if (straight) { b.MoveTo(x, 3).Line(0, -6); } else { b.MoveTo(x - 1.5, 3).Line(3, -6); } } }); } // The label if (!string.IsNullOrWhiteSpace(Label)) { drawing.Text(Label, new(0, -4), new(0, -1)); } }
/// <inheritdoc /> private void DrawInductor(SvgDrawing drawing) { // Wires if (Pins[0].Connections == 0) { drawing.Line(new(-6, 0), new(-8, 0), new("wire")); } if (Pins[1].Connections == 0) { drawing.Line(new(6, 0), new(8, 0), new("wire")); } // Inductor drawing.Path(b => b .MoveTo(-6, 0) .CurveTo(new(-6, -4), new(-2, -4), new(-2, 0)) .SmoothTo(new(-4, 4), new(-4, 0)) .SmoothTo(new(1, -4), new(1, 0)) .SmoothTo(new(-1, 4), new(-1, 0)) .SmoothTo(new(4, -4), new(4, 0)) .SmoothTo(new(2, 4), new(2, 0)) .SmoothTo(new(6, -4), new(6, 0))); // Label if (!string.IsNullOrWhiteSpace(Label)) { drawing.Text(Label, new Vector2(0, -6), new Vector2(0, -1)); } }
private void DrawMultiplexer(SvgDrawing drawing) { drawing.Polygon(new[] { new Vector2(-5, -8), new Vector2(5, -4), new Vector2(5, 4), new Vector2(-5, 8) }); drawing.Text("1", new Vector2(-4, -4), new Vector2(1, 0), new("small")); drawing.Text("0", new Vector2(-4, 4), new Vector2(1, 0), new("small")); if (!string.IsNullOrWhiteSpace(Label)) { drawing.Text(Label, new Vector2(5, 5), new Vector2(1, 1)); } }
private void DrawTerminal(SvgDrawing drawing) { drawing.Line(new Vector2(), new Vector2(-4, 0), new("wire")); drawing.Circle(new Vector2(-5.5, 0), 1.5, new("terminal")); if (!string.IsNullOrWhiteSpace(Label)) { drawing.Text(Label, new Vector2(-10, 0), new Vector2(-1, 0)); } }
/// <inheritdoc/> protected override void Draw(SvgDrawing drawing) { drawing.Line(new Vector2(0, 0), new Vector2(0, -3)); drawing.Line(new Vector2(-5, -3), new Vector2(5, -3), "plane"); if (!string.IsNullOrWhiteSpace(Label)) { drawing.Text(Label, new Vector2(0, -6), new Vector2(0, -1)); } }
/// <inheritdoc/> protected override void Draw(SvgDrawing drawing) { drawing.Line(new Vector2(), new Vector2(-4, 0)); drawing.Circle(new Vector2(-5.5, 0), 1.5, "terminal"); if (!string.IsNullOrWhiteSpace(Label)) { drawing.Text(Label, new Vector2(-10, 0), new Vector2(-1, 0)); } }
private void DrawMic(SvgDrawing drawing) { drawing.Circle(new(), 4); drawing.Line(new(4, -4), new(4, 4), new("plane")); if (!string.IsNullOrWhiteSpace(Label)) { drawing.Text(Label, new(-6, 0), new(-1, 0)); } }
private void DrawLamp(SvgDrawing drawing) { // drawing.Path(b => b.MoveTo(-_sqrt2, -_sqrt2).LineTo(_sqrt2, _sqrt2).MoveTo(_sqrt2, -_sqrt2).LineTo(-_sqrt2, _sqrt2)); drawing.Cross(new(), _sqrt2); // Label if (!string.IsNullOrWhiteSpace(Label)) { drawing.Text(Label, new Vector2(0, -7), new Vector2(0, -1)); } }
private void DrawPower(SvgDrawing drawing) { // Wire drawing.Line(new Vector2(0, 0), new Vector2(0, -3), new("wire")); // Power drawing.Line(new Vector2(-5, -3), new Vector2(5, -3), new("plane")); if (!string.IsNullOrWhiteSpace(Label)) { drawing.Text(Label, new Vector2(0, -6), new Vector2(0, -1)); } }
private void DrawJack(SvgDrawing drawing) { drawing.Path(b => b.MoveTo(0, 2).LineTo(0, 6).MoveTo(4, 0).LineTo(6, 0), new("wire")); drawing.Circle(new(), 1.5); drawing.Circle(new(), 4); drawing.Circle(new(4, 0), 1, new("dot")); if (!string.IsNullOrWhiteSpace(Label)) { drawing.Text(Label, new(-6, 0), new(-1, 0)); } }
/// <inheritdoc/> protected override void Draw(SvgDrawing drawing) { drawing.Polygon(new[] { new Vector2(-6, 6), new Vector2(6, 0), new Vector2(-6, -6) }); if (!string.IsNullOrEmpty(Label)) { drawing.Text(Label, new Vector2(-2.5, 0), new Vector2(), 3, 0.5); } }
/// <inheritdoc/> private void DrawInverter(SvgDrawing drawing) { drawing.Polygon(new[] { new Vector2(-6, 6), new Vector2(6, 0), new Vector2(-6, -6) }); drawing.Circle(new Vector2(7.5, 0), 1.5); if (!string.IsNullOrEmpty(Label)) { drawing.Text(Label, new Vector2(-2.5, 0), new Vector2()); } }
private void DrawFlipFlop(SvgDrawing drawing) { drawing.Polygon(new[] { new Vector2(-8, 11), new Vector2(8, 11), new Vector2(8, -11), new Vector2(-8, -11) }); drawing.Polyline(new[] { new Vector2(-8, 4), new Vector2(-6, 6), new Vector2(-8, 8) }); drawing.Text("D", new Vector2(-7, -5.5), new Vector2(1, 0)); drawing.Text("C", new Vector2(-5, 5.5), new Vector2(1, 0)); drawing.Text("Q", new Vector2(7, -5.5), new Vector2(-1, 0)); if (Pins["nq"].Connections > 0) { drawing.Text("NQ", new Vector2(7, 5.5), new Vector2(-1, 0)); } if (!string.IsNullOrWhiteSpace(Label)) { drawing.Text(Label, new Vector2(10, -8), new Vector2(1, 1)); } }
private void DrawADC(SvgDrawing drawing) { drawing.Polygon(new[] { new Vector2(-Width / 2, Height / 2), new Vector2(Width / 2 - Height / 2, Height / 2), new Vector2(Width / 2, 0), new Vector2(Width / 2 - Height / 2, -Height / 2), new Vector2(-Width / 2, -Height / 2) }); if (!string.IsNullOrWhiteSpace(Label)) { drawing.Text(Label, new Vector2(-Height / 4, 0), new Vector2(0, 0)); } }
private void DrawRegular(SvgDrawing drawing) { // Wires if (Pins[0].Connections == 0) { drawing.Line(new(-4, 0), new(-8, 0), new("wire")); } if (Pins[1].Connections == 0) { drawing.Line(new(0, 6), new(0, 8), new("wire")); } if (Pins[3].Connections == 0) { drawing.Line(new(4, 0), new(8, 0), new("wire")); } // Gate drawing.Path(b => b.MoveTo(-6, 4).LineTo(6, 4).MoveTo(-6, 6).LineTo(6, 6), new("gate")); // Source and drain drawing.Line(new(-4, 0), new(-4, 4), new("source")); drawing.Line(new(4, 0), new(4, 4), new("drain")); // Label if (!string.IsNullOrWhiteSpace(Label)) { if (Pins["b"].Connections > 0) { drawing.Text(Label, new(-3, -3), new(-1, -1)); } else { drawing.Text(Label, new(0, -3), new(0, -1)); } } }
/// <inheritdoc/> protected override void Draw(SvgDrawing drawing) { drawing.Segments(new[] { new Vector2(-8, 0), new Vector2(-6, 0), new Vector2(6, 0), new Vector2(8, 0) }); drawing.Polygon(new[] { new Vector2(-6, 3), new Vector2(6, 3), new Vector2(6, -3), new Vector2(-6, -3) }); // Depending on the orientation, let's anchor the text differently if (!string.IsNullOrWhiteSpace(Label)) { drawing.Text(Label, new Vector2(0, -7), new Vector2(0, -1)); } }
/// <inheritdoc /> protected override void Draw(SvgDrawing drawing) { drawing.Segments(new[] { new Vector2(0, 6), new Vector2(0, 4), new Vector2(-6, 4), new Vector2(6, 4) }); drawing.Polyline(new[] { new Vector2(-3, 4), new Vector2(-6, 0), new Vector2(-8, 0) }); drawing.Polyline(new[] { new Vector2(3, 4), new Vector2(6, 0), new Vector2(8, 0) }); drawing.Polygon(new[] { new Vector2(-3, 4), new Vector2(-3.7, 1.4), new Vector2(-5.3, 2.6) }); if (!string.IsNullOrEmpty(Label)) { drawing.Text(Label, new Vector2(0, -3), new Vector2(0, -1)); } }
private void DrawPoint(SvgDrawing drawing) { int connections = Pins[0].Connections; if (connections == 0 || connections > 2) { drawing.Circle(new Vector2(), 1, new("dot")); } if (!string.IsNullOrWhiteSpace(Label)) { var n = Vector2.Normal(-Angle / 180.0 * Math.PI); drawing.Text(Label, n * Distance, n); } }
/// <inheritdoc /> protected override void Draw(SvgDrawing drawing) { drawing.Segments(new[] { new Vector2(-5, 0), new Vector2(-1.5, 0), new Vector2(1.5, 0), new Vector2(5, 0) }); drawing.Segments(new[] { new Vector2(-1.5, -4), new Vector2(-1.5, 4), new Vector2(1.5, -4), new Vector2(1.5, 4), }, "plane"); // Depending on the orientation, let's anchor the text differently if (!string.IsNullOrWhiteSpace(Label)) { drawing.Text(Label, new Vector2(0, -7), new Vector2(0, -1)); } }
/// <inheritdoc/> protected override void Draw(SvgDrawing drawing) { drawing.Polygon(new[] { new Vector2(-5, -8), new Vector2(5, -4), new Vector2(5, 4), new Vector2(-5, 8) }); drawing.Segments(new[] { new Vector2(-3, -4), new Vector2(-1, -4), new Vector2(-2, 5), new Vector2(-2, 3), new Vector2(-3, 4), new Vector2(-1, 4) }); if (!string.IsNullOrWhiteSpace(Label)) { drawing.Text(Label, new Vector2(5, 5), new Vector2(1, 1)); } }
/// <inheritdoc /> protected override void Draw(SvgDrawing drawing) { drawing.Segments(new[] { new Vector2(-6, 0), new Vector2(-4, 0), new Vector2(4, -4), new Vector2(4, 4), new Vector2(4, 0), new Vector2(6, 0) }); drawing.Polygon(new[] { new Vector2(-4, -4), new Vector2(4, 0), new Vector2(-4, 4), new Vector2(-4, 4) }); if (!string.IsNullOrWhiteSpace(Label)) { drawing.Text(Label, new Vector2(0, -6), new Vector2(0, -1)); } }
private void DrawImpedance(SvgDrawing drawing) { // Draw some wire extensions if nothing is connected if (Pins[0].Connections == 0) { drawing.Line(new(-6, 0), new(-8, 0), new("wire")); } if (Pins[1].Connections == 0) { drawing.Line(new(6, 0), new(8, 0), new("wire")); } // The rectangle CommonGraphical.Rectangle(drawing, 12, 6); // The label if (!string.IsNullOrWhiteSpace(Label)) { drawing.Text(Label, new(0, -7), new(0, -1)); } }