/* SimpleConnection.java * * Copyright 2002, Benja Fallenstein * Portions Copyright (c) 2001, Tuomas Lukka * * This file is part of Gzz. * * Gzz is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Gzz 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 GNU Lesser General * Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with Gzz; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * * */ /* * Written by Benja Fallenstein */ package org.nongnu.libvob.vobs; import org.nongnu.libvob.*; import org.nongnu.libvob.gl.*; import java.awt.*; /** A plain line drawn between two coordinate sets. */ public class SimpleConnection extends Vob { public static final String rcsid = "$Id: SimpleConnection.java,v 1.1 2003/03/16 16:01:13 benja Exp $"; float x0, y0, x1, y1; Color color; Point pt0, pt1; /** * @param x0, y0 Coordinate inside first coord system * @param x1, y1 Coordinate inside second coord system */ public SimpleConnection(float x0, float y0, float x1, float y1) { this(x0, y0, x1, y1, null); } /** * @param x0, y0 Coordinate inside first coord system * @param x1, y1 Coordinate inside second coord system */ public SimpleConnection(float x0, float y0, float x1, float y1, Color color) { super(); this.x0 = x0; this.y0 = y0; this.x1 = x1; this.y1 = y1; this.color = color; this.pt0 = new Point(); this.pt1 = new Point(); } public void render(Graphics g, boolean fast, Vob.RenderInfo info1, Vob.RenderInfo info2) { if(fast) return; if(color != null) g.setColor(color); info1.xform(x0, y0, pt0); info2.xform(x1, y1, pt1); g.drawLine(pt0.x, pt0.y, pt1.x, pt1.y); } Vob line; public int putGL(VobScene vs, int coordsys1, int coordsys2) { throw new Error("SimpleConnection doesn't work in GL yet"); /** if(line == null && color != null) line = GLRen.createLineConnector(x0, y0, x1, y1, 1, 1, color.getRed()/255f, color.getGreen()/255f, color.getBlue()/255f, 1); else line = GLRen.createLineConnector(x0, y0, x1, y1, 1, 1, -1, -1, -1, -1); vs.map.put(line, coordsys1, coordsys2); return 0; **/ } }