public WireObject(WireObject w) : base(w) { type = ObjectType.LINE; WireColor = w.WireColor; NetName = w.NetName; WirePoints = new List <RelativePoint>(w.WirePoints); }
public override AbstractObject ResetAndGetObject() { // return this wire and create a new var tmp = wire; wire = new WireObject(ActiveLayer); if (!(tmp is null)) { wire.ShowActivePoint = tmp.ShowActivePoint; tmp.ShowActivePoint = false; } return(tmp); }
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); }