46 |
public class TransclusionConnector implements BuoyViewConnector { |
public class TransclusionConnector implements BuoyViewConnector { |
47 |
public static final String rcsid = "$Id$"; |
public static final String rcsid = "$Id$"; |
48 |
public static boolean dbg = false; |
public static boolean dbg = false; |
49 |
private static void pa(String s) { System.out.println("TransclusionConnector:: "+s); } |
private static void p(String s) { System.out.println("TransclusionConnector:: "+s); } |
50 |
|
|
51 |
|
|
52 |
private Fen fen; |
private Fen fen; |
100 |
if(!(mainNode instanceof AbstractMainNode2D)) return; |
if(!(mainNode instanceof AbstractMainNode2D)) return; |
101 |
AbstractMainNode2D mn2d = (AbstractMainNode2D)mainNode; |
AbstractMainNode2D mn2d = (AbstractMainNode2D)mainNode; |
102 |
DefaultVobMatcher m = (DefaultVobMatcher)vs.matcher; |
DefaultVobMatcher m = (DefaultVobMatcher)vs.matcher; |
103 |
if(dbg) pa("Trying transclusion addbuoys"); |
if(dbg) p("Trying transclusion addbuoys"); |
104 |
if(mn2d.getView2D() == normalNodeNodeType.getView2D()) { |
if(mn2d.getView2D() == normalNodeNodeType.getView2D()) { |
105 |
if (dbg) |
if (dbg) p("TransclusionConnector: canvas -> scrolls"); |
106 |
pa("TransclusionConnector: canvas -> scrolls"); |
|
107 |
// Loop over the placed nodes' keys |
// Loop over the placed nodes' keys |
108 |
for(Iterator i=m.getKeys(parentCs).iterator(); i.hasNext();) { |
int containerCS = CanvasView2D.getContainerCS(vs, parentCs); |
|
Object key = i.next(); |
|
|
if(!(key instanceof Pair)) continue; |
|
|
Pair pair = (Pair)key; |
|
|
Object node = pair.second; |
|
109 |
|
|
110 |
|
for(Iterator i=m.getKeys(containerCS).iterator(); i.hasNext();) { |
111 |
|
Object node = i.next(); |
112 |
|
|
113 |
Object anchor = this.scrollBlockForNode.f(fen.constgraph, |
View2D.Anchor anchor = (View2D.Anchor)this.scrollBlockForNode.f(fen.constgraph, node); |
114 |
node); |
if(dbg) p("node: "+node+", anchor: "+anchor); |
|
if(dbg) |
|
|
pa("Transclcon:: "+key+" "+pair.second+" "+anchor); |
|
115 |
if(anchor == null) continue; |
if(anchor == null) continue; |
116 |
|
|
117 |
int cs =m.getCS(parentCs, key); |
int cs =m.getCS(containerCS, node); |
118 |
int culledCS = m.getCS(cs, "CULL"); |
int culledCS = m.getCS(cs, "CULL"); |
119 |
if(culledCS > 0) cs = culledCS; |
if(culledCS > 0) cs = culledCS; |
120 |
|
|
126 |
|
|
127 |
} else if(mn2d.getView2D() == pageImageScrollNodeType.getView2D()) { |
} else if(mn2d.getView2D() == pageImageScrollNodeType.getView2D()) { |
128 |
if (dbg) |
if (dbg) |
129 |
pa("TransclusionConnector: Pagescroll -> outside"); |
p("TransclusionConnector: Pagescroll -> outside"); |
130 |
for(Iterator i=m.getKeys(parentCs).iterator(); i.hasNext();) { |
for(Iterator i=m.getKeys(parentCs).iterator(); i.hasNext();) { |
131 |
Object key = i.next(); |
Object key = i.next(); |
132 |
if(!(key instanceof PageImageSpan)) continue; |
if(!(key instanceof PageImageSpan)) continue; |
133 |
PageImageSpan span = (PageImageSpan)key; |
PageImageSpan span = (PageImageSpan)key; |
134 |
|
|
135 |
if(dbg) pa("TRC: span "+key); |
if(dbg) p("TRC: span "+key); |
136 |
int cs =m.getCS(parentCs, key); |
int cs =m.getCS(parentCs, key); |
137 |
|
|
138 |
Enfilade1D tmpEnf = fen.enfMaker.makeEnfilade(span); |
Enfilade1D tmpEnf = fen.enfMaker.makeEnfilade(span); |
139 |
for(Iterator nodes = fen.enfiladeOverlap.getMatches(tmpEnf).iterator(); nodes.hasNext(); ) { |
for(Iterator nodes = fen.enfiladeOverlap.getMatches(tmpEnf).iterator(); nodes.hasNext(); ) { |
140 |
Object node = nodes.next(); |
Object node = nodes.next(); |
141 |
if(dbg) pa("TRC: overlap "+node); |
if(dbg) p("TRC: overlap "+node); |
142 |
Object plane = fen.constgraph.find1_X11( |
Object plane = fen.constgraph.find1_X11( |
143 |
CANVAS2D.contains, node); |
CANVAS2D.contains, node); |
144 |
if(plane == null) { |
if(plane == null) { |
145 |
if(dbg) pa("No plane!"); |
if(dbg) p("No plane!"); |
146 |
continue; |
continue; |
147 |
} |
} |
148 |
Object anchor = getAnchor(plane, node); |
Object anchor = getAnchor(plane, node); |
153 |
} |
} |
154 |
} |
} |
155 |
} else { |
} else { |
156 |
if(dbg) pa("TransclusionConnector: Unknown view2d type"); |
if(dbg) p("TransclusionConnector: Unknown view2d type"); |
157 |
} |
} |
158 |
} |
} |
159 |
|
|