Author: sfederow
Date: 2009-06-11 20:16:49 -0700 (Thu, 11 Jun 2009)
New Revision: 16941

Added:
   csplugins/trunk/soc/sfederow/CyAnimator/
   csplugins/trunk/soc/sfederow/CyAnimator/.classpath
   csplugins/trunk/soc/sfederow/CyAnimator/.project
   csplugins/trunk/soc/sfederow/CyAnimator/build.xml
   csplugins/trunk/soc/sfederow/CyAnimator/lib/
   csplugins/trunk/soc/sfederow/CyAnimator/src/
   csplugins/trunk/soc/sfederow/CyAnimator/src/CyAnimator.java
   csplugins/trunk/soc/sfederow/CyAnimator/src/CyAnimatorDialog.java
   csplugins/trunk/soc/sfederow/CyAnimator/src/CyFrame.java
   csplugins/trunk/soc/sfederow/CyAnimator/src/LinearInterpolator.java
Log:


Added: csplugins/trunk/soc/sfederow/CyAnimator/.classpath
===================================================================
--- csplugins/trunk/soc/sfederow/CyAnimator/.classpath                          
(rev 0)
+++ csplugins/trunk/soc/sfederow/CyAnimator/.classpath  2009-06-12 03:16:49 UTC 
(rev 16941)
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="src" path=""/>
+       <classpathentry kind="con" 
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/activation.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/biojava-1.4.jar"/>
+       <classpathentry kind="lib" path="/home/stephen/cytoscape/lib/colt.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/coltginy.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/commons-cli-1.x-cytoscape-custom.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/com-nerius-math-xform.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/concurrent.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/cytoscape-cruft-obo.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/cytoscape-geom-rtree.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/cytoscape-geom-spacial.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/cytoscape-graph-dynamic.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/cytoscape-graph-fixed.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/cytoscape-render-export.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/cytoscape-render-immed.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/cytoscape-render-stateful.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/cytoscape-task.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/cytoscape-util-intr.jar"/>
+       <classpathentry kind="lib" path="/home/stephen/cytoscape/lib/ding.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/FastInfoset.jar"/>
+       <classpathentry kind="lib" path="/home/stephen/cytoscape/lib/fing.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/freehep-export-2.1.1.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/freehep-graphics2d-2.1.1.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/freehep-graphicsio-2.1.1.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/freehep-graphicsio-java-2.1.1.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/freehep-graphicsio-ps-2.1.1.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/freehep-graphicsio-svg-2.1.1.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/freehep-io-2.0.2.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/freehep-jas-plotter-2.2.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/freehep-swing-2.0.3.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/freehep-util-2.0.2.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/freehep-xml-2.1.1.jar"/>
+       <classpathentry kind="lib" path="/home/stephen/cytoscape/lib/giny.jar"/>
+       <classpathentry kind="lib" path="/home/stephen/cytoscape/lib/glf.jar"/>
+       <classpathentry kind="lib" path="/home/stephen/cytoscape/lib/http.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/i4jruntime.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/itext-2.0.4.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/jaxb-api.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/jaxb-impl.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/jaxws-api.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/jaxws-rt.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/jaxws-tools.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/jdom-1.0.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/jhall.jar"/>
+       <classpathentry kind="lib" path="/home/stephen/cytoscape/lib/jnlp.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/jsr173_1.0_api.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/jsr181-api.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/jsr250-api.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/junit.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/l2fprod-common-all.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/looks-2.1.4.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/phoebe.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/piccolo.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/resolver.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/saaj-api.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/saaj-impl.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/sjsxp.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/stax-ex.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/streambuffer.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/swing-layout-1.0.1.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/swingx-2006_10_27.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/tclib.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/undo.support.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/violinstrings-1.0.2.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/wizard.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/batik-awt-util.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/batik-bridge.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/batik-css.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/batik-dom.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/batik-ext.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/batik-gvt.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/batik-parser.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/batik-rasterizer.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/batik-rasterizerTask.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/batik-script.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/batik-svg-dom.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/batik-transcoder.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/batik-util.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/batik-xml.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/jakarta-regexp-1.4.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/jaxb-libs.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/jaxb-xjc.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/jfcunit.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/relaxngDatatype.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/swingunit.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/xalan.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/xercesImpl-jwsdp.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/xsdlib.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/jalopy/jalopy.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/jalopy/jalopy-ant.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/lib/build-libs/jalopy/log4j.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/cytoscape.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/extra-jars/colt.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/extra-jars/coltginy.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/extra-jars/jfreechart-0.9.20.jar"/>
+       <classpathentry kind="lib" 
path="/home/stephen/cytoscape/extra-jars/jfreechart-common-0.9.5.jar"/>
+       <classpathentry kind="output" path=""/>
+</classpath>

Added: csplugins/trunk/soc/sfederow/CyAnimator/.project
===================================================================
--- csplugins/trunk/soc/sfederow/CyAnimator/.project                            
(rev 0)
+++ csplugins/trunk/soc/sfederow/CyAnimator/.project    2009-06-12 03:16:49 UTC 
(rev 16941)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>CyAnimator</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>

Added: csplugins/trunk/soc/sfederow/CyAnimator/build.xml
===================================================================
--- csplugins/trunk/soc/sfederow/CyAnimator/build.xml                           
(rev 0)
+++ csplugins/trunk/soc/sfederow/CyAnimator/build.xml   2009-06-12 03:16:49 UTC 
(rev 16941)
@@ -0,0 +1,107 @@
+<?xml version="1.0"?>
+<!-- build.xml - Build file for Sample Cytoscape Plugin -->
+<project name="CyAnimator" default="jar" basedir=".">
+       
+       <!-- Name of Plug In -->
+       <!-- Change this to the name of your Plug In -->
+       <!-- The name is used to create the plugin JAR file -->
+       <property name="plugin.name" value="CyAnimator"/>
+
+       <!-- The directory containing source code -->
+       <property name="src.dir" value="src"/>
+
+       <!--  The directory containing library jar files -->    
+       <property name="cytoroot.dir" value="../cytoscape"/>
+       
+       
+       <property name="release.dir" value="../cytoscape"/>
+
+       <property name="lib.dir" value = "../cytoscape/lib"/>
+       
+       <!-- Temporary build directories -->
+
+       <property name="build.dir" value="build"/>
+       <property name="build.classes" value="${build.dir}/classes"/>
+
+       <property name="doc.dir" value="doc"/> 
+       <property name="pluginlib.dir" value="lib"/>
+       <property name="plugindata.dir" value="data"/>
+
+       <!-- Global "magic" property for <javac> -->
+       <property name="build.compiler" value="modern"/>
+       
+       <!-- Classpath with all lib JAR Files and all Cytoscape Core classes -->
+       <path id="classpath">
+               
+               <fileset dir="${lib.dir}">
+                       <include name="*.jar"/>
+               </fileset>
+               
+               <!-- include cytoscape.jar, which is it release directory top 
level -->
+               <fileset dir="${release.dir}">
+                       <include name="*.jar"/>
+               </fileset>
+               
+               <fileset dir="${pluginlib.dir}">
+                       <include name="*.jar"/>
+               </fileset>
+
+       </path>
+
+       <!-- Target to create the build directories prior to compilation -->
+       <target name="prepare">
+               <mkdir dir="${build.dir}"/>
+               <mkdir dir="${build.classes}"/>
+        <!-- copy over images -->
+       
+               <!-- <mkdir dir="${dist.dir}"/> -->
+               <!-- <mkdir dir="${doc.dir}"/> -->
+       </target>
+
+       <!--  Target to clean out all directories -->
+       <target name="clean" description="Removes all generated files.">
+               <delete dir="${build.dir}"/>
+               <delete dir="${dist.dir}"/>
+       </target>
+       
+       <!-- Target to create Cytoscape Jar File  -->
+       <target name="build_cytoscape">
+               <ant antfile="${cytoroot.dir}/cytoscape/build.xml" 
inheritAll="false" target="jar"/>
+       </target>
+
+ <!--       Target to create the javadoc information -->
+     <target name="doc" depends="prepare"> 
+          <echo>${src.dir}</echo> 
+          <javadoc destdir="${doc.dir}" Private="yes"> 
+            <fileset dir="${src.dir}" defaultexcludes="no"/> 
+          </javadoc> 
+       </target>
+
+        
+       <!--  Target to compile all Plug In Code -->
+       <target name="compile" depends="prepare" 
+               description="Compiles all PlugIn source code.">
+                <javac debug="Yes" srcdir="${src.dir}" 
destdir="${build.classes}">
+                       <classpath refid="classpath"/>
+               </javac>
+
+       </target>
+       
+       <!--  Create PlugIn Jar File (Unobfuscated) -->
+       <target name="jar" depends="compile" description="Creates PlugIn Jar 
File.">
+
+        <unjar dest="${build.classes}">
+         <fileset dir="${pluginlib.dir}"/>
+        </unjar>
+
+
+      <jar destfile="${build.dir}/${plugin.name}.jar">
+        <fileset dir="${build.classes}"/>
+        </jar>
+                
+               <echo message="${plugin.name}.jar is now complete.  It is 
located in build/ directory"/>
+
+               <copy file="${build.dir}/${plugin.name}.jar" 
todir="../cytoscape/plugins/core/"/>
+       </target>
+
+</project>

Added: csplugins/trunk/soc/sfederow/CyAnimator/src/CyAnimator.java
===================================================================
--- csplugins/trunk/soc/sfederow/CyAnimator/src/CyAnimator.java                 
        (rev 0)
+++ csplugins/trunk/soc/sfederow/CyAnimator/src/CyAnimator.java 2009-06-12 
03:16:49 UTC (rev 16941)
@@ -0,0 +1,48 @@
+package src;
+
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.*;
+
+
+import cytoscape.Cytoscape;
+import cytoscape.plugin.CytoscapePlugin;
+
+public class CyAnimator extends CytoscapePlugin {
+
+       /**
+        * @param args
+        */
+       public CyAnimator() {
+               
+               JMenuItem item = new JMenuItem("CyAnimator");
+               
+               item.addActionListener(new CyAnimatorCommandListener());
+               
+               JMenu pluginMenu = 
Cytoscape.getDesktop().getCyMenus().getMenuBar().getMenu("Plugins");
+               
+               pluginMenu.add(item);
+               
+               
+       }
+
+       class CyAnimatorCommandListener implements ActionListener {
+               //BooleanAlgorithm alg = null;
+
+               public CyAnimatorCommandListener() {
+                       //this.alg = algorithm;
+               }
+
+               public void actionPerformed(ActionEvent e) {
+                       //if (alg != null) {
+                               // Create the dialog
+                               CyAnimatorDialog  animationDialog = new 
CyAnimatorDialog();
+                               // Pop it up
+                               animationDialog.actionPerformed(e);
+                       //} 
+               }
+       }
+}

Added: csplugins/trunk/soc/sfederow/CyAnimator/src/CyAnimatorDialog.java
===================================================================
--- csplugins/trunk/soc/sfederow/CyAnimator/src/CyAnimatorDialog.java           
                (rev 0)
+++ csplugins/trunk/soc/sfederow/CyAnimator/src/CyAnimatorDialog.java   
2009-06-12 03:16:49 UTC (rev 16941)
@@ -0,0 +1,238 @@
+package src;
+
+import giny.model.Node;
+import giny.view.*;
+
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JOptionPane;
+import javax.swing.Timer;
+
+import javax.swing.border.Border;
+import javax.swing.border.EtchedBorder;
+import javax.swing.border.TitledBorder;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+
+import java.sql.Time;
+
+import cytoscape.Cytoscape;
+import cytoscape.CyNetwork;
+import cytoscape.CyNode;
+import cytoscape.view.*;
+
+
+import cytoscape.data.CyAttributes;
+import cytoscape.view.CyNetworkView;
+import cytoscape.data.CyAttributes;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.Color;
+import java.awt.Paint;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.beans.PropertyChangeEvent;
+import java.util.*;
+
+public class CyAnimatorDialog extends JDialog implements ActionListener, 
java.beans.PropertyChangeListener {
+
+       
+       
+       private JPanel mainPanel;
+       private JButton captureFrameOne;
+       private JButton captureFrameTwo;
+       private JButton animateBetween;
+       private JButton returnFrame;
+       
+       //private NodeView[] currentFrame;
+       private HashMap<String, double[]> posFrame;
+       private HashMap<String, Paint> colFrame;
+       private CyFrame frameOne;
+       private CyFrame frameTwo;
+       
+       //private CyFrame[]
+       
+                       
+       public CyAnimatorDialog()
+       {
+               
Cytoscape.getSwingPropertyChangeSupport().addPropertyChangeListener(this);
+           //add as listener to CytoscapeDesktop
+           
Cytoscape.getDesktop().getSwingPropertyChangeSupport().addPropertyChangeListener(this);
+               
+           
+           
+               initialize();
+       }
+       
+       public void initialize()
+       {
+       
+               mainPanel = new JPanel();
+               
+               captureFrameOne = new JButton("Capture Frame One");
+               captureFrameOne.addActionListener(this);
+               captureFrameOne.setActionCommand("captureOne");
+               
+               captureFrameTwo = new JButton("Capture Frame Two");
+               captureFrameTwo.addActionListener(this);
+               captureFrameTwo.setActionCommand("captureTwo");
+               
+               animateBetween = new JButton("Animate From One to Two");
+               animateBetween.addActionListener(this);
+               animateBetween.setActionCommand("animateOneTwo");
+               
+               returnFrame = new JButton("Return To Frame One");
+               returnFrame.addActionListener(this);
+               returnFrame.setActionCommand("returnOne");
+               
+               mainPanel.add(captureFrameOne);
+               mainPanel.add(captureFrameTwo);
+               mainPanel.add(animateBetween);
+               mainPanel.add(returnFrame);
+               this.setSize(new Dimension(200,180));
+               setContentPane(mainPanel);
+               System.out.println("hey");
+               
+       }
+       
+       
+       public void actionPerformed(ActionEvent e)
+       {       
+               String command = e.getActionCommand();
+               
+               if(command.equals("captureOne"))
+               {
+                       frameOne = captureSettings();
+                       
+               }
+               
+               if(command.equals("captureTwo"))
+               {
+                       frameTwo = captureSettings();
+                       
+               }
+               
+               if(command.equals("animateOneTwo")){
+                       
+                       LinearInterpolator lint = new LinearInterpolator();
+                       CyFrame[] frames = 
lint.generateInterpolatedFrames(frameOne, frameTwo, 10);
+                   
+                       //Time animationTime = new Time(5000);
+                       
+                        int delay = 1000; //milliseconds
+                         ActionListener taskPerformer = new ActionListener() {
+                                 LinearInterpolator lint = new 
LinearInterpolator();
+                                       CyFrame[] frames = 
lint.generateInterpolatedFrames(frameOne, frameTwo, 10);
+                                   int i = 0;
+                                 
+                                 public void actionPerformed(ActionEvent evt) {
+                                 if(i == frames.length){ return;}
+                                         frames[i].display();
+                                 i++;
+                             }
+                         };
+                         
+                         new Timer(delay, taskPerformer).start();
+                       
+                         
+                         
+              for(int i=0; i<frames.length; i++){
+                       
+                       
+               }
+               }
+               
+               if(command.equals("returnOne"))
+               {
+                       frameOne.display();
+               }
+               setVisible(true);
+               
+       }
+       
+       public CyFrame captureSettings()
+       {
+               
+               
+               CyNetwork currentNetwork = Cytoscape.getCurrentNetwork();
+               CyFrame frame = new CyFrame(currentNetwork);
+               
+               
+               //List<Node> nodeList = currentNetwork.nodesList();
+               
+               CyNetworkView networkView = Cytoscape.getCurrentNetworkView();
+               
+               frame.populate(networkView);
+               
+               return frame;
+               
+               /*
+               currentFrame = new NodeView[nodeList.size()];
+               posFrame = new HashMap<String, double[]>();
+               colFrame = new HashMap<String, Paint>();
+               for(int i=0;i<nodeList.size();i++)
+               {
+                  
+                  NodeView nodeView = networkView.getNodeView(nodeList.get(i));
+                  currentFrame[i] = nodeView;
+                  double[] xy = new double[2];
+                  xy[0] = nodeView.getXPosition();
+                  xy[1] = nodeView.getYPosition();
+                  posFrame.put(nodeList.get(i).getIdentifier(), xy);
+                  colFrame.put(nodeList.get(i).getIdentifier(), 
nodeView.getUnselectedPaint());
+                  System.out.println(nodeView.getUnselectedPaint()+"    X: 
"+nodeView.getXPosition()+"    Y: "+nodeView.getYPosition());
+                  
+               }
+               */
+       }
+       
+       public void displayCurrentFrame()
+       {
+               //currentFrame.display();
+               
+               /*
+               System.out.println("WOOOO");
+               CyNetwork currentNetwork = Cytoscape.getCurrentNetwork();
+               CyNetworkView networkView = Cytoscape.getCurrentNetworkView();
+               List<Node> nodeList = currentNetwork.nodesList();
+               for(int i=0;i<nodeList.size();i++)
+        {
+                       
+                       NodeView nodeView = 
networkView.getNodeView(nodeList.get(i));
+                       double[] xy = 
posFrame.get(nodeList.get(i).getIdentifier());
+                       Paint p = colFrame.get(nodeList.get(i).getIdentifier());
+                       
+                       nodeView.setXPosition(xy[0]);
+                       nodeView.setYPosition(xy[1]);
+                       
+                       nodeView.setUnselectedPaint(p);
+                       //nodeView.setXPosition(currentFrame[i].getXPosition());
+                       //nodeView.setYPosition(currentFrame[i].getYPosition());
+                       
+                       
+                       
//nodeView.setXPosition(cframe.get(nodeList.get(i).getIdentifier()));
+                       
//nodeView.setYPosition(cframe.get(nodeList.get(i).getIdentifier()));
+          
+        }
+               networkView.updateView();
+               */
+       }
+       
+       public void propertyChange ( PropertyChangeEvent e ) {
+               if(e.getPropertyName().equals("ATTRIBUTES_CHANGED")){
+                       initialize();
+                       setVisible(true);
+               }
+       }
+       
+       
+}

Added: csplugins/trunk/soc/sfederow/CyAnimator/src/CyFrame.java
===================================================================
--- csplugins/trunk/soc/sfederow/CyAnimator/src/CyFrame.java                    
        (rev 0)
+++ csplugins/trunk/soc/sfederow/CyAnimator/src/CyFrame.java    2009-06-12 
03:16:49 UTC (rev 16941)
@@ -0,0 +1,87 @@
+package src;
+
+import giny.model.Node;
+import giny.view.NodeView;
+
+import java.awt.Paint;
+import java.util.HashMap;
+import java.util.List;
+
+import cytoscape.Cytoscape;
+import cytoscape.CyNetwork;
+import cytoscape.view.CyNetworkView;
+
+public class CyFrame {
+       
+       HashMap<String, double[]> nodePosMap;
+       HashMap<String, Paint> nodeColMap;
+       CyNetworkView networkView = null;
+       CyNetwork currentNetwork = null;
+       List<Node> nodeList = null;
+       
+       public CyFrame(CyNetwork currentNetwork){
+               nodePosMap = new HashMap<String, double[]>();
+               nodeColMap = new HashMap<String, Paint>();
+               
+               this.currentNetwork = currentNetwork;
+               nodeList = currentNetwork.nodesList();
+               networkView = Cytoscape.getCurrentNetworkView();
+               
+       }
+       
+       //public CyFrame(CyNetwork currentNetwork, List<HashMap<String, 
double[]>> valuesList){
+               
+       //}
+       
+       
+       public void populate(CyNetworkView networkView){
+               
+               
+               for(int i=0;i<nodeList.size();i++)
+               {
+                  
+                  NodeView nodeView = networkView.getNodeView(nodeList.get(i));
+                  
+                  double[] xy = new double[2];
+                  xy[0] = nodeView.getXPosition();
+                  xy[1] = nodeView.getYPosition();
+                  
+                  nodePosMap.put(nodeList.get(i).getIdentifier(), xy);
+                  nodeColMap.put(nodeList.get(i).getIdentifier(), 
nodeView.getUnselectedPaint());
+                  System.out.println(nodeView.getUnselectedPaint()+"    X: 
"+nodeView.getXPosition()+"    Y: "+nodeView.getYPosition());
+                  
+               }
+       }
+       
+        
+       public void display(){
+               System.out.println("WOOOO");
+               CyNetwork currentNetwork = Cytoscape.getCurrentNetwork();
+               CyNetworkView networkView = Cytoscape.getCurrentNetworkView();
+               List<Node> nodeList = currentNetwork.nodesList();
+               for(int i=0;i<nodeList.size();i++)
+        {
+                       
+                       NodeView nodeView = 
networkView.getNodeView(nodeList.get(i));
+                       double[] xy = 
nodePosMap.get(nodeList.get(i).getIdentifier());
+                       Paint p = 
nodeColMap.get(nodeList.get(i).getIdentifier());
+                       
+                       System.out.println("DISPLAY: "+xy[0]+"  "+xy[1]);
+                       
+                       nodeView.setXPosition(xy[0]);
+                       nodeView.setYPosition(xy[1]);
+                               
+                       nodeView.setUnselectedPaint(p);
+                       //nodeView.setXPosition(currentFrame[i].getXPosition());
+                       //nodeView.setYPosition(currentFrame[i].getYPosition());
+                               
+                               
+                       
//nodeView.setXPosition(cframe.get(nodeList.get(i).getIdentifier()));
+                       
//nodeView.setYPosition(cframe.get(nodeList.get(i).getIdentifier()));
+                  
+        }
+               networkView.updateView();
+       }
+       
+       
+}
\ No newline at end of file

Added: csplugins/trunk/soc/sfederow/CyAnimator/src/LinearInterpolator.java
===================================================================
--- csplugins/trunk/soc/sfederow/CyAnimator/src/LinearInterpolator.java         
                (rev 0)
+++ csplugins/trunk/soc/sfederow/CyAnimator/src/LinearInterpolator.java 
2009-06-12 03:16:49 UTC (rev 16941)
@@ -0,0 +1,96 @@
+package src;
+
+import giny.model.Node;
+import giny.view.NodeView;
+
+import java.awt.Paint;
+import java.util.*;
+
+import cytoscape.CyNetwork;
+import cytoscape.Cytoscape;
+import cytoscape.view.CyNetworkView;
+
+
+public class LinearInterpolator {
+
+       
+       
+       
+       public LinearInterpolator(){
+       
+               
+               //generateInterpolatedFrames(one, two, 10);
+               
+               
+       }
+       
+       
+       public CyFrame[] generateInterpolatedFrames(CyFrame frameOne, CyFrame 
frameTwo, int framenum){
+               
+               
if(!frameOne.currentNetwork.getIdentifier().equals(frameTwo.currentNetwork.getIdentifier())){
+                       System.out.println("Frames Cannot be interpolated 
across different networks.");
+               }
+               
+               
+               CyNetwork currentNetwork = frameOne.currentNetwork;
+               
+               
+               CyFrame[] cyFrameArray = new CyFrame[framenum+2];
+               cyFrameArray[0] = frameOne;
+               cyFrameArray[framenum+1] = frameTwo;
+               for(int i=1; i<framenum+1; i++){
+                       cyFrameArray[i] = new CyFrame(currentNetwork);
+               }
+               
+               
+               
+               List<Node> nodeList = currentNetwork.nodesList();
+               
+               
+               
+                
+                       
+               for(int i=0; i<nodeList.size(); i++){
+                       
+                       double[] xy = new double[2];
+                       xy[0] = 0;
+                       xy[1] = 0;
+                       double[] xyOne = 
frameOne.nodePosMap.get(nodeList.get(i).getIdentifier());
+                   double[] xyTwo = 
frameTwo.nodePosMap.get(nodeList.get(i).getIdentifier());
+                                       
+                       double incrementLength = (xyTwo[0] - xyOne[0])/framenum;
+                               
+                       double[] xArray = new double[framenum];
+                       
+                       xArray[0] = xyOne[0] + incrementLength;
+                       
+                       for(int k=1; k<framenum; k++){
+                               xArray[k] = xArray[k-1] + incrementLength; 
+                           
+                               if((xyTwo[0] - xyOne[0]) == 0){
+                                       xy[1] = xyOne[1]; 
+                               }else{
+                                       xy[1] = xyOne[1] + ((xArray[k] - 
xyOne[0])*((xyTwo[1]-xyOne[1])/(xyTwo[0] - xyOne[0])));
+                               }
+                               
+                               
+                               xy[0] = xArray[k];
+                       
+                               
+                               System.out.println(nodeList.get(i)+"  "+xy[0]+" 
 "+xy[1]);
+                               
cyFrameArray[k].nodePosMap.put(nodeList.get(i).getIdentifier(), xy);
+                               Paint oldpaint = 
frameOne.nodeColMap.get(nodeList.get(i).getIdentifier());
+                               
cyFrameArray[k].nodeColMap.put(nodeList.get(i).getIdentifier(), oldpaint);
+                       
+                       }       
+                       
cyFrameArray[framenum].nodePosMap.put(nodeList.get(i).getIdentifier(), xy);
+                       Paint oldpaint = 
frameOne.nodeColMap.get(nodeList.get(i).getIdentifier());
+                       
cyFrameArray[framenum].nodeColMap.put(nodeList.get(i).getIdentifier(), 
oldpaint);
+       
+               }       
+               
+               return cyFrameArray;
+       }
+       
+       
+}


--~--~---------~--~----~------------~-------~--~----~
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