/[fenfire]/fenfire/org/fenfire/loom/WheelView.java
ViewVC logotype

Diff of /fenfire/org/fenfire/loom/WheelView.java

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

revision 1.11 by benja, Sun Mar 16 16:24:12 2003 UTC revision 1.12 by benja, Tue Mar 25 18:48:04 2003 UTC
# Line 60  public class WheelView implements View { Line 60  public class WheelView implements View {
60      protected int sizex = 150, sizey = 20;      protected int sizex = 150, sizey = 20;
61      protected int gapx = 50, gapy = 30;      protected int gapx = 50, gapy = 30;
62    
63        protected int radius = sizex + gapx;
64    
65      /** Maximum rotation angle. */      /** Maximum rotation angle. */
66      protected double maxrota = Math.PI / 9;      protected double maxrota = Math.PI / 9;
67    
68        /**
69         *  Render either posward or negward connections
70         *  (or onward, maybe).
71         */
72        public void renderSomewardConnections(VobScene sc, int into, Cursor c,
73                                              Resource node, int before,
74                                              int dir, double rota, float r,
75                                              int focusCs, int depth,
76                                              int midx, int midy) {
77            double cura = -(before * rota);
78            if(dir < 0) cura += Math.PI;
79            for(Iterator j=c.getConnections(node, dir).iterator(); j.hasNext();) {
80                Statement stmt = (Statement)j.next();
81                
82                NodeView.Nodespec spec =
83                    new NodeView.Nodespec(stmt, dir);
84                int x = midx+x(cura, r)-sizex/2;
85                int y = midy+y(cura, r)-sizey/2;
86                int cs2 = sc.orthoBoxCS(into, spec, Math.abs(before),
87                                        x, y, 1, 1, sizex, sizey);
88                sc.coords.activate(cs2);
89                nodeView.render(sc, cs2, spec);
90                                
91                if(dir > 0)
92                    sc.map.put(conn, focusCs, cs2);    
93                else
94                    sc.map.put(conn, cs2, focusCs);
95    
96                cura+=rota;
97                before--;
98            }
99        }
100    
101      public void render(VobScene sc, int into, Cursor c) {      public void render(VobScene sc, int into, Cursor c) {
102          int midx = sc.size.width/2, midy = sc.size.height/2;          int midx = sc.size.width/2, midy = sc.size.height/2;
103          NodeView.Nodespec spec = new NodeView.Nodespec(c.focus);          NodeView.Nodespec spec = new NodeView.Nodespec(c.focus);
# Line 87  public class WheelView implements View { Line 122  public class WheelView implements View {
122          int r = gapx + sizex;          int r = gapx + sizex;
123    
124          /** Poswards connections */          /** Poswards connections */
125          int before = c.getRotationIndex(1);              renderSomewardConnections(sc, into, c, c.focus,
126          double cura = -(before * rota);                                    c.getRotationIndex(1), 1,
127          for(Iterator j=c.getConnections(1).iterator(); j.hasNext();) {                                    rota, r, cs, 1, midx, midy);
             Statement stmt = (Statement)j.next();  
             RDFNode node = stmt.getObject();  
             spec = new NodeView.Nodespec(node, stmt.getPredicate(), 1);  
             int cs2 = sc.orthoBoxCS(into, spec, Math.abs(before),  
                                     midx+x(cura, r)-sizex/2,  
                                     midy+y(cura, r)-sizey/2,  
                                     1, 1, sizex, sizey);  
             sc.coords.activate(cs2);  
             nodeView.render(sc, cs2, spec);  
                               
             sc.map.put(conn, cs, cs2);      
             cura+=rota;  
             before--;  
         }  
128    
129          /** Negward connections */          /** Negward connections */
130          before = c.getRotationIndex(-1);                  renderSomewardConnections(sc, into, c, c.focus,
131          cura = Math.PI-(before * rota);                                    c.getRotationIndex(-1), -1,
132          for(Iterator j=c.getConnections(-1).iterator(); j.hasNext();) {                                    rota, r, cs, 1, midx, midy);
             Statement stmt = (Statement)j.next();  
             RDFNode node = stmt.getSubject();  
             spec = new NodeView.Nodespec(node, stmt.getPredicate(), -1);  
             int cs2 = sc.orthoBoxCS(into, spec, Math.abs(before),  
                                     midx+x(cura, r)-sizex/2,  
                                     midy+y(cura, r)-sizey/2,  
                                     1, 1, sizex, sizey);  
             sc.coords.activate(cs2);  
             nodeView.render(sc, cs2, spec);  
             sc.map.put(conn, cs2, cs);  
             cura+=rota;  
             before--;  
         }  
133      }      }
134    
135      int x(double angle, int radius) {      int x(double angle, float radius) {
136          return (int)(Math.cos(angle) * radius);          return (int)(Math.cos(angle) * radius);
137      }      }
138                                    

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

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