X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.ui%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2Fmodel%2Fcomponents%2FSimpleRectangularSubmodelComponent.java;h=da8bd4855d13ab14c5fb4408a451cda214330857;hb=82cc1d386820c179be331790fa3c1fae22bada76;hp=e2af6f1a0819b1b225a7456e233718a81a01d3dc;hpb=c1a8e2103a1a79039163ad2e414c0650f8cee3ea;p=Mograsim.git diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/SimpleRectangularSubmodelComponent.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/SimpleRectangularSubmodelComponent.java index e2af6f1a..da8bd485 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/SimpleRectangularSubmodelComponent.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/SimpleRectangularSubmodelComponent.java @@ -3,18 +3,23 @@ package net.mograsim.logic.ui.model.components; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Map; +import java.util.TreeMap; import net.haspamelodica.swt.helper.gcs.GeneralGC; 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.SubmodelComponentParams; import net.mograsim.logic.ui.model.wires.Pin; public class SimpleRectangularSubmodelComponent extends SubmodelComponent { + public static String kLabel = "label", kInCount = "input_count", kOutCount = "output_count", kLogicWidth = "logic_width"; + private static final double width = 35; private static final double pinDistance = 10; - private static final double minHeight = 25; private static final double fontHeight = 5; private final String label; @@ -104,7 +109,7 @@ public class SimpleRectangularSubmodelComponent extends SubmodelComponent } @Override - protected void renderSymbol(GeneralGC gc) + protected void renderSymbol(GeneralGC gc, Rectangle visibleRegion) { double posX = getBounds().x; double posY = getBounds().y; @@ -118,8 +123,22 @@ public class SimpleRectangularSubmodelComponent extends SubmodelComponent } @Override - protected void renderOutline(GeneralGC gc) + protected void renderOutline(GeneralGC gc, Rectangle visibleRegion) { gc.drawRectangle(getBounds()); } + + @Override + public SubmodelComponentParams calculateParams() + { + SubmodelComponentParams ret = super.calculateParams(); + ret.type = SimpleRectangularSubmodelComponent.class.getSimpleName(); + Map m = new TreeMap<>(); + m.put(kLabel, label); + m.put(kInCount, inputSupermodelPins.size()); + m.put(kOutCount, outputSupermodelPins.size()); + m.put(kLogicWidth, logicWidth); + ret.specialized = m; + return ret; + } } \ No newline at end of file