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