public void DrawPin(object dc, IStyle style, XPin pin) { double thickness = style.Thickness / Zoom; double half = thickness / 2.0; var pen = new Pen( new SolidColorBrush( Color.FromArgb( (byte)style.Stroke.A, (byte)style.Stroke.R, (byte)style.Stroke.G, (byte)style.Stroke.B)), thickness); pen.Freeze(); var brush = new SolidColorBrush( Color.FromArgb( (byte)style.Fill.A, (byte)style.Fill.R, (byte)style.Fill.G, (byte)style.Fill.B)); brush.Freeze(); (dc as DrawingContext).DrawEllipse( brush, pen, new Point(pin.X, pin.Y), PinRadius, PinRadius); }
private IPin ReadPin() { var pin = new XPin() { Id = _reader.ReadInt32(), Point = ReadPoint(), Shape = ReadNative(), }; _natives.Add(pin.Id, pin); return(pin); }
public static void FindDependencies( XPin next, XPin start, IDictionary <XPin, ICollection <Tuple <XPin, bool> > > connections, IDictionary <XPin, ICollection <Tuple <XPin, bool> > > dependencies) { var pinConnections = connections[next]; foreach (var connection in pinConnections) { if (connection.Item1 == start) { continue; } var pinDependencies = dependencies[start]; if (!pinDependencies.Contains(connection)) { switch (connection.Item1.PinType) { case PinType.None: pinDependencies.Add(connection); break; case PinType.Input: pinDependencies.Add(connection); break; case PinType.Output: pinDependencies.Add(connection); break; case PinType.Standalone: pinDependencies.Add(connection); FindDependencies(connection.Item1, start, connections, dependencies); break; } } } }
private IPin ReadPin() { var pin = new XPin() { Id = _reader.ReadInt32(), Point = ReadPoint(), Shape = ReadNative(), }; _natives.Add(pin.Id, pin); return pin; }
public IPin CreatePin() { var shape = new XEllipse() { Point1 = new XPoint(-4.0, -4.0), Point2 = new XPoint(4.0, 4.0), Stroke = new XColor(0x00, 0x00, 0x00, 0x00), StrokeThickness = 0.0, Fill = new XColor(0xFF, 0x00, 0x00, 0x00) }; var pin = new XPin() { Point = new XPoint(0.0, 0.0), Shape = shape, }; pin.Point.Connected.Add(pin); return pin; }