/[fenfire]/fenfire/org/fenfire/view/CanvasView2D.java
ViewVC logotype

Diff of /fenfire/org/fenfire/view/CanvasView2D.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.19 by mudyc, Tue Jun 24 13:53:35 2003 UTC revision 1.20 by mudyc, Thu Jul 17 16:28:19 2003 UTC
# Line 33  import org.fenfire.view.lava.FastView; Line 33  import org.fenfire.view.lava.FastView;
33  import org.fenfire.vocab.*;  import org.fenfire.vocab.*;
34  import org.fenfire.swamp.*;  import org.fenfire.swamp.*;
35  import org.fenfire.util.*;  import org.fenfire.util.*;
36    import org.fenfire.util.lava.*;
37  import org.nongnu.libvob.*;  import org.nongnu.libvob.*;
38  import org.nongnu.libvob.gl.*;  import org.nongnu.libvob.gl.*;
39  import org.nongnu.libvob.impl.gl.*;  import org.nongnu.libvob.impl.gl.*;
# Line 69  public static final String rcsid = "$Id$ Line 70  public static final String rcsid = "$Id$
70          lineconn.glteardown = GLCache.getCallList("PopAttrib");          lineconn.glteardown = GLCache.getCallList("PopAttrib");
71      }      }
72    
73      private Object container;      //private Object container;
74      private int paper2screen = -1;      private int paper2screen = -1;
75      private ArrayList nodes = new ArrayList();      private CoordsysCache coords = new CoordsysCache();
76        private Map containers = new HashMap(10);
77    
78      public void render(VobScene vs, Object container,      public void render(VobScene vs, Object container,
79                         int matchingParent, int box2screen, int box2plane)                         int matchingParent, int box2screen, int box2plane)
# Line 79  public static final String rcsid = "$Id$ Line 81  public static final String rcsid = "$Id$
81          if (!RDFUtil.isNodeType(fen.graph, container, CANVAS2D.Canvas))          if (!RDFUtil.isNodeType(fen.graph, container, CANVAS2D.Canvas))
82              throw new Error("plane is NOT a container!");              throw new Error("plane is NOT a container!");
83    
84          this.container = container;          //this.container = container;
85            Object key = vs.matcher.getKey(matchingParent);
86            containers.put(key, container);
87    
88          int paper2box = vs.invertCS(box2plane, "canvasview_INv");          int paper2box = vs.invertCS(box2plane, "canvasview_INv");
89          paper2screen = vs.concatCS(box2screen, "canvasview_conc",          paper2screen = vs.concatCS(box2screen, "canvasview_conc",
90                                     paper2box);                                     paper2box);
91          Iterator iter = fen.constgraph.findN_11X_Iter(container,          Iterator iter = fen.constgraph.findN_11X_Iter(container,
92                                                        CANVAS2D.contains);                                                        CANVAS2D.contains);
93          if (dbg) pa("Canvas begin");          if (dbg) pa("Canvas begin");
94          nodes.clear();          //nodes.clear();
95          while (iter.hasNext()) {          while (iter.hasNext()) {
96              Object n = iter.next();              Object n = iter.next();
97              Placeable p = (Placeable)nodeView.f(fen.constgraph, n);              Placeable p = (Placeable)nodeView.f(fen.constgraph, n);
98              Pair matchKey = new Pair(container, n);              Pair matchKey = new Pair(container, n);
99    
100              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);
101              nodes.add(""+cs);              Object nodeKey = new Pair(key, n);
102              chgFast(vs);              coords.set(nodeKey, cs);
103                            
104              vs.matcher.add(matchingParent, cs, matchKey);              vs.matcher.add(matchingParent, cs, matchKey);
105              vs.activate(cs);              vs.activate(cs);
# Line 103  public static final String rcsid = "$Id$ Line 108  public static final String rcsid = "$Id$
108              }              }
109              p.place(vs, cs);              p.place(vs, cs);
110          }          }
111            chgFast(vs, key);
112    
113          // show connections          // show connections
114          Iterator iter1 = fen.constgraph.findN_11X_Iter(container,          Iterator iter1 = fen.constgraph.findN_11X_Iter(container,
# Line 127  public static final String rcsid = "$Id$ Line 133  public static final String rcsid = "$Id$
133          }          }
134      }      }
135    
136      public void chgFast(VobScene oldVS) {      public void chgFast(VobScene oldVS, Object key) {
137                    
138            Object container = containers.get(key);
139          Iterator iter = fen.constgraph.findN_11X_Iter(container,          Iterator iter = fen.constgraph.findN_11X_Iter(container,
140                                                        CANVAS2D.contains);                                                        CANVAS2D.contains);
141          for (int i=0; i<nodes.size(); i++) {          while (iter.hasNext()) {
142              Object n = iter.next();              Object n = iter.next();
143              int x = RDFUtil.getInt(fen.graph, n, CANVAS2D.x);              float x = RDFUtil.getFloat(fen.graph, n, CANVAS2D.x);
144              int y = RDFUtil.getInt(fen.graph, n, CANVAS2D.y);              float y = RDFUtil.getFloat(fen.graph, n, CANVAS2D.y);
145    
146              Placeable p = (Placeable)nodeView.f(fen.constgraph, n);              Placeable p = (Placeable)nodeView.f(fen.constgraph, n);
147                            
148              // int cs = vs.coords.translate(paper2screen, x, y);              // int cs = vs.coords.translate(paper2screen, x, y);
149              if(dbg) pa("CANVAS: "+p.getWidth()+" "+p.getHeight());              if(dbg) pa("CANVAS: "+p.getWidth()+" "+p.getHeight());
150    
151              int cs = Integer.parseInt((String)nodes.get(i));              int cs = coords.get(new Pair(key, n));
152              oldVS.coords.setOrthoBoxParams(cs, 0,              oldVS.coords.setOrthoBoxParams(cs, 0,
153                                             x, y, 1, 1,                                             x, y, 1, 1,
154                                             p.getWidth(), p.getHeight());                                             p.getWidth(), p.getHeight());

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26