26 |
*/ |
*/ |
27 |
package org.fenfire.view.buoy; |
package org.fenfire.view.buoy; |
28 |
import org.fenfire.view.View2D; |
import org.fenfire.view.View2D; |
29 |
|
import org.fenfire.view.CanvasView2D; |
30 |
import org.fenfire.view.NodedView2D; |
import org.fenfire.view.NodedView2D; |
31 |
import org.fenfire.util.Pair; |
import org.fenfire.util.Pair; |
32 |
import org.fenfire.util.Triple; |
import org.fenfire.util.Triple; |
43 |
*/ |
*/ |
44 |
public class NodeType2D extends AbstractNodeType2D { |
public class NodeType2D extends AbstractNodeType2D { |
45 |
public static boolean dbg = false; |
public static boolean dbg = false; |
46 |
private static void pa(String s) { System.out.println("NodeType2D:: "+s); } |
private static void p(String s) { System.out.println("NodeType2D:: "+s); } |
47 |
|
|
48 |
public static int effigy = 0; |
public static int effigy = 0; |
49 |
|
|
62 |
|
|
63 |
public int renderBuoy(VobScene vs, int into, Object linkId, |
public int renderBuoy(VobScene vs, int into, Object linkId, |
64 |
Object a, Object cachedSize) { |
Object a, Object cachedSize) { |
65 |
if (dbg) pa("start renderBuoy"); |
if (dbg) p("start renderBuoy"); |
66 |
if(effigy != 0) { |
if(effigy != 0) { |
67 |
Vob eff = org.nongnu.libvob.gl.GLRen.createQuad(effigy-1, 0,0); |
Vob eff = org.nongnu.libvob.gl.GLRen.createQuad(effigy-1, 0,0); |
68 |
vs.map.put( eff, into); |
vs.map.put( eff, into); |
73 |
float[] tmp = new float[2]; |
float[] tmp = new float[2]; |
74 |
vs.coords.getSqSize(into, tmp); |
vs.coords.getSqSize(into, tmp); |
75 |
float w = tmp[0], h = tmp[1]; |
float w = tmp[0], h = tmp[1]; |
76 |
if (dbg) pa("rect "+anchor+" coords "+w+","+h); |
if (dbg) p("rect "+anchor+" coords "+w+","+h); |
77 |
|
|
78 |
float scale = w / anchor.w; |
float scale = w / anchor.w; |
79 |
if(scale < h / anchor.h) scale = h / anchor.h; |
if(scale < h / anchor.h) scale = h / anchor.h; |
88 |
|
|
89 |
view2d.render(vs, anchor.plane, into, into, box2paper); |
view2d.render(vs, anchor.plane, into, into, box2paper); |
90 |
|
|
91 |
if (dbg) pa("start renderBuoy..DONE"); |
if (dbg) p("start renderBuoy..DONE"); |
92 |
|
|
93 |
// anchor.node may be null if this |
// anchor.node may be null if this |
94 |
// is not a noded View2D |
// is not a noded View2D |
95 |
|
|
96 |
int box = anchor.node==null |
int box = into; |
97 |
? into |
if (anchor.node != null ) { |
98 |
: vs.matcher.getCS(into, |
int containerCS = CanvasView2D.getContainerCS(vs, into); |
99 |
new Pair(anchor.plane, anchor.node)); |
box = vs.matcher.getCS(containerCS, anchor.node); |
100 |
|
if (dbg) p("box is: "+box); |
101 |
|
} |
102 |
|
if (box < 0) { |
103 |
|
box = into; |
104 |
|
throw new Error("Heyhey boys!! this doesn't work!"); |
105 |
|
} |
106 |
return vs.coords.unitSq(box); |
return vs.coords.unitSq(box); |
107 |
} |
} |
108 |
} |
} |