//(c): Tuomas J. Lukka and Matti J. Katila package org.fenfire.view; import org.fenfire.modules.pp.*; import org.fenfire.*; import org.fenfire.view.*; import org.fenfire.view.buoy.*; import org.fenfire.vocab.*; import org.fenfire.swamp.*; import org.fenfire.util.*; import org.nongnu.libvob.*; import org.nongnu.libvob.gl.*; import org.nongnu.libvob.impl.gl.*; import org.nongnu.libvob.buoy.*; import org.nongnu.libvob.lava.placeable.Placeable; import org.nongnu.alph.*; import java.util.Iterator; /** A View2D on a PP-like canvas. */ public class CanvasView2D { public static final String rcsid = "$Id: CanvasView2D.java,v 1.1 2003/04/24 19:55:36 benja Exp $"; public static boolean dbg = false; private static void p(String s) { if (dbg) pa(s); } private static void pa(String s) { System.out.println("SpatialPlane::"+s); } private Fen fen; private Object cType; private Object cont; private NodeFunction nodeView; public CanvasView2D(Fen fen, Object containment, NodeFunction nodeView) { this.fen = fen; cont = containment; this.nodeView = nodeView; } public void render(VobScene vs, Object container, int matchingParent, int box2screen, int box2plane) { int paper2box = vs.coords.invert(box2plane); int paper2screen = vs.coords.concat(paper2box, box2screen); Iterator iter = fen.constgraph.findN_11X_Iter(container, cont); while (iter.hasNext()) { Object n = iter.next(); // get coords int x = RDFUtil.getInt(fen, n, SPATIAL.coordX); int y = RDFUtil.getInt(fen, n, SPATIAL.coordY); Placeable p = (Placeable)nodeView.f(fen.constgraph, n); Pair matchKey = new Pair(container, n); int cs = vs.coords.translate(paper2screen, x, y); vs.matcher.add(matchingParent, cs, matchKey); p.place(vs, cs); } } }