예제 #1
0
 public PinObject(PinObject o) : base(o)
 {
     PinColor = o.PinColor;
     NetName  = o.NetName;
     Number   = o.Number;
     Location = o.Location;
 }
예제 #2
0
        // Get panel coordinates from relative coordinates (transform)
        public Point RelativeToPanel(RelativePoint p)
        {
            var x = p.X * img.Width * ImageScale * 0.5 + Size.Width / 2.0;
            var y = p.Y * img.Height * ImageScale * 0.5 + Size.Height / 2.0;

            return(new Point(ImageClipper.dtoi(x), ImageClipper.dtoi(y)));
        }
예제 #3
0
        private void DrawLine(RelativePoint p1, RelativePoint p2, PanelTransform tform, Graphics g, bool selected)
        {
            if (selected)
            {
                using (var p = new Pen(Color.FromArgb(180, WireColor), 8))
                {
                    g.DrawLine(p, tform(p1), tform(p2));
                }
            }

            using (var p = new Pen(WireColor, 4))
            {
                g.DrawLine(p, tform(p1), tform(p2));
            }
        }
예제 #4
0
        public static AbstractObject ImportObject(string descriptor)
        {
            var strarr = descriptor.Split(' ');

            if (strarr.Length > 0)
            {
                if (strarr[0] == "WIRE")
                {
                    // Format: WIRE L{layer} '{netname}' #{color} {point1} [{point2}] ...
                    var l   = (LayerEnum)Enum.Parse(typeof(LayerEnum), strarr[1].Substring(1));
                    var ret = new WireObject(l);

                    ret.NetName   = strarr[2].Substring(1, strarr[2].Length - 2);
                    ret.WireColor = Color.FromArgb(int.Parse(strarr[3].Substring(1), NumberStyles.HexNumber));

                    for (int i = 4; i < strarr.Length; i++)
                    {
                        var p = new RelativePoint(strarr[i]);
                        ret.WirePoints.Add(p);
                    }

                    return(ret);
                }
                else if (strarr[0] == "PIN")
                {
                    // Format: PIN L{layer} {component}:{number} '{netname}' #{color} {location}
                    var l   = (LayerEnum)Enum.Parse(typeof(LayerEnum), strarr[1].Substring(1));
                    var ret = new PinObject(l);

                    var properties = strarr[2].Split(':');
                    ret.Component = properties[0];
                    ret.Number    = properties[1];

                    ret.NetName  = strarr[3].Substring(1, strarr[3].Length - 2);
                    ret.PinColor = Color.FromArgb(int.Parse(strarr[4].Substring(1), NumberStyles.HexNumber));
                    ret.Location = new RelativePoint(strarr[5]);

                    return(ret);
                }
            }
            return(null);
        }
예제 #5
0
 public override void MoveHandler(RelativePoint p)
 {
     pin.Location = p;
 }
예제 #6
0
 public override void MoveHandler(RelativePoint p)
 {
     wire.ActivePoint = p;
 }
예제 #7
0
 public abstract void MoveHandler(RelativePoint p);
예제 #8
0
 public PinObject(LayerEnum l) : base(l)
 {
     Location = new RelativePoint();
 }
예제 #9
0
 public RelativePoint(RelativePoint p)
 {
     X = p.X;
     Y = p.Y;
 }