Fixed WireCrossPoints disappearing near edges
[Mograsim.git] / net.mograsim.logic.ui / src / net / mograsim / logic / ui / model / components / mi / nandbased / GUInand3.java
1 package net.mograsim.logic.ui.model.components.mi.nandbased;
2
3 import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
4 import net.mograsim.logic.ui.model.ViewModelModifiable;
5 import net.mograsim.logic.ui.model.components.GUINandGate;
6 import net.mograsim.logic.ui.model.components.SimpleRectangularSubmodelComponent;
7 import net.mograsim.logic.ui.model.wires.GUIWire;
8 import net.mograsim.logic.ui.model.wires.Pin;
9 import net.mograsim.logic.ui.model.wires.WireCrossPoint;
10
11 public class GUInand3 extends SimpleRectangularSubmodelComponent
12 {
13         public GUInand3(ViewModelModifiable model)
14         {
15                 super(model, 1, "GUInand3");
16                 setSubmodelScale(.4);
17                 setInputCount(3);
18                 setOutputCount(1);
19                 initSubmodelComponents();
20         }
21
22         @SuppressWarnings("unused") // for GUIWires being created
23         private void initSubmodelComponents()
24         {
25                 Pin A = getInputSubmodelPins().get(0);
26                 Pin B = getInputSubmodelPins().get(1);
27                 Pin C = getInputSubmodelPins().get(2);
28                 Pin Y = getOutputSubmodelPins().get(0);
29
30                 GUINandGate nandAB = new GUINandGate(submodelModifiable, 1);
31                 GUINandGate andAB = new GUINandGate(submodelModifiable, 1);
32                 GUINandGate nandABC = new GUINandGate(submodelModifiable, 1);
33
34                 WireCrossPoint cpNandAB = new WireCrossPoint(submodelModifiable, 1);
35
36                 nandAB.moveTo(10, 15);
37                 andAB.moveTo(35, 15);
38                 nandABC.moveTo(62.5, 2.5);
39                 cpNandAB.moveCenterTo(32.5, 25);
40
41                 new GUIWire(submodelModifiable, A, nandAB.getInputPins().get(0));
42                 new GUIWire(submodelModifiable, B, nandAB.getInputPins().get(1));
43                 new GUIWire(submodelModifiable, nandAB.getOutputPin(), cpNandAB, new Point[0]);
44                 new GUIWire(submodelModifiable, cpNandAB, andAB.getInputPins().get(0), new Point(32.5, 20));
45                 new GUIWire(submodelModifiable, cpNandAB, andAB.getInputPins().get(1), new Point(32.5, 30));
46                 new GUIWire(submodelModifiable, andAB.getOutputPin(), nandABC.getInputPins().get(0), new Point(57.5, 25), new Point(57.5, 7.5));
47                 new GUIWire(submodelModifiable, C, nandABC.getInputPins().get(1), new Point(60, 62.5), new Point(60, 17.5));
48                 new GUIWire(submodelModifiable, nandABC.getOutputPin(), Y, new Point[0]);
49         }
50 }