General SubmodelComponents can now be saved to a json format
[Mograsim.git] / net.mograsim.logic.ui / src / net / mograsim / logic / ui / model / components / SimpleRectangularSubmodelComponent.java
index 89a55f0..3373553 100644 (file)
@@ -9,6 +9,7 @@ import net.haspamelodica.swt.helper.swtobjectwrappers.Font;
 import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
 import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;
 import net.mograsim.logic.ui.model.ViewModelModifiable;
+import net.mograsim.logic.ui.model.components.params.RectComponentParams;
 import net.mograsim.logic.ui.model.wires.Pin;
 
 public class SimpleRectangularSubmodelComponent extends SubmodelComponent
@@ -122,4 +123,15 @@ public class SimpleRectangularSubmodelComponent extends SubmodelComponent
        {
                gc.drawRectangle(getBounds());
        }
+
+       public RectComponentParams calculateRectParams()
+       {
+               RectComponentParams params = new RectComponentParams();
+               params.displayName = label;
+               params.inputCount = inputSupermodelPins.size();
+               params.outputCount = outputSubmodelPins.size();
+               params.logicWidth = logicWidth;
+               params.composition = calculateCompositionParams();
+               return params;
+       }
 }
\ No newline at end of file