42 |
public class PPConnector implements BuoyViewConnector { |
public class PPConnector implements BuoyViewConnector { |
43 |
public static final String rcsid = "$Id$"; |
public static final String rcsid = "$Id$"; |
44 |
public static boolean dbg = false; |
public static boolean dbg = false; |
45 |
private static void pa(String s) { System.out.println("PPConnector::"+s); } |
private static void p(String s) { System.out.println("PPConnector:: "+s); } |
46 |
|
|
47 |
public static boolean hackForTesting = false; |
public static boolean hackForTesting = false; |
48 |
|
|
72 |
MainNode2D mn2d = (MainNode2D)mainNode; |
MainNode2D mn2d = (MainNode2D)mainNode; |
73 |
if(mn2d.getView2D() != view2d && !hackForTesting) return; |
if(mn2d.getView2D() != view2d && !hackForTesting) return; |
74 |
|
|
75 |
|
Object container = CanvasView2D.getContainerKey(vs, parentCs); |
76 |
|
int containerCS = CanvasView2D.getContainerCS(vs, parentCs); |
77 |
|
if (dbg) p("containerCS: "+containerCS); |
78 |
|
|
79 |
DefaultVobMatcher m = (DefaultVobMatcher)vs.matcher; |
DefaultVobMatcher m = (DefaultVobMatcher)vs.matcher; |
80 |
for(Iterator i=m.getKeys(parentCs).iterator(); i.hasNext();) { |
for(Iterator i=m.getKeys(containerCS).iterator(); i.hasNext();) { |
81 |
Object next = i.next(); |
Object node = i.next(); |
82 |
if(!(next instanceof Pair)) continue; |
int cs = m.getCS(containerCS, node); |
|
Pair pair = (Pair)next; |
|
|
int cs = m.getCS(parentCs, pair); |
|
83 |
int culledCS = m.getCS(cs, "CULL"); |
int culledCS = m.getCS(cs, "CULL"); |
84 |
|
if (dbg) p("node: "+node+", cs: "+cs+", cull: "+culledCS); |
85 |
if(culledCS > 0) cs = culledCS; |
if(culledCS > 0) cs = culledCS; |
86 |
|
|
87 |
Object container = pair.first; |
if (cs < 0) { |
88 |
Object node = pair.second; |
p("Error with node: "+node+", too low cs: "+cs); |
89 |
|
continue; |
90 |
|
} |
91 |
|
|
92 |
/* check all associations */ |
/* check all associations */ |
93 |
|
|
94 |
// Right links! |
// Right links! |
100 |
Object plane = fen.constgraph.find1_X11(CANVAS2D.contains, obj); |
Object plane = fen.constgraph.find1_X11(CANVAS2D.contains, obj); |
101 |
if (container == plane) continue; |
if (container == plane) continue; |
102 |
Object anchor = getAnchor(plane, obj); |
Object anchor = getAnchor(plane, obj); |
103 |
if (dbg) pa("rect:"+anchor); |
if (dbg) p("anchor:"+anchor); |
104 |
l.link(1, cs, nodeType, new Pair(node, obj), anchor, shift); |
l.link(1, cs, nodeType, new Pair(node, obj), anchor, shift); |
105 |
shift++; |
shift++; |
106 |
} |
} |
113 |
Object plane = fen.constgraph.find1_X11(CANVAS2D.contains, obj); |
Object plane = fen.constgraph.find1_X11(CANVAS2D.contains, obj); |
114 |
if (container == plane) continue; |
if (container == plane) continue; |
115 |
Object anchor = getAnchor(plane, obj); |
Object anchor = getAnchor(plane, obj); |
116 |
if (dbg) pa("rect:"+anchor); |
if (dbg) p("anchor:"+anchor); |
117 |
l.link(-1, cs, nodeType, new Pair(obj, node), anchor, shift); |
l.link(-1, cs, nodeType, new Pair(obj, node), anchor, shift); |
118 |
shift++; |
shift++; |
119 |
} |
} |