public PinObject(PinObject o) : base(o) { PinColor = o.PinColor; NetName = o.NetName; Number = o.Number; Location = o.Location; }
// 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))); }
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)); } }
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); }
public override void MoveHandler(RelativePoint p) { pin.Location = p; }
public override void MoveHandler(RelativePoint p) { wire.ActivePoint = p; }
public abstract void MoveHandler(RelativePoint p);
public PinObject(LayerEnum l) : base(l) { Location = new RelativePoint(); }
public RelativePoint(RelativePoint p) { X = p.X; Y = p.Y; }