Beispiel #1
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));
            }
        }
Beispiel #2
0
        /// <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 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));
     }
 }
Beispiel #4
0
 /// <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));
     }
 }
Beispiel #5
0
 /// <inheritdoc />
 protected override void Draw(SvgDrawing drawing)
 {
     drawing.ClosedBezier(new[]
     {
         new Vector2(-6, 5),
         new Vector2(-6, 5), new Vector2(1, 5), new Vector2(1, 5),
         new Vector2(4, 5), new Vector2(6, 2), new Vector2(6, 0),
         new Vector2(6, -2), new Vector2(4, -5), new Vector2(1, -5),
         new Vector2(1, -5), new Vector2(-6, -5), new Vector2(-6, -5)
     });
     drawing.Circle(new Vector2(7.5, 0), 1.5);
 }
Beispiel #6
0
 /// <inheritdoc />
 private void DrawNand(SvgDrawing drawing)
 {
     drawing.ClosedBezier(new[]
     {
         new Vector2(-6, 5),
         new Vector2(-6, 5), new Vector2(1, 5), new Vector2(1, 5),
         new Vector2(4, 5), new Vector2(6, 2), new Vector2(6, 0),
         new Vector2(6, -2), new Vector2(4, -5), new Vector2(1, -5),
         new Vector2(1, -5), new Vector2(-6, -5), new Vector2(-6, -5)
     });
     drawing.Circle(new Vector2(7.5, 0), 1.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());
                }
            }
Beispiel #8
0
 private void DrawNor(SvgDrawing drawing)
 {
     drawing.ClosedBezier(new[]
     {
         new Vector2(-5, 5),
         new Vector2(-5, 5), new Vector2(-4, 5), new Vector2(-4, 5),
         new Vector2(1, 5), new Vector2(4, 3), new Vector2(6, 0),
         new Vector2(4, -3), new Vector2(1, -5), new Vector2(-4, -5),
         new Vector2(-4, -5), new Vector2(-3, -5), new Vector2(-5, -5),
         new Vector2(-3, -2), new Vector2(-3, 2), new Vector2(-5, 5)
     });
     drawing.Circle(new Vector2(7.5, 0), 1.5);
 }
Beispiel #9
0
            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);
                }
            }
Beispiel #10
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));
            }
        }
Beispiel #11
0
        /// <inheritdoc/>
        protected override void Draw(SvgDrawing drawing)
        {
            drawing.Circle(new Vector2(0, 0), 6);
            drawing.Segments(new[]
            {
                new Vector2(-8, 0), new Vector2(-6, 0),
                new Vector2(-3, -1), new Vector2(-3, 1),
                new Vector2(3, -1), new Vector2(3, 1),
                new Vector2(2, 0), new Vector2(4, 0),
                new Vector2(6, 0), new Vector2(8, 0)
            });

            // Depending on the orientation, let's anchor the text differently
            if (!string.IsNullOrWhiteSpace(Label))
            {
                drawing.Text(Label, new Vector2(0, -8), new Vector2(0, -1));
            }
        }
Beispiel #12
0
 private void DrawCasing(SvgDrawing drawing)
 {
     drawing.Circle(new Vector2(), 4);
 }