public void Draw(Cairo.Context cr, List <Subnet> Subnets) { foreach (var bundle in Subnets) { WireArray(cr, bundle.Wires); foreach (var connection in FindConnectionPoints(bundle.Wires, ConnectionPoints)) { double x = connection.X * CircuitEditor.DotSpacing; double y = connection.Y * CircuitEditor.DotSpacing; cr.Arc(x, y, ConnectionRadius, 0, Math.PI * 2); cr.ClosePath(); //cr.MoveTo(x, y); //cr.ShowText(bundle.ID.ToString()); } // Get the value of the subnet if there is one. // FIXME: We shouldn't have to check that there is one... Value value = Value.Floating; if (bundle.ID != 0) { var state = LogLogic.SubnetState(Program.Backend, bundle.ID); value = state switch { ValueState.Floating => Value.Floating, ValueState.Zero => Value.Zero, ValueState.One => Value.One, ValueState.Error => Value.Error, _ => throw new InvalidOperationException($"We got an unknown subnet state from the backend! State: {state}"), }; } cr.SetSourceColor(GetValueColor(value)); cr.Fill(); } }