34 |
import org.fenfire.util.*; |
import org.fenfire.util.*; |
35 |
import org.nongnu.libvob.*; |
import org.nongnu.libvob.*; |
36 |
import org.nongnu.libvob.gl.*; |
import org.nongnu.libvob.gl.*; |
37 |
|
import org.nongnu.libvob.impl.DefaultVobMatcher; |
38 |
import org.nongnu.libvob.impl.gl.*; |
import org.nongnu.libvob.impl.gl.*; |
39 |
import org.nongnu.libvob.buoy.*; |
import org.nongnu.libvob.buoy.*; |
40 |
import org.nongnu.libvob.vobs.SimpleConnection; |
import org.nongnu.libvob.vobs.SimpleConnection; |
87 |
p("box2screen: "+box2screen); |
p("box2screen: "+box2screen); |
88 |
p("matchingparent: "+matchingParent); |
p("matchingparent: "+matchingParent); |
89 |
} |
} |
90 |
|
|
91 |
|
/* The code adds two dummy cs: |
92 |
|
* 1) cs with "CANVAS" as a key. |
93 |
|
* 2) cs into the previous one with container as a key. |
94 |
|
* All nodes are matched into latter dummy cs and connectors etc. |
95 |
|
* must know this and follow that specification to work correctly. |
96 |
|
* [specification specified in irc at 2003-07-31T9:50/10:35Z] |
97 |
|
*/ |
98 |
|
int canvasCS = vs.coords.translate(matchingParent, 0,0); |
99 |
|
vs.matcher.add(matchingParent, canvasCS, "CANVAS"); |
100 |
|
int containerCS = vs.coords.translate(canvasCS, 0,0); |
101 |
|
vs.matcher.add(canvasCS, containerCS, container); |
102 |
|
|
103 |
Iterator iter = fen.constgraph.findN_11X_Iter(container, |
Iterator iter = fen.constgraph.findN_11X_Iter(container, |
104 |
CANVAS2D.contains); |
CANVAS2D.contains); |
105 |
if (dbg) p("Canvas begin"); |
if (dbg) p("Canvas begin"); |
110 |
(org.nongnu.libvob.lava.placeable.Placeable)nodeView.f(fen.constgraph, n); |
(org.nongnu.libvob.lava.placeable.Placeable)nodeView.f(fen.constgraph, n); |
111 |
|
|
112 |
int cs = vs.coords.orthoBox(paper2screen, 0,1,2,3,4,5,6); |
int cs = vs.coords.orthoBox(paper2screen, 0,1,2,3,4,5,6); |
113 |
vs.matcher.add(matchingParent, cs, new Pair(container, n)); |
vs.matcher.add(containerCS, cs, n); |
114 |
vs.activate(cs); |
vs.activate(cs); |
115 |
|
|
116 |
if(cull) { |
if(cull) { |
120 |
} |
} |
121 |
chgFast(vs, box2screen); |
chgFast(vs, box2screen); |
122 |
|
|
123 |
|
|
124 |
|
// [mudyc] thinks that something which knows |
125 |
|
// about STRUCTLINK should be an adaptor. |
126 |
|
|
127 |
// show connections |
// show connections |
128 |
Iterator iter1 = fen.constgraph.findN_11X_Iter(container, |
Iterator iter1 = fen.constgraph.findN_11X_Iter(container, |
129 |
CANVAS2D.contains); |
CANVAS2D.contains); |
130 |
while (iter1.hasNext()) { |
while (iter1.hasNext()) { |
131 |
Object node1 = iter1.next(); |
Object node1 = iter1.next(); |
132 |
Pair key1 = new Pair(container, node1); |
int cs1 = vs.matcher.getCS(containerCS, node1); |
|
int cs1 = vs.matcher.getCS(matchingParent, key1); |
|
133 |
|
|
134 |
Iterator iter2 = fen.constgraph.findN_11X_Iter(node1, |
Iterator iter2 = fen.constgraph.findN_11X_Iter(node1, |
135 |
STRUCTLINK.linkedTo); |
STRUCTLINK.linkedTo); |
138 |
Object container2 = fen.constgraph.find1_X11(CANVAS2D.contains, node2); |
Object container2 = fen.constgraph.find1_X11(CANVAS2D.contains, node2); |
139 |
if(container2 != container) |
if(container2 != container) |
140 |
continue; |
continue; |
141 |
Pair key2 = new Pair(container, node2); |
int cs2 = vs.matcher.getCS(containerCS, node2); |
|
int cs2 = vs.matcher.getCS(matchingParent, key2); |
|
142 |
|
|
143 |
vs.map.put(lineconn, cs1, cs2); |
vs.map.put(lineconn, cs1, cs2); |
144 |
} |
} |
145 |
} |
} |
146 |
} |
} |
147 |
|
|
148 |
|
static public Object getContainerKey(VobScene vs, int from) { |
149 |
|
DefaultVobMatcher m = (DefaultVobMatcher)vs.matcher; |
150 |
|
int canvasCS = m.getCS(from, "CANVAS"); |
151 |
|
|
152 |
|
Object container = null; |
153 |
|
for(Iterator i=m.getKeys(canvasCS).iterator(); i.hasNext();) { |
154 |
|
container = i.next(); |
155 |
|
if (dbg) p("container object is: " +container); |
156 |
|
} |
157 |
|
return container; |
158 |
|
} |
159 |
|
static public int getContainerCS(VobScene vs, int from) { |
160 |
|
Object container = getContainerKey(vs, from); |
161 |
|
int canvasCS = vs.matcher.getCS(from, "CANVAS"); |
162 |
|
int containerCS = vs.matcher.getCS(canvasCS, container); |
163 |
|
if (containerCS < 0) throw new Error("Impossible!"); |
164 |
|
return containerCS; |
165 |
|
} |
166 |
|
|
167 |
public void chgFast(VobScene oldVS, int parent) { |
public void chgFast(VobScene oldVS, int parent) { |
168 |
|
int containerCS = getContainerCS(oldVS, parent); |
169 |
|
|
170 |
Object container = containers.get(""+parent); |
DefaultVobMatcher m = (DefaultVobMatcher)oldVS.matcher; |
171 |
if (dbg) p("chgFast container: " + container); |
for(Iterator i=m.getKeys(containerCS).iterator(); i.hasNext();) { |
172 |
Iterator iter = fen.constgraph.findN_11X_Iter(container, |
Object n = i.next(); |
|
CANVAS2D.contains); |
|
|
while (iter.hasNext()) { |
|
|
Object n = iter.next(); |
|
173 |
if (dbg) p("Object is: "+n); |
if (dbg) p("Object is: "+n); |
174 |
float x = RDFUtil.getFloat(fen.graph, n, CANVAS2D.x); |
float x = RDFUtil.getFloat(fen.graph, n, CANVAS2D.x); |
175 |
float y = RDFUtil.getFloat(fen.graph, n, CANVAS2D.y); |
float y = RDFUtil.getFloat(fen.graph, n, CANVAS2D.y); |
180 |
|
|
181 |
if(dbg) p("size: "+p.getWidth()+" "+p.getHeight()); |
if(dbg) p("size: "+p.getWidth()+" "+p.getHeight()); |
182 |
|
|
183 |
int cs = oldVS.matcher.getCS(parent, new Pair(container, n)); |
int cs = oldVS.matcher.getCS(containerCS, n); |
184 |
if (cs < 1) throw new Error(cs+" is not possible!"); |
if (cs < 1) throw new Error(cs+" is not possible!"); |
185 |
|
|
186 |
oldVS.coords.setOrthoBoxParams(cs, 0, |
oldVS.coords.setOrthoBoxParams(cs, 0, |
196 |
float[] xyout) { |
float[] xyout) { |
197 |
int cs = oldvs.getCSAt(box2screen, x, y, xyout); |
int cs = oldvs.getCSAt(box2screen, x, y, xyout); |
198 |
if(cs <= 1) return null; |
if(cs <= 1) return null; |
199 |
Pair p = (Pair)oldvs.matcher.getKey(cs); |
return oldvs.matcher.getKey(cs); |
|
return p.second; |
|
200 |
} |
} |
201 |
} |
} |