コード例 #1
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));
            }
        }
コード例 #2
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));
            }
        }
コード例 #3
0
ファイル: SignalGround.cs プロジェクト: hanyeah/SimpleCircuit
 /// <inheritdoc/>
 protected override void Draw(SvgDrawing drawing)
 {
     drawing.Line(new Vector2(0, 0), new Vector2(0, 3));
     drawing.Polygon(new[]
     {
         new Vector2(-5, 3), new Vector2(5, 3), new Vector2(0, 7)
     });
 }
コード例 #4
0
            private void DrawSignalGround(SvgDrawing drawing)
            {
                // Wires
                drawing.Line(new Vector2(0, 0), new Vector2(0, 3), new("wire"));

                // Ground
                drawing.Polygon(new[]
                {
                    new Vector2(-5, 3), new Vector2(5, 3), new Vector2(0, 7)
                });
            }
コード例 #5
0
        /// <inheritdoc/>
        protected override void Draw(SvgDrawing drawing)
        {
            drawing.Polygon(new[]
            {
                new Vector2(-6, 6), new Vector2(6, 0), new Vector2(-6, -6)
            });

            if (!string.IsNullOrEmpty(Label))
            {
                drawing.Text(Label, new Vector2(-2.5, 0), new Vector2(), 3, 0.5);
            }
        }
コード例 #6
0
            /// <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());
                }
            }
コード例 #7
0
            private void DrawADC(SvgDrawing drawing)
            {
                drawing.Polygon(new[]
                {
                    new Vector2(-Width / 2, Height / 2), new Vector2(Width / 2 - Height / 2, Height / 2),
                    new Vector2(Width / 2, 0), new Vector2(Width / 2 - Height / 2, -Height / 2),
                    new Vector2(-Width / 2, -Height / 2)
                });

                if (!string.IsNullOrWhiteSpace(Label))
                {
                    drawing.Text(Label, new Vector2(-Height / 4, 0), new Vector2(0, 0));
                }
            }
コード例 #8
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.Polygon(new[] { new Vector2(-6, 3), new Vector2(6, 3), new Vector2(6, -3), new Vector2(-6, -3) });

            // 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));
            }
        }
コード例 #9
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));
     }
 }
コード例 #10
0
            private void DrawMultiplexer(SvgDrawing drawing)
            {
                drawing.Polygon(new[] {
                    new Vector2(-5, -8),
                    new Vector2(5, -4),
                    new Vector2(5, 4),
                    new Vector2(-5, 8)
                });

                drawing.Text("1", new Vector2(-4, -4), new Vector2(1, 0), new("small"));
                drawing.Text("0", new Vector2(-4, 4), new Vector2(1, 0), new("small"));
                if (!string.IsNullOrWhiteSpace(Label))
                {
                    drawing.Text(Label, new Vector2(5, 5), new Vector2(1, 1));
                }
            }
コード例 #11
0
ファイル: Multiplexer.cs プロジェクト: hanyeah/SimpleCircuit
        /// <inheritdoc/>
        protected override void Draw(SvgDrawing drawing)
        {
            drawing.Polygon(new[] {
                new Vector2(-5, -8),
                new Vector2(5, -4),
                new Vector2(5, 4),
                new Vector2(-5, 8)
            });

            drawing.Text("1", new Vector2(-4, -4), new Vector2(1, 0), 3, 0.5);
            drawing.Text("0", new Vector2(-4, 4), new Vector2(1, 0), 3, 0.5);
            if (!string.IsNullOrWhiteSpace(Label))
            {
                drawing.Text(Label, new Vector2(5, 5), new Vector2(1, 1));
            }
        }
コード例 #12
0
            /// <inheritdoc />
            public void Render(SvgDrawing drawing)
            {
                var go = new GraphicOptions(GetType().Name.ToLower())
                {
                    Id = Name
                };

                go.Classes.Add("blackbox");
                drawing.StartGroup(go);
                drawing.Polygon(new[]
                {
                    Location, new Vector2(EndLocation.X, Location.Y),
                    EndLocation, new Vector2(Location.X, EndLocation.Y)
                });

                // Draw the port names
                _pins.Render(drawing);
                drawing.EndGroup();
            }
コード例 #13
0
        /// <inheritdoc/>
        protected override void Draw(SvgDrawing drawing)
        {
            drawing.Polygon(new[] {
                new Vector2(-5, -8),
                new Vector2(5, -4),
                new Vector2(5, 4),
                new Vector2(-5, 8)
            });
            drawing.Segments(new[]
            {
                new Vector2(-3, -4), new Vector2(-1, -4),
                new Vector2(-2, 5), new Vector2(-2, 3),
                new Vector2(-3, 4), new Vector2(-1, 4)
            });

            if (!string.IsNullOrWhiteSpace(Label))
            {
                drawing.Text(Label, new Vector2(5, 5), new Vector2(1, 1));
            }
        }
コード例 #14
0
ファイル: Diode.cs プロジェクト: hanyeah/SimpleCircuit
        /// <inheritdoc />
        protected override void Draw(SvgDrawing drawing)
        {
            drawing.Segments(new[]
            {
                new Vector2(-6, 0), new Vector2(-4, 0),
                new Vector2(4, -4), new Vector2(4, 4),
                new Vector2(4, 0), new Vector2(6, 0)
            });
            drawing.Polygon(new[] {
                new Vector2(-4, -4),
                new Vector2(4, 0),
                new Vector2(-4, 4),
                new Vector2(-4, 4)
            });

            if (!string.IsNullOrWhiteSpace(Label))
            {
                drawing.Text(Label, new Vector2(0, -6), new Vector2(0, -1));
            }
        }
コード例 #15
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));
     }
 }