コード例 #1
0
ファイル: Pmos.cs プロジェクト: hanyeah/SimpleCircuit
        /// <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));
            }
        }
コード例 #2
0
ファイル: FlipFlop.cs プロジェクト: hanyeah/SimpleCircuit
        /// <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));
            }
        }
コード例 #3
0
        /// <inheritdoc />
        protected override void Draw(SvgDrawing drawing)
        {
            drawing.Segments(new[]
            {
                new Vector2(-8, 0), new Vector2(-6, 0),
                new Vector2(6, 4), new Vector2(8, 4),
                new Vector2(6, -4), new Vector2(8, -4)
            });
            drawing.Circle(new Vector2(-5, 0), 1);
            drawing.Circle(new Vector2(5, 4), 1);
            drawing.Circle(new Vector2(5, -4), 1);

            if (Throw.IsZero())
            {
                drawing.Line(new Vector2(-4, 0), new Vector2(5, 0));
            }
            else if (Throw > 0)
            {
                drawing.Line(new Vector2(-4, 0), new Vector2(4, 4));
            }
            else
            {
                drawing.Line(new Vector2(-4, 0), new Vector2(4, -4));
            }

            if (Pins.IsUsed("c"))
            {
                drawing.Line(new Vector2(0, 2), new Vector2(0, 6));
            }
        }
コード例 #4
0
        /// <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));
            }
        }
コード例 #5
0
ファイル: Resistor.cs プロジェクト: hanyeah/SimpleCircuit
        /// <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));
            }
        }
コード例 #6
0
        /// <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.Circle(new Vector2(-5, 0), 1);
            drawing.Circle(new Vector2(5, 0), 1);

            if (Closed.IsZero())
            {
                drawing.Line(new Vector2(-4, 0), new Vector2(4, 0));
            }
            else
            {
                drawing.Line(new Vector2(-4, 0), new Vector2(4, 4));
            }

            if (Pins.IsUsed("c"))
            {
                if (Closed.IsZero())
                {
                    drawing.Line(new Vector2(0, 0), new Vector2(0, 6));
                }
                else
                {
                    drawing.Line(new Vector2(0, 2), new Vector2(0, 6));
                }
            }

            if (!string.IsNullOrWhiteSpace(Label))
            {
                drawing.Text(Label, new Vector2(0, -6), new Vector2(0, -1));
            }
        }