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=51e5b28f059dfd187793814451720266d5fda55d;hb=b88a07d43a65579473746edc85f5cd327b7d64b2;hp=96f1a3395e0415571b3ee9f89c7922ae77918fed;hpb=2877554535d73f173bc43729a222b441cb6f9897;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 96f1a339..51e5b28f 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,15 +3,20 @@ 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.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 fontHeight = 5; @@ -103,7 +108,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; @@ -117,8 +122,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