/* SimpleConnection.java * * Copyright 2002, Benja Fallenstein * Portions Copyright (c) 2001, Tuomas Lukka * * You may use and distribute under the terms of either the GNU Lesser * General Public License, either version 2 of the license or, * at your choice, any later version. Alternatively, you may use and * distribute under the terms of the XPL. * * See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of * the licenses. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the README * file for more details. * */ /* * Written by Benja Fallenstein */ package gzz.vob.vobs; import gzz.vob.*; import java.awt.*; /** A "T" decoration indicating a connection that isn't shown. */ public class TDecor extends Vob { public static final String rcsid = "$Id: TDecor.java,v 1.1 2002/11/02 01:23:46 benja Exp $"; Color color; boolean horizontal; int dir; static Point pt = new Point(); /** * @param x0, y0 Coordinate inside first coord system * @param x1, y1 Coordinate inside second coord system */ public TDecor(boolean horizontal, int dir) { this(horizontal, dir, null); } /** * @param x0, y0 Coordinate inside first coord system * @param x1, y1 Coordinate inside second coord system */ public TDecor(boolean horizontal, int dir, Color color) { super(); this.horizontal = horizontal; this.dir = dir; this.color = color; } public void render(Graphics g, boolean fast, Vob.RenderInfo info1, Vob.RenderInfo info2) { if(fast) return; if(color != null) g.setColor(color); else g.setColor(info1.getMixedFgColor()); int x = horizontal ? dir : 0; int y = horizontal ? 0 : dir; info1.xform(x, y, pt); x = pt.x; y = pt.y; int len = dir * 5; if(horizontal) { g.drawLine(x, y, x+len, y); g.drawLine(x+len, y-len, x+len, y+len); } else { g.drawLine(x, y, x, y+len); g.drawLine(x-len, y+len, x+len, y+len); } } }