Beispiel #1
0
 public PinObject(PinObject o) : base(o)
 {
     PinColor = o.PinColor;
     NetName  = o.NetName;
     Number   = o.Number;
     Location = o.Location;
 }
Beispiel #2
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);
        }
Beispiel #3
0
 public PinTool(int layer = 0, bool mouseover = false) : base(layer)
 {
     pin  = new PinObject(ActiveLayer);
     show = mouseover;
 }