From ad6c95d7f8a7285f77c7133946f65d4a9ec3c9a9 Mon Sep 17 00:00:00 2001 From: adam Date: Thu, 19 Apr 2007 05:42:15 +0100 Subject: [PATCH] checkpoint --- src/edu/berkeley/slipway/gui/GuiCell.java | 51 +++++++++++++++-------------- src/edu/berkeley/slipway/gui/GuiGate.java | 10 +++--- 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/src/edu/berkeley/slipway/gui/GuiCell.java b/src/edu/berkeley/slipway/gui/GuiCell.java index 7f31383..c4273f9 100644 --- a/src/edu/berkeley/slipway/gui/GuiCell.java +++ b/src/edu/berkeley/slipway/gui/GuiCell.java @@ -11,7 +11,8 @@ public class GuiCell { public static final int LOCAL_WIRE_COLOR = 0x000FF000; public static final int XGATE_COLOR = 0x00800000; public static final int YGATE_COLOR = 0x00000080; - double MAIN_AREA = 0.75; + + private static final int LOCAL_ROUTING_CHANNEL_WIDTH = 7; private final Fpslic.Cell fpslicCell; private GuiGate xgate = new GuiGate(); @@ -49,44 +50,46 @@ public class GuiCell { } private void drawBody(G g, R r) { - if (xgate == null && ygate == null) return; - - int N = 7; - int TSIZE = 10; - double TSQR = TSIZE / Math.sqrt(2.0); + if (xgate.disabled && ygate.disabled) return; - R body = r; - g.color(BODY_COLOR); + R gateArea = + xgate.gateArea = + ygate.gateArea = + r.plus(12+LOCAL_ROUTING_CHANNEL_WIDTH, + 12+LOCAL_ROUTING_CHANNEL_WIDTH, + -(4+LOCAL_ROUTING_CHANNEL_WIDTH), + -(4+LOCAL_ROUTING_CHANNEL_WIDTH)); - R gateArea = body.plus(12+N, 12+N, -(4+N), -(4+N)); double factor = gateArea.width()/2; - R ygater = xgate.disabled || ygate.disabled ? gateArea : gateArea.plus(0, 0, -factor, -factor); - R xgater = xgate.disabled || ygate.disabled ? gateArea : gateArea.plus(factor, 0, 0, -factor); + xgate.r = xgate.disabled || ygate.disabled ? gateArea : gateArea.plus(factor, 0, 0, -factor); + ygate.r = xgate.disabled || ygate.disabled ? gateArea : gateArea.plus(0, 0, -factor, -factor); + P xip = r.corner(fpslicCell.xi()); + P yip = r.corner(fpslicCell.yi()); R xring = gateArea.plus(-4, -4, 4, 4); R yring = gateArea.plus(-6, -6, 6, 6); - P xip = r.corner(fpslicCell.xi()); - P yip = r.corner(fpslicCell.yi()); - xgate.rotation(fpslicCell.yi()); - xgate.gateArea = gateArea; - xgate.r = xgater; + ygate.rotation(fpslicCell.yi()); if (xip != null) xgate.route(g, xip, xring, 0, XGATE_COLOR); if (yip != null) xgate.route(g, yip, yring, 2, YGATE_COLOR); - - ygate.rotation(fpslicCell.yi()); - ygate.gateArea = gateArea; - ygate.r = ygater; if (xip != null) ygate.route(g, xip, xring, 2, XGATE_COLOR); if (yip != null) ygate.route(g, yip, yring, 0, YGATE_COLOR); + drawWin(g, r); + drawGates(g); + } + + private void drawWin(G g, R r) { int layer = fpslicCell.wi() - L0; - P p2 = r.corner(SW).translate(2*(layer+1), 2*(layer+1)); - R r2 = r.plus(2*(layer+1), 2*(layer+1), -2*(layer+1), -2*(layer+1)); - ygate.route(g, p2, r2, 1, LOCAL_WIRE_COLOR); - xgate.route(g, p2, r2, 1, LOCAL_WIRE_COLOR); + P wip = r.corner(SW).translate(2*(layer+1), 2*(layer+1)); + R wring = r.plus(2*(layer+1), 2*(layer+1), -2*(layer+1), -2*(layer+1)); + ygate.route(g, wip, wring, 1, LOCAL_WIRE_COLOR); + xgate.route(g, wip, wring, 1, LOCAL_WIRE_COLOR); + } + private void drawGates(G g) { xgate.draw(g, XGATE_COLOR); ygate.draw(g, YGATE_COLOR); } + } \ No newline at end of file diff --git a/src/edu/berkeley/slipway/gui/GuiGate.java b/src/edu/berkeley/slipway/gui/GuiGate.java index f2932cd..b12366c 100644 --- a/src/edu/berkeley/slipway/gui/GuiGate.java +++ b/src/edu/berkeley/slipway/gui/GuiGate.java @@ -11,6 +11,11 @@ public class GuiGate { private GeneralPath gp = new GeneralPath(); + int rotation = 1; + R gateArea; + R r; + boolean disabled = false; + public GuiGate() { gp.moveTo(29.141f, 36.301f); gp.lineTo(29.141f, 36.301f-7.161f); @@ -31,11 +36,6 @@ public class GuiGate { gp.transform(AffineTransform.getScaleInstance(1.0/factor, -1.0/factor)); } - int rotation = 1; - R gateArea; - R r; - boolean disabled = false; - public void draw(G g, int color) { if (disabled) return; g.pushTransform(); -- 1.7.10.4