Ejemplo n.º 1
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));
            }
        }
Ejemplo n.º 2
0
 /// <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));
     }
 }
Ejemplo n.º 3
0
        /// <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));
            }
        }
Ejemplo n.º 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));
            }
        }
Ejemplo n.º 5
0
        /// <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));
            }
        }
Ejemplo n.º 6
0
 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));
     }
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Renders the wire.
        /// </summary>
        /// <param name="drawn">The drawn wires.</param>
        /// <param name="drawing">The drawing.</param>
        public void Render(ISet <Wire> drawn, SvgDrawing drawing)
        {
            var index = drawn.Count + 1;

            drawing.Polyline(_points.Select(p => new Vector2(p.X.Value, p.Y.Value)), "wire", $"W{index}");
        }