10 |
import org.nongnu.libvob.*; |
import org.nongnu.libvob.*; |
11 |
import org.nongnu.libvob.buoy.*; |
import org.nongnu.libvob.buoy.*; |
12 |
import org.nongnu.libvob.impl.DefaultVobMatcher; |
import org.nongnu.libvob.impl.DefaultVobMatcher; |
13 |
|
import org.nongnu.libvob.lava.placeable.Placeable; |
14 |
|
|
15 |
import java.util.Iterator; |
import java.util.Iterator; |
16 |
|
|
26 |
private Fen fen; |
private Fen fen; |
27 |
private View2D view2d; |
private View2D view2d; |
28 |
private BuoyViewNodeType nodeType; |
private BuoyViewNodeType nodeType; |
29 |
|
|
30 |
|
/** A node view used to determine the size of items |
31 |
|
* on the canvas, so that the appropriate rectangle to show |
32 |
|
* can be determined. |
33 |
|
*/ |
34 |
|
private NodeFunction nodeView; |
35 |
|
|
36 |
public PPConnector(Fen fen, View2D view2d, |
public PPConnector(Fen fen, View2D view2d, |
37 |
AbstractMainNode2D.Factory factory) { |
AbstractMainNode2D.Factory factory, |
38 |
|
NodeFunction nodeView) { |
39 |
this.fen = fen; |
this.fen = fen; |
40 |
this.view2d = view2d; |
this.view2d = view2d; |
41 |
this.nodeType = new NodeType2D(view2d, factory); |
this.nodeType = new NodeType2D(view2d, factory); |
42 |
|
this.nodeView = nodeView; |
43 |
} |
} |
44 |
|
|
45 |
public void addBuoys(VobScene vs, int parentCs, |
public void addBuoys(VobScene vs, int parentCs, |
85 |
} |
} |
86 |
} |
} |
87 |
|
|
88 |
public int dx = -100, dy = -200, w = 400, h = 400; |
public int dx = 30, dy = 30; |
89 |
protected java.awt.Rectangle getRect(Object node) { |
protected java.awt.Rectangle getRect(Object node) { |
90 |
if (node == null) throw new Error("Impossible!"); |
if (node == null) throw new Error("Impossible!"); |
91 |
int x = RDFUtil.getInt(fen, node, SPATIAL.coordX); |
int x = RDFUtil.getInt(fen, node, SPATIAL.coordX); |
92 |
int y = RDFUtil.getInt(fen, node, SPATIAL.coordY); |
int y = RDFUtil.getInt(fen, node, SPATIAL.coordY); |
93 |
return new java.awt.Rectangle(x+dx, y+dy, w, h); |
Placeable p = (Placeable)nodeView.f(fen.constgraph, node); |
94 |
|
return new java.awt.Rectangle(x-dx, y-dy, |
95 |
|
(int)p.getWidth()+dx+dx, |
96 |
|
(int)p.getHeight()+dy+dy); |
97 |
} |
} |
98 |
} |
} |