X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fslipway%2Fgui%2FGuiCell.java;h=283c9d42297165f2fcde2e45d2f4000152f3c513;hb=ef1ceb0816c8c8a661db6809dc629ceac764ad13;hp=7f313839f4cc4dde71696be90d8e5eb2dd481ad9;hpb=ba88e67948af47f28adea83cfd9394cf41a68abb;p=slipway.git diff --git a/src/edu/berkeley/slipway/gui/GuiCell.java b/src/edu/berkeley/slipway/gui/GuiCell.java index 7f31383..283c9d4 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(); @@ -41,52 +42,54 @@ public class GuiCell { private void drawGlobalRouting(G g, R r) { g.color(GLOBAL_WIRE_COLOR); for(int i=1; i<6; i++) { - g.line(r.minx() + 2*i, r.miny(), - r.minx() + 2*i, r.maxy()); - g.line(r.minx(), r.miny() + 2*i, - r.maxx(), r.miny() + 2*i); + g.line(r.corner(SW).translate(2*i,0), + r.corner(NW).translate(2*i,0)); + g.line(r.corner(SW).translate(0,2*i), + r.corner(SE).translate(0,2*i)); } } 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