public static void LayoutSymbol(SymbolLayout Sym, JfetType Type, Terminal S, Terminal G, Terminal D, Func <string> Name, Func <string> Part) { int bx = 0; Sym.AddTerminal(S, new Coord(10, -20), new Coord(10, -10), new Coord(0, -10)); Sym.AddTerminal(G, new Coord(-20, 0), new Coord(-10, 0)); Sym.AddTerminal(D, new Coord(10, 20), new Coord(10, 10), new Coord(0, 10)); Sym.DrawLine(EdgeType.Black, new Coord(bx, 12), new Coord(bx, -12)); switch (Type) { case JfetType.N: Sym.DrawArrow(EdgeType.Black, new Coord(-10, 0), new Coord(0, 0), 0.2, 0.3); break; case JfetType.P: Sym.DrawArrow(EdgeType.Black, new Coord(0, 0), new Coord(-10, 0), 0.2, 0.3); break; default: throw new NotSupportedException("Unknown JFET type."); } if (Part != null) { Sym.DrawText(Part, new Coord(8, 20), Alignment.Far, Alignment.Near); } Sym.DrawText(Name, new Point(8, -20), Alignment.Far, Alignment.Far); Sym.AddCircle(EdgeType.Black, new Coord(0, 0), 20); }
public SymbolLayout LayoutSymbol() { SymbolLayout layout = new SymbolLayout(); LayoutSymbol(layout); return(layout); }
public override void LayoutSymbol(SymbolLayout Sym) { int h = 20; Sym.AddTerminal(pa, new Coord(-10, h)); Sym.AddTerminal(pc, new Coord(-10, -h)); Sym.AddTerminal(sa, new Coord(10, h)); Sym.AddTerminal(st, new Coord(10, 0)); Sym.AddTerminal(sc, new Coord(10, -h)); Sym.DrawText(() => Name, new Coord(-16, -h / 2), Alignment.Far, Alignment.Center); Sym.DrawText(() => Turns.ToString(), new Coord(-16, h / 2), Alignment.Far, Alignment.Center); h -= 4; Sym.AddWire(pa, new Coord(-10, h)); Sym.AddWire(pc, new Coord(-10, -h)); Sym.AddWire(sa, new Coord(10, h)); Sym.AddWire(sc, new Coord(10, -h)); Sym.InBounds(new Coord(-20, 0), new Coord(20, 0)); Inductor.Draw(Sym, -10, -h, h, 4, 4.0); Sym.DrawLine(EdgeType.Black, new Coord(-2, h), new Coord(-2, -h)); Sym.DrawLine(EdgeType.Black, new Coord(2, h), new Coord(2, -h)); Inductor.Draw(Sym, 10, -h, 0.0, 2, -4.0); Inductor.Draw(Sym, 10, h, 0.0, 2, -4.0); }
public static void LayoutSymbol(SymbolLayout Sym, BjtType Type, Terminal C, Terminal B, Terminal E, Func <string> Name, Func <string> Part) { int bx = -5; Sym.AddTerminal(B, new Coord(-20, 0), new Coord(bx, 0)); switch (Type) { case BjtType.NPN: Sym.AddTerminal(C, new Coord(10, 20), new Coord(10, 17)); Sym.AddTerminal(E, new Coord(10, -20), new Coord(10, -17)); Sym.DrawLine(EdgeType.Black, new Coord(10, 17), new Coord(bx, 8)); Sym.DrawArrow(EdgeType.Black, new Coord(bx, -8), new Coord(10, -17), 0.2, 0.3); break; case BjtType.PNP: Sym.AddTerminal(E, new Coord(10, 20), new Coord(10, 17)); Sym.AddTerminal(C, new Coord(10, -20), new Coord(10, -17)); Sym.DrawArrow(EdgeType.Black, new Coord(10, 17), new Coord(bx, 8), 0.2, 0.3); Sym.DrawLine(EdgeType.Black, new Coord(bx, -8), new Coord(10, -17)); break; default: throw new NotSupportedException("Unknown BJT type."); } Sym.DrawLine(EdgeType.Black, new Coord(bx, 12), new Coord(bx, -12)); if (Part != null) { Sym.DrawText(Part, new Coord(8, 20), Alignment.Far, Alignment.Near); } Sym.DrawText(Name, new Point(8, -20), Alignment.Far, Alignment.Far); Sym.AddCircle(EdgeType.Black, new Coord(0, 0), 20); }
public Symbol(Component Component) { component = Component; component.Tag = this; layout = new SymbolLayout(); component.LayoutSymbol(layout); }
public override void LayoutSymbol(SymbolLayout Sym) { Sym.DrawLine(EdgeType.Gray, new Point(-20, -10), new Point(20, -10)); Sym.DrawLine(EdgeType.Gray, new Point(-20, -10), new Point(-20, 10)); Sym.InBounds(new Coord(-20, -10), new Coord(20, 10)); Sym.DrawText(() => text, new Point(-18, 0), Alignment.Near, Alignment.Center, Size.Large); Sym.DrawText(() => subtext, new Point(-18, -10), Alignment.Near, Alignment.Far, Size.Normal); }
public override void LayoutSymbol(SymbolLayout Sym) { base.LayoutSymbol(Sym); Sym.InBounds(new Coord(-20, 10), new Coord(20, 0)); Sym.AddLine(EdgeType.Black, new Coord(-15, 0), new Coord(15, 0)); Sym.DrawText(() => Voltage.ToString(), new Point(0, 2), Alignment.Center, Alignment.Near); }
public override void LayoutSymbol(SymbolLayout Sym) { Sym.AddTerminal(Terminal, new Coord(0, 0)); Sym.AddLoop(EdgeType.Black, new Coord(-10, 0), new Coord(10, 0), new Coord(0, -10)); }
public override void LayoutSymbol(SymbolLayout Sym) { base.LayoutSymbol(Sym); Sym.AddLoop(EdgeType.Black, new Coord(-10, 0), new Coord(10, 0), new Coord(0, -10)); }
public override void LayoutSymbol(SymbolLayout Sym) { base.LayoutSymbol(Sym); Sym.InBounds(new Coord(-10, -10), new Coord(10, 10)); Sym.AddRectangle(EdgeType.Black, new Coord(-5, -5), new Coord(5, 5)); Sym.DrawText(() => Name, new Coord(0, 7), Alignment.Center, Alignment.Near); }
public static void Draw(SymbolLayout Sym, double x, double y1, double y2, int N, double Scale) { double h = y2 - y1; Sym.DrawFunction( EdgeType.Black, (t) => x - Scale * (Math.Abs((t + 0.5) % 2 - 1) * 2 - 1), (t) => t * h / N + y1, 0, N, N * 2); }
public override void LayoutSymbol(SymbolLayout Sym) { base.LayoutSymbol(Sym); Sym.InBounds(new Coord(-10, -20), new Coord(10, 20)); Sym.DrawPositive(EdgeType.Black, new Coord(0, 15)); Sym.DrawNegative(EdgeType.Black, new Coord(0, -15)); Sym.DrawText(() => Name.ToString(), new Point(0, 0), Alignment.Center, Alignment.Center); }
public override void LayoutSymbol(SymbolLayout Sym) { base.LayoutSymbol(Sym); Sym.AddWire(Anode, new Coord(0, 7)); Sym.AddWire(Cathode, new Coord(0, -7)); Sym.DrawArrow(EdgeType.Black, new Coord(0, -7), new Coord(0, 7), 0.2f); Sym.DrawText(() => Name, new Point(5, 0), Alignment.Near, Alignment.Center); }
public override void LayoutSymbol(SymbolLayout Sym) { base.LayoutSymbol(Sym); Sym.InBounds(new Coord(-10, 0), new Coord(10, 0)); Sym.AddWire(Terminal, new Coord(0, -15)); Sym.AddWire(new Coord(0, -19), new Coord(0, -22)); Sym.AddWire(new Coord(0, -27), new Coord(0, -30)); Sym.DrawText(() => WireName, new Coord(2, -15), Alignment.Near, Alignment.Center); }
public override void LayoutSymbol(SymbolLayout Sym) { base.LayoutSymbol(Sym); int w = 10; Sym.AddLine(EdgeType.Black, new Coord(-w, 20), new Coord(w, 20)); Sym.DrawPositive(EdgeType.Black, new Coord(0, 15)); Sym.AddLine(EdgeType.Black, new Coord(-w, -20), new Coord(w, -20)); Sym.DrawNegative(EdgeType.Black, new Coord(0, -15)); Sym.DrawText(() => Name, new Point(0, 0), Alignment.Center, Alignment.Center); }
public override void LayoutSymbol(SymbolLayout Sym) { base.LayoutSymbol(Sym); Sym.AddWire(Anode, new Coord(0, 16)); Sym.AddWire(Cathode, new Coord(0, -16)); Sym.InBounds(new Coord(-10, 0), new Coord(10, 0)); Draw(Sym, 0.0, -16.0, 16.0, 4); Sym.DrawText(() => Name, new Coord(6, 0), Alignment.Near, Alignment.Center); Sym.DrawText(() => inductance.ToString(), new Coord(-6, 0), Alignment.Far, Alignment.Center); }
public override void LayoutSymbol(SymbolLayout Sym) { Sym.InBounds(new Coord(-20, 20), new Coord(20, -20)); Sym.AddLoop(EdgeType.Red, new Coord(-18, -20), new Coord(-19, -19), new Coord(-1, 19), new Coord(1, 19), new Coord(19, -19), new Coord(18, -20)); Sym.AddRectangle(EdgeType.Red, new Coord(-2, 10), new Coord(2, -8)); Sym.AddRectangle(EdgeType.Red, new Coord(-2, -12), new Coord(2, -16)); }
public override void LayoutSymbol(SymbolLayout Sym) { Sym.InBounds(new Coord(-20, 20), new Coord(20, -20)); Sym.AddLoop(EdgeType.Orange, new Coord(-18, -20), new Coord(-19, -19), new Coord(-1, 19), new Coord(1, 19), new Coord(19, -19), new Coord(18, -20)); Sym.AddRectangle(EdgeType.Orange, new Coord(-2, 10), new Coord(2, -8)); Sym.AddRectangle(EdgeType.Orange, new Coord(-2, -12), new Coord(2, -16)); }
public override void LayoutSymbol(SymbolLayout Sym) { base.LayoutSymbol(Sym); Sym.AddWire(Anode, new Coord(0, 2)); Sym.AddWire(Cathode, new Coord(0, -2)); Sym.AddLine(EdgeType.Black, new Coord(-10, 2), new Coord(10, 2)); Sym.AddLine(EdgeType.Black, new Coord(-10, -2), new Coord(10, -2)); Sym.DrawText(() => Name, new Coord(12, 0), Alignment.Near, Alignment.Center); Sym.DrawText(() => capacitance.ToString(), new Coord(-12, 0), Alignment.Far, Alignment.Center); }
public static void LayoutSymbol(SymbolLayout Sym, Terminal p, Terminal n, Terminal o, Terminal vp, Terminal vn, Func<string> Name, Func<string> Part) { IdealOpAmp.LayoutSymbol(Sym, p, n, o, Name); Sym.AddTerminal(vn, new Coord(0, -20), new Coord(0, -10)); Sym.DrawNegative(EdgeType.Black, new Coord(5, -13)); Sym.AddTerminal(vp, new Coord(0, 20), new Coord(0, 10)); Sym.DrawPositive(EdgeType.Black, new Coord(5, 13)); if (Part != null) Sym.DrawText(Part, new Coord(12, 4), Alignment.Near, Alignment.Near); }
public override void LayoutSymbol(SymbolLayout Sym) { base.LayoutSymbol(Sym); int r = 10; Sym.AddWire(Anode, new Coord(0, r)); Sym.AddWire(Cathode, new Coord(0, -r)); Sym.AddCircle(EdgeType.Black, new Coord(0, 0), r); Sym.DrawArrow(EdgeType.Black, new Coord(0, -7), new Coord(0, 7), 0.2f); Sym.DrawText(() => Current.ToString(), new Point(r * 0.7, r * 0.7), Alignment.Near, Alignment.Near); Sym.DrawText(() => Name, new Point(r * 0.7, r * -0.7), Alignment.Near, Alignment.Far); }
public override void LayoutSymbol(SymbolLayout Sym) { base.LayoutSymbol(Sym); Sym.AddWire(Anode, new Coord(0, 10)); Sym.AddWire(Cathode, new Coord(0, -10)); Sym.AddLoop(EdgeType.Black, new Coord(-10, 10), new Coord(10, 10), new Coord(0, -10)); Sym.DrawText(() => Name, new Coord(10, 0), Alignment.Near, Alignment.Center); }
public static void LayoutSymbol(SymbolLayout Sym, Terminal p, Terminal n, Terminal o, Terminal vp, Terminal vn, Func <string> Name, Func <string> Part) { IdealOpAmp.LayoutSymbol(Sym, p, n, o, Name); Sym.AddTerminal(vn, new Coord(0, -20), new Coord(0, -10)); Sym.DrawNegative(EdgeType.Black, new Coord(5, -13)); Sym.AddTerminal(vp, new Coord(0, 20), new Coord(0, 10)); Sym.DrawPositive(EdgeType.Black, new Coord(5, 13)); if (Part != null) { Sym.DrawText(Part, new Coord(12, 4), Alignment.Near, Alignment.Near); } }
public static void Draw(SymbolLayout Sym, double x, double y1, double y2, int Turns, double Scale) { double t1 = -3.141592; double t2 = 2 * (Turns - 1) * 3.141592; double coil = 1.5; double min = t1 + coil * Math.Cos(t1); double max = t2 + coil * Math.Cos(t2); double length = max - min; Sym.DrawFunction( EdgeType.Black, (t) => x - Scale * Math.Sin(t), (t) => (t + coil * Math.Cos(t) - min) / length * (y2 - y1) + y1, t1, t2, Turns * 16); }
public override void LayoutSymbol(SymbolLayout Sym) { base.LayoutSymbol(Sym); Sym.AddWire(Anode, new Coord(0, 16)); Sym.AddWire(Cathode, new Coord(0, -16)); Sym.InBounds(new Coord(-10, 0), new Coord(10, 0)); Resistor.Draw(Sym, 0, -16, 16, 7); Sym.DrawArrow(EdgeType.Black, new Coord(-6, -15), new Coord(6, 15), 0.1); Sym.DrawText(() => Resistance.ToString(), new Coord(-7, 0), Alignment.Far, Alignment.Center); Sym.DrawText(() => Wipe.ToString("G3"), new Coord(9, 3), Alignment.Near, Alignment.Near); Sym.DrawText(() => Name, new Coord(9, -3), Alignment.Near, Alignment.Far); }
public static void Draw(SymbolLayout Sym, double x, double y1, double y2, int Turns, double Scale) { double t1 = -Math.PI; double t2 = 2 * (Turns - 1) * Math.PI; double coil = 1.5; double min = t1 + coil * Math.Cos(t1); double max = t2 + coil * Math.Cos(t2); double length = max - min; Sym.DrawFunction( EdgeType.Black, (t) => x - Scale * Math.Sin(t), (t) => (t + coil * Math.Cos(t) - min) / length * (y2 - y1) + y1, t1, t2, Turns * 16); }
public static void LayoutSymbol(SymbolLayout Sym, Terminal P, Terminal G, Terminal K, Func<string> Name, Func<string> Part) { Sym.AddTerminal(P, new Coord(0, 20), new Coord(0, 4)); Sym.AddWire(new Coord(-10, 4), new Coord(10, 4)); Sym.AddTerminal(G, new Coord(-20, 0), new Coord(-12, 0)); for (int i = -8; i < 16; i += 8) Sym.AddWire(new Coord(i, 0), new Coord(i + 4, 0)); Sym.AddTerminal(K, new Coord(-10, -20), new Coord(-10, -6), new Coord(-8, -4), new Coord(8, -4), new Coord(10, -6)); Sym.AddCircle(EdgeType.Black, new Coord(0, 0), 20); if (Part != null) Sym.DrawText(Part, new Coord(-2, 20), Alignment.Far, Alignment.Near); Sym.DrawText(Name, new Point(-8, -20), Alignment.Near, Alignment.Far); }
public static void LayoutSymbol(SymbolLayout Sym, Terminal p, Terminal n, Terminal o, Func<string> Name) { Sym.AddTerminal(p, new Coord(-20, -10)); Sym.DrawPositive(EdgeType.Black, new Coord(-15, -10)); Sym.AddTerminal(n, new Coord(-20, 10)); Sym.DrawNegative(EdgeType.Black, new Coord(-15, 10)); Sym.AddTerminal(o, new Coord(20, 0)); Sym.AddWire(o, new Coord(20, 0)); Sym.AddLoop(EdgeType.Black, new Coord(-20, 20), new Coord(-20, -20), new Coord(20, 0)); Sym.DrawText(Name, new Coord(12, -4), Alignment.Near, Alignment.Far); }
public static void LayoutSymbol(SymbolLayout Sym, Terminal p, Terminal n, Terminal o, Func <string> Name) { Sym.AddTerminal(p, new Coord(-20, -10)); Sym.DrawPositive(EdgeType.Black, new Coord(-15, -10)); Sym.AddTerminal(n, new Coord(-20, 10)); Sym.DrawNegative(EdgeType.Black, new Coord(-15, 10)); Sym.AddTerminal(o, new Coord(20, 0)); Sym.AddWire(o, new Coord(20, 0)); Sym.AddLoop(EdgeType.Black, new Coord(-20, 20), new Coord(-20, -20), new Coord(20, 0)); Sym.DrawText(Name, new Coord(12, -4), Alignment.Near, Alignment.Far); }
public override void LayoutSymbol(SymbolLayout Sym) { // Get the ports to add to the symbol. List <Port> ports = Components.OfType <Port>().OrderBy(i => i.Name).ToList(); int number = (Math.Max(ports.Max(i => i.Number, 0), ports.Count()) + 1) & ~1; int w = 40; int h = (number / 2) * 10; Sym.DrawText(() => PartNumber, new Coord(0, h + 2), Alignment.Center, Alignment.Near); Sym.AddRectangle(EdgeType.Black, new Coord(-w, -h), new Coord(w, h)); Sym.DrawText(() => Name, new Coord(0, -h - 2), Alignment.Center, Alignment.Far); // Draw a notch at the top of the IC. Port slots are numbered counter-clockwise from here. int r = 5; Sym.DrawFunction(EdgeType.Black, t => t, t => h - Math.Sqrt(r * r - t * t), -r, r, 12); // Remember which port slots are open for the unnumbered terminals. List <int> open = Enumerable.Range(1, number + 1).ToList(); foreach (Port i in ports.OrderBy(i => i.Number > 0 ? 0 : 1)) { int n = i.Number > 0 ? i.Number : open.First(); Terminal t = i.External; Coord x; if (n <= number / 2) { x = new Coord(-w, h - n * 20 + 10); } else { x = new Coord(w, n * 20 - 3 * h - 10); } Sym.AddTerminal(t, x); Sym.DrawText(() => t.Name, new Coord(x.x - Math.Sign(x.x) * 3, x.y), x.x < 0 ? Alignment.Near : Alignment.Far, Alignment.Center); open.Remove(n); } }
public override sealed void LayoutSymbol(SymbolLayout Sym) { Sym.InBounds(new Coord(-20, -20), new Coord(10, 20)); Sym.AddTerminal(Anode, new Coord(-10, 20), new Coord(-10, 16)); Sym.DrawPositive(EdgeType.Black, new Coord(-16, 16)); Sym.AddTerminal(Cathode, new Coord(-10, -20), new Coord(-10, -16)); Sym.DrawNegative(EdgeType.Black, new Coord(-16, -16)); Sym.AddTerminal(Wiper, new Coord(10, 0)); Sym.DrawArrow(EdgeType.Black, new Coord(10, 0), new Coord(-6, 0), 0.2); Resistor.Draw(Sym, -10, -16, 16, 7); Sym.DrawText(() => Resistance.ToString(), new Coord(-17, 0), Alignment.Far, Alignment.Center); Sym.DrawText(() => Wipe.ToString("G3"), new Coord(-4, 4), Alignment.Near, Alignment.Near); Sym.DrawText(() => Name, new Coord(-4, -4), Alignment.Near, Alignment.Far); }
public override void LayoutSymbol(SymbolLayout Sym) { Sym.AddTerminal(common, new Coord(0, -20), new Coord(0, -12)); Sym.AddCircle(EdgeType.Black, new Coord(0, -12), 2); for (int i = 0; i < Throws.Length; ++i) { int x = (i - Throws.Length / 2) * 20 + (Throws.Length % 2 == 0 ? 10 : 0); Sym.AddTerminal(throws[i], new Coord(x, 20), new Coord(x, 12)); Sym.DrawEllipse(EdgeType.Black, new Coord(x - 2, 10), new Coord(x + 2, 14)); //Sym.DrawText(i.ToString(), new Coord(x, 12), Alignment.Near, Alignment.Near); if (i == Position) { Sym.AddWire(new Coord(0, -12), new Coord(x, 12)); } } Sym.DrawText(() => Group, new Coord(-2, -12), Alignment.Far, Alignment.Far); Sym.DrawText(() => Name, new Coord(2, -12), Alignment.Near, Alignment.Far); }
public override void LayoutSymbol(SymbolLayout Sym) { Sym.AddTerminal(pa, new Coord(-10, 20)); Sym.AddTerminal(pc, new Coord(-10, -20)); Sym.AddTerminal(sa, new Coord(10, 20)); Sym.AddTerminal(sc, new Coord(10, -20)); Sym.AddWire(pa, new Coord(-10, 16)); Sym.AddWire(pc, new Coord(-10, -16)); Sym.AddWire(sa, new Coord(10, 16)); Sym.AddWire(sc, new Coord(10, -16)); Sym.InBounds(new Coord(-20, 0), new Coord(20, 0)); Inductor.Draw(Sym, -10, -16.0, 16.0, 4, 4.0); Sym.DrawLine(EdgeType.Black, new Coord(-2, 16), new Coord(-2, -16)); Sym.DrawLine(EdgeType.Black, new Coord(2, 16), new Coord(2, -16)); Inductor.Draw(Sym, 10, -16.0, 16.0, 4, -4.0); Sym.DrawText(() => Name, new Coord(-16, 0), Alignment.Far, Alignment.Center); Sym.DrawText(() => Turns.ToString(), new Coord(16, 0), Alignment.Near, Alignment.Center); }
public override void LayoutSymbol(SymbolLayout Sym) { base.LayoutSymbol(Sym); Sym.AddWire(Anode, new Coord(0, 12)); Sym.AddWire(Cathode, new Coord(0, -12)); Sym.AddCircle(EdgeType.Black, new Coord(0, 12), 2); Sym.AddCircle(EdgeType.Black, new Coord(0, -12), 2); Sym.InBounds(new Coord(-10, 0), new Coord(10, 0)); if (closed) { Sym.AddWire(new Coord(0, -12), new Coord(0, 12)); } else { Sym.AddWire(new Coord(0, -12), new Coord(-8, 10)); } Sym.DrawText(() => Name, new Coord(2, 0), Alignment.Near, Alignment.Center); }
public override void LayoutSymbol(SymbolLayout Sym) { base.LayoutSymbol(Sym); int r = 10; Sym.AddWire(Anode, new Coord(0, r)); Sym.AddWire(Cathode, new Coord(0, -r)); Sym.AddCircle(EdgeType.Black, new Coord(0, 0), r); Sym.DrawPositive(EdgeType.Black, new Coord(0, 7)); Sym.DrawNegative(EdgeType.Black, new Coord(0, -7)); if (!((Expression)Voltage is Constant)) Sym.DrawFunction( EdgeType.Black, (t) => t * r * 0.75, (t) => Math.Sin(t * 3.1415) * r * 0.5, -1, 1); Sym.DrawText(() => Voltage.ToString(), new Point(r * 0.7, r * 0.7), Alignment.Near, Alignment.Near); Sym.DrawText(() => Name, new Point(r * 0.7, r * -0.7), Alignment.Near, Alignment.Far); }
public static void LayoutSymbol(SymbolLayout Sym, Terminal P, Terminal G, Terminal K, Func <string> Name, Func <string> Part) { Sym.AddTerminal(P, new Coord(0, 20), new Coord(0, 4)); Sym.AddWire(new Coord(-10, 4), new Coord(10, 4)); Sym.AddTerminal(G, new Coord(-20, 0), new Coord(-12, 0)); for (int i = -8; i < 16; i += 8) { Sym.AddWire(new Coord(i, 0), new Coord(i + 4, 0)); } Sym.AddTerminal(K, new Coord(-10, -20), new Coord(-10, -6), new Coord(-8, -4), new Coord(8, -4), new Coord(10, -6)); Sym.AddCircle(EdgeType.Black, new Coord(0, 0), 20); if (Part != null) { Sym.DrawText(Part, new Coord(-2, 20), Alignment.Far, Alignment.Near); } Sym.DrawText(Name, new Point(-8, -20), Alignment.Near, Alignment.Far); }
public override void LayoutSymbol(SymbolLayout Sym) { Coord w = new Coord(0, 0); Sym.AddTerminal(Terminal, w); Coord dw = new Coord(1, 1); Coord pw = new Coord(dw.y, -dw.x); w += dw * 10; Sym.AddWire(Terminal, w); Sym.AddLine(color, w - pw * 4, w + pw * 4); Sym.AddLoop(color, w + pw * 2, w + pw * 2 + dw * 10, w + dw * 12, w - pw * 2 + dw * 10, w - pw * 2); if (ConnectedTo != null) Sym.DrawText(() => V.ToString(), new Point(0, 6), Alignment.Far, Alignment.Near); }
public override void LayoutSymbol(SymbolLayout Sym) { // Get the ports to add to the symbol. List<Port> ports = Components.OfType<Port>().OrderBy(i => i.Name).ToList(); int number = (Math.Max(ports.Max(i => i.Number, 0), ports.Count()) + 1) & ~1; int w = 40; int h = (number / 2) * 10; Sym.DrawText(() => PartNumber, new Coord(0, h + 2), Alignment.Center, Alignment.Near); Sym.AddRectangle(EdgeType.Black, new Coord(-w, -h), new Coord(w, h)); Sym.DrawText(() => Name, new Coord(0, -h - 2), Alignment.Center, Alignment.Far); // Draw a notch at the top of the IC. Port slots are numbered counter-clockwise from here. int r = 5; Sym.DrawFunction(EdgeType.Black, t => t, t => h - Math.Sqrt(r * r - t * t), -r, r, 12); // Remember which port slots are open for the unnumbered terminals. List<int> open = Enumerable.Range(1, number + 1).ToList(); foreach (Port i in ports.OrderBy(i => i.Number > 0 ? 0 : 1)) { int n = i.Number > 0 ? i.Number : open.First(); Terminal t = i.External; Coord x; if (n <= number / 2) x = new Coord(-w, h - n * 20 + 10); else x = new Coord(w, n * 20 - 3 * h - 10); Sym.AddTerminal(t, x); Sym.DrawText(() => t.Name, new Coord(x.x - Math.Sign(x.x) * 3, x.y), x.x < 0 ? Alignment.Near : Alignment.Far, Alignment.Center); open.Remove(n); } }
public override void LayoutSymbol(SymbolLayout Sym) { AssertImpl(); impl.LayoutSymbol(Sym); }
public override void LayoutSymbol(SymbolLayout Sym) { LayoutSymbol(Sym, Type, Source, Gate, Drain, () => Name, () => PartNumber); }
public static void LayoutSymbol(SymbolLayout Sym, JfetType Type, Terminal S, Terminal G, Terminal D, Func<string> Name, Func<string> Part) { int bx = 0; Sym.AddTerminal(S, new Coord(10, -20), new Coord(10, -10), new Coord(0, -10)); Sym.AddTerminal(G, new Coord(-20, 0), new Coord(-10, 0)); Sym.AddTerminal(D, new Coord(10, 20), new Coord(10, 10), new Coord(0, 10)); Sym.DrawLine(EdgeType.Black, new Coord(bx, 12), new Coord(bx, -12)); switch (Type) { case JfetType.N: Sym.DrawArrow(EdgeType.Black, new Coord(-10, 0), new Coord(0, 0), 0.2, 0.3); break; case JfetType.P: Sym.DrawArrow(EdgeType.Black, new Coord(0, 0), new Coord(-10, 0), 0.2, 0.3); break; default: throw new NotSupportedException("Unknown JFET type."); } if (Part != null) Sym.DrawText(Part, new Coord(8, 20), Alignment.Far, Alignment.Near); Sym.DrawText(Name, new Point(8, -20), Alignment.Far, Alignment.Far); Sym.AddCircle(EdgeType.Black, new Coord(0, 0), 20); }
public override void LayoutSymbol(SymbolLayout Sym) { LayoutSymbol(Sym, p, g, k, () => Name, () => PartNumber); }
public override void LayoutSymbol(SymbolLayout Sym) { Sym.AddTerminal(common, new Coord(0, -20), new Coord(0, -12)); Sym.AddCircle(EdgeType.Black, new Coord(0, -12), 2); for (int i = 0; i < Throws.Length; ++i) { int x = (i - Throws.Length / 2) * 20 + (Throws.Length % 2 == 0 ? 10 : 0); Sym.AddTerminal(throws[i], new Coord(x, 20), new Coord(x, 12)); Sym.DrawEllipse(EdgeType.Black, new Coord(x - 2, 10), new Coord(x + 2, 14)); //Sym.DrawText(i.ToString(), new Coord(x, 12), Alignment.Near, Alignment.Near); if (i == Position) Sym.AddWire(new Coord(0, -12), new Coord(x, 12)); } Sym.DrawText(() => Group, new Coord(-2, -12), Alignment.Far, Alignment.Far); Sym.DrawText(() => Name, new Coord(2, -12), Alignment.Near, Alignment.Far); }
public override void LayoutSymbol(SymbolLayout Sym) { base.LayoutSymbol(Sym); Sym.AddWire(Anode, new Coord(0, 12)); Sym.AddWire(Cathode, new Coord(0, -12)); Sym.AddCircle(EdgeType.Black, new Coord(0, 12), 2); Sym.AddCircle(EdgeType.Black, new Coord(0, -12), 2); Sym.InBounds(new Coord(-10, 0), new Coord(10, 0)); if (closed) Sym.AddWire(new Coord(0, -12), new Coord(0, 12)); else Sym.AddWire(new Coord(0, -12), new Coord(-8, 10)); Sym.DrawText(() => Name, new Coord(2, 0), Alignment.Near, Alignment.Center); }