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

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

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

revision 1.1 by humppake, Sun Apr 6 23:43:48 2003 UTC revision 1.2 by humppake, Wed Apr 9 12:18:20 2003 UTC
# Line 37  import com.hp.hpl.mesa.rdf.jena.model.*; Line 37  import com.hp.hpl.mesa.rdf.jena.model.*;
37   */   */
38  public class SundewWheelView extends WheelView {  public class SundewWheelView extends WheelView {
39    
40      public static boolean dbg = false;      public static boolean dbg = true;
41      private static void p(String s) { System.out.println(s); }      private static void p(String s) { System.out.println(s); }
42    
43      public SundewWheelView(NodeView nodeView) {      public SundewWheelView(NodeView nodeView) {
44          super(nodeView);          super(nodeView);
45    
46          radius = (sizex + gapx) * 2;          radius = (sizex + gapx) * 2;
47          depth = 2;          maxDepth = 2;
48      }      }
49    
50      protected void renderDepth(VobScene sc, int into, Cursor c, Resource focus,      protected void renderDepth(VobScene sc, int into, int focusCs,
51                              Pair current, Collection nodes, int dir, double cura,                                 Cursor c, Pair focus, Pair oldFocus,
52                              double rota, float r, int focusCs, int depth, int midx,                                 int dir, double cura, double rota,
53                              int midy) {                                 float r, int midx, int midy, int depth) {
54          RDFNode newFocus = (RDFNode)current.first;          if (((RDFNode)focus.first) instanceof Resource) {
55          if (newFocus != null && newFocus instanceof Resource) {              oldFocus = new Pair(oldFocus.first, focus.second);
56              Vector removal = new Vector();              
             Pair focusPair = new Pair(focus, (Property)current.second);  
             removal.add(focusPair);  
   
57              Collection posNodes, negNodes;              Collection posNodes, negNodes;
58    
59              if (dir > 0) {              if (dir > 0) {
60                  posNodes = getNodes(c, (Resource)newFocus, 1);                  posNodes = getNodes(c, (Resource)focus.first, 1);
61                  negNodes = getNodes(c, (Resource)newFocus, -1, removal);                  negNodes = getNodes(c, (Resource)focus.first, -1);
62              } else {              } else {
63                  posNodes = getNodes(c, (Resource)newFocus, 1, removal);                  posNodes = getNodes(c, (Resource)focus.first, 1);
64                  negNodes = getNodes(c, (Resource)newFocus, -1);                  negNodes = getNodes(c, (Resource)focus.first, -1);
65              }              }    
66                                            
67              double posRota = getRotationAngle(c, (Resource)newFocus, posNodes,              double posRota = getRotationAngle(c, (Resource)focus.first, posNodes,
68                                                Math.PI, depth-1);                                                Math.PI, depth);
69              double negRota = getRotationAngle(c, (Resource)newFocus, negNodes,              double negRota = getRotationAngle(c, (Resource)focus.first, negNodes,
70                                                Math.PI, depth-1);                                                Math.PI, depth);
71    
72              double newRota = (posRota < negRota) ? posRota : negRota;              double newRota = (posRota < negRota) ? posRota : negRota;
73              if (posRota < 0) newRota = negRota;              if (posRota < 0) newRota = negRota;
74              else if (negRota < 0) newRota = posRota;              else if (negRota < 0) newRota = posRota;
75                
             int position = (posNodes.size() > negNodes.size()) ?  
                 posNodes.size() / 2: negNodes.size() / 2;  
   
76              int x = midx+x(cura, r);              int x = midx+x(cura, r);
77              int y = midy+y(cura, r);              int y = midy+y(cura, r);
78    
79              renderSomewardConnections(sc, into, c, (Resource)newFocus, posNodes,              if (depth == maxDepth) r = gapx + sizex;
80                                        position, 1, newRota/2, newRota,              else r = r/2;
81                                        r/2, focusCs, depth-1, x, y);  
82                Cursor curPosition = new Cursor(c.getSubjectOrder(), c.getObjectOrder(),
83              renderSomewardConnections(sc, into, c, (Resource)newFocus, negNodes,                                              c.getStatementSelector(), c.names,
84                                        position, -1, Math.PI+newRota/2, newRota,                                              (Resource)focus.first, dir*-1,
85                                        r/2, focusCs, depth-1, x, y);                                              (RDFNode)oldFocus.first);
86                int posPosition = curPosition.getRotationIndex(1);
87                int negPosition = curPosition.getRotationIndex(-1);
88                
89                if (dir > 0) {
90                    renderSomewardConnections(sc, into, focusCs, c, focus, null,
91                                              posNodes, posPosition, 1, 0, newRota,
92                                              r, x, y,  depth);
93                    renderSomewardConnections(sc, into, focusCs, c, focus, oldFocus,
94                                              negNodes, negPosition, -1, Math.PI, newRota,
95                                              r, x, y, depth);
96                } else {
97                    renderSomewardConnections(sc, into, focusCs, c, focus, oldFocus,
98                                              posNodes, posPosition, 1, 0, newRota,
99                                              r, x, y,  depth);
100                    renderSomewardConnections(sc, into, focusCs, c, focus, null,
101                                              negNodes, negPosition, -1, Math.PI, newRota,
102                                              r, x, y, depth);
103                }
104          }          }
105      }      }
106        
107      private int x(double angle, float radius) {      protected int x(double angle, float radius) {
108          return (int)(Math.cos(angle) * radius);          return (int)(Math.cos(angle) * radius);
109      }      }
110    
111      private int y(double angle, float radius) {      protected int y(double angle, float radius) {
112          return (int)(Math.sin(angle) * radius);          return (int)(Math.sin(angle) * radius * 0.75);
113      }      }
114  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

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