Author: scooter
Date: 2009-07-09 09:05:40 -0700 (Thu, 09 Jul 2009)
New Revision: 17284

Modified:
   csplugins/trunk/soc/sfederow/CyAnimator/src/CyAnimatorDialog.java
   csplugins/trunk/soc/sfederow/CyAnimator/src/Interpolator.java
Log:
Updated to fix some null references and to clean up UI (a little)


Modified: csplugins/trunk/soc/sfederow/CyAnimator/src/CyAnimatorDialog.java
===================================================================
--- csplugins/trunk/soc/sfederow/CyAnimator/src/CyAnimatorDialog.java   
2009-07-09 14:44:05 UTC (rev 17283)
+++ csplugins/trunk/soc/sfederow/CyAnimator/src/CyAnimatorDialog.java   
2009-07-09 16:05:40 UTC (rev 17284)
@@ -147,7 +147,7 @@
                controlPanel.add(playButton);
                controlPanel.add(stopButton);
                
-               mainPanel.add(oldPanel);
+               // mainPanel.add(oldPanel);
                mainPanel.add(controlPanel);
                mainPanel.add(framePanel);
                
@@ -167,8 +167,6 @@
                
                String command = e.getActionCommand();
                
-               System.out.println(command);
-               
                if(command.equals("capture"))
                {
                        frameList.add(captureCurrentFrame());
@@ -183,7 +181,7 @@
                } 
                
                if(command.equals("stop")){
-                       
+                       timer.stop();
                }
                
                if(command.equals("rewind")){
@@ -223,7 +221,6 @@
                                  public void actionPerformed(ActionEvent evt) {
                                  if(i == frames.length){ return;}
                                          frames[i].display();
-                                 System.out.println(i);
                                          i++;
                              }
                          };
@@ -282,29 +279,24 @@
        */
        public void play(){
                
-                int delay = 1000; //milliseconds
+                int delay = 100; //milliseconds
                  ActionListener taskPerformer = new ActionListener() {
                          
                          Interpolator lint = new Interpolator();
                          int i = 0;
                          
-                         int framenum = 
(frameList.size())+((frameList.size()-1)*10);
-                         CyFrame[] frames = lint.makeFrames(frameList, 
framenum); //lint.makeColorFrames(frameOne, frameTwo, 10);
+                         CyFrame[] frames = lint.makeFrames(frameList, 10); 
//lint.makeColorFrames(frameOne, frameTwo, 10);
                        
                          
                          public void actionPerformed(ActionEvent evt) {
-                         if(i == frames.length){ return;}
+                         if(i == frames.length){ i = 0;}
                                  frames[i].display();
-                         System.out.println(i);
                                  i++;
                      }
                  };
                  
-                 Timer t = new Timer(delay, taskPerformer);
-             t.start();
-                 //for(CyFrame frame: frameList){
-             //frame.display();
-          //}
+                 timer = new Timer(delay, taskPerformer);
+             timer.start();
        }
        
        public void updateThumbnails(){
@@ -392,4 +384,4 @@
                }
        }
        
-}
\ No newline at end of file
+}

Modified: csplugins/trunk/soc/sfederow/CyAnimator/src/Interpolator.java
===================================================================
--- csplugins/trunk/soc/sfederow/CyAnimator/src/Interpolator.java       
2009-07-09 14:44:05 UTC (rev 17283)
+++ csplugins/trunk/soc/sfederow/CyAnimator/src/Interpolator.java       
2009-07-09 16:05:40 UTC (rev 17284)
@@ -25,30 +25,10 @@
                //generateInterpolatedFrames(one, two, 10);
        }
 
-       public CyFrame[] makeFrames(List<CyFrame> frameList, int framenum){
-          /*
-               ArrayList<CyFrame> bigFrameList = new ArrayList<CyFrame>();
-               
-               for(int i=1; i<=frameList.size(); i++){
-                       bigFrameList.add(frameList.get(i));
-                       
-                       cyFrameArray = interpolatePosition(frameList.get(i), 
frameList.get(i+1), framenum);
-                       cyFrameArray = interpolateColor(frameList.get(i), 
frameList.get(i+1), framenum);
-               }
-               */
-               
-               
-               CyFrame[] cyFrameArray = new CyFrame[framenum+2];
+       public CyFrame[] makeFrames(List<CyFrame> frameList, int framecount){
+               CyFrame[] cyFrameArray = new 
CyFrame[(frameList.size()-1)*framecount + 1];
           
-               int incr = (framenum-frameList.size())/(frameList.size()-1);
-               
-               //for(int i=0; i<frameList.size(); i++){
-                       //cyFrameArray[incr*i] = frameList.get(i+1);
-               //}
-               //cyFrameArray[0] = frameList.get(1);
-               //cyFrameArray[framenum+1] = frameList.get(frameList.size());
-               
-               for(int i=0; i<framenum+1; i++){
+               for(int i=0; i<cyFrameArray.length; i++){
                        cyFrameArray[i] = new 
CyFrame(frameList.get(1).currentNetwork);
                }
                
@@ -57,15 +37,15 @@
                for(int i=0; i < frameList.size()-1; i++){
                        
                        
-                       end = start + incr + 1;
+                       end = start + framecount;
                        cyFrameArray[start] = frameList.get(i);
-                       //cyFrameArray[(i+1)*incr] = frameList.get(i+1);
+
                        cyFrameArray = interpolatePosition(frameList.get(i), 
frameList.get(i+1), start, end, cyFrameArray);
                        cyFrameArray = interpolateColor(frameList.get(i), 
frameList.get(i+1), start, end, cyFrameArray);
                
                        start = end;
                }
-               cyFrameArray[framenum+1] = frameList.get(frameList.size()-1);
+               cyFrameArray[end] = frameList.get(frameList.size()-1);
                
                return cyFrameArray;
        }
@@ -165,7 +145,6 @@
                                
                                
                        
-                               
                                //System.out.println(k+"  "+xy[0]+"  "+xy[1]);
                                
cyFrameArray[start+k].nodePosMap.put(node.getIdentifier(), xy);
                                //Paint oldpaint = 
frameOne.nodeColMap.get(node.getIdentifier());
@@ -202,8 +181,6 @@
                for(Node node: nodeList){
                        
                        
-                       double[] xyOne = 
frameOne.nodePosMap.get(node.getIdentifier());
-                       
                        Paint colorOne = 
frameOne.nodeColMap.get(node.getIdentifier());
                    Paint colorTwo = 
frameTwo.nodeColMap.get(node.getIdentifier());
                                        
@@ -254,12 +231,6 @@
                        
                        for(int k=1; k<framenum+1; k++){
                                
-                               double[] xy = new double[2];
-                               
-                               xy[0] = xyOne[0];
-                               xy[1]= xyOne[1];
-                               
-                               
                                if(red1 < red2){        
                                        rArray[k+1] = rArray[k] + rIncLen;
                                }else{
@@ -285,7 +256,7 @@
                        Paint col = new Color(rArray[k+1], gArray[k+1], 
bArray[k+1]);           
                                
//cyFrameArray[k].nodePosMap.put(node.getIdentifier(), xy);
                                Paint oldpaint = 
frameOne.nodeColMap.get(node.getIdentifier());
-                               
cyFrameArray[k].nodeColMap.put(node.getIdentifier(), col);
+                               
cyFrameArray[start+k].nodeColMap.put(node.getIdentifier(), col);
                        
                        }       
                        


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to