public void Draw(Context cr) { // FIXME: Make this a static method and do the subnet loop here instead. Wires.Draw(cr, Subnets); Gates.Draw(cr); Labels.Draw(cr); // Draw the subnet id next to all connections (this is for debug) foreach (var net in Subnets) { foreach (var(comp, port) in net.ComponentPorts) { Span <Vector2i> ports = stackalloc Vector2i[Gates.GetNumberOfPorts(comp)]; Gates.GetTransformedPorts(comp, ports); cr.MoveTo(ports[port] * CircuitEditor.DotSpacing); cr.ShowText(net.ID.ToString()); } } /* * foreach (var instance in Gates.Instances) * { * var bounds = Gates.GetBounds(instance); * bounds = bounds.Rotate(instance.Position * CircuitEditor.DotSpacing, instance.Orientation); * cr.Rectangle(bounds); * } * cr.SetSourceRGB(0.2, 0.2, 0.2); * cr.Stroke(); */ }
public void Draw(Context cr) { // FIXME: Make this a static method and do the subnet loop here instead. Wires.Draw(cr, Subnets); Gates.Draw(cr); Labels.Draw(cr); // Draw the subnet id next to all connections (this is for debug) foreach (var net in Subnets) { foreach (var(comp, port) in net.ComponentPorts) { Span <Vector2i> ports = stackalloc Vector2i[Gates.GetNumberOfPorts(comp)]; Gates.GetTransformedPorts(comp, ports); cr.MoveTo(ports[port] * CircuitEditor.DotSpacing); cr.ShowText(net.ID.ToString()); } } }