Author: sfederow
Date: 2009-07-29 20:15:33 -0700 (Wed, 29 Jul 2009)
New Revision: 17622
Modified:
csplugins/trunk/soc/sfederow/CyAnimator/src/CyAnimatorDialog.java
csplugins/trunk/soc/sfederow/CyAnimator/src/CyFrame.java
csplugins/trunk/soc/sfederow/CyAnimator/src/Interpolator.java
Log:
Modified: csplugins/trunk/soc/sfederow/CyAnimator/src/CyAnimatorDialog.java
===================================================================
--- csplugins/trunk/soc/sfederow/CyAnimator/src/CyAnimatorDialog.java
2009-07-30 00:13:55 UTC (rev 17621)
+++ csplugins/trunk/soc/sfederow/CyAnimator/src/CyAnimatorDialog.java
2009-07-30 03:15:33 UTC (rev 17622)
@@ -32,6 +32,7 @@
import javax.swing.event.ChangeEvent;
import java.awt.Image;
+
import javax.imageio.ImageIO;
import java.io.FileOutputStream;
import java.io.OutputStream;
@@ -52,9 +53,14 @@
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.FocusListener;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
import java.awt.event.MouseAdapter;
+import java.awt.event.MouseMotionAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
@@ -70,8 +76,15 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-public class CyAnimatorDialog extends JDialog implements ActionListener,
java.beans.PropertyChangeListener {
+import javax.swing.JButton;
+import javax.swing.Icon;
+import javax.swing.Action;
+import java.awt.Font;
+
+
+public class CyAnimatorDialog extends JDialog implements ActionListener,
java.beans.PropertyChangeListener, FocusListener {
+
private JButton captureButton;
@@ -86,9 +99,13 @@
private JPanel mainPanel;
private JPopupMenu thumbnailMenu;
private JSlider speedSlider;
- private ArrayList<JPopupMenu> menuList;
+
+ private ArrayList<JPopupMenu> menuList = new ArrayList<JPopupMenu>();
+ private ArrayList<JButton> thumbnailList = new ArrayList<JButton>();
+
private JScrollPane framePane = new JScrollPane();
private JPanel framePanel = new JPanel();
+ private DragAndDropManager dragnDrop = new DragAndDropManager();
private int fps = 10;
CyFrame[] frames = null;
@@ -101,19 +118,23 @@
//private CyFrame[]
private Timer timer;
+ boolean upFlag = true;
-
public CyAnimatorDialog(){
Cytoscape.getSwingPropertyChangeSupport().addPropertyChangeListener(this);
//add as listener to CytoscapeDesktop
Cytoscape.getDesktop().getSwingPropertyChangeSupport().addPropertyChangeListener(this);
+
+
initialize();
}
public void initialize(){
mainPanel = new JPanel();
+ mainPanel.addPropertyChangeListener(this);
+
BoxLayout mainbox = new BoxLayout(mainPanel, BoxLayout.Y_AXIS);
mainPanel.setLayout(mainbox);
@@ -139,6 +160,7 @@
pauseButton = new JButton(pauseIcon);
pauseButton.addActionListener(this);
pauseButton.setActionCommand("pause");
+ pauseButton.addPropertyChangeListener("Text", this);
ImageIcon forwardIcon = createImageIcon("fastForward.png",
"Step Forward Button");
forwardButton = new JButton(forwardIcon);
@@ -177,7 +199,12 @@
controlPanel.add(recordButton);
controlPanel.add(speedSlider);
+
+
+
mainPanel.add(controlPanel);
+
+ updateThumbnails();
mainPanel.add(framePane);
this.setSize(new Dimension(500,220));
@@ -200,11 +227,12 @@
if(command.equals("capture"))
{
- frameList.add(captureCurrentFrame());
+ frameList.add(captureCurrentFrame());
if(frameList.size() > 1){ makeTimer(); }
- //viewList.add(Cytoscape.getCurrentNetworkView());
+
+ //generateThumbnailList();
+ //generateMenuList();
updateThumbnails();
-
}
if(command.equals("play")){
@@ -225,6 +253,7 @@
if(command.equals("pause")){
if(timer == null){ return; }
timer.stop();
+ //updateThumbnails();
}
if(command.equals("step forward")){
@@ -255,6 +284,8 @@
}catch (Exception excp) {
System.out.println(excp.getMessage());
}
+ updateThumbnails();
+ makeTimer();
}
Pattern frameID = Pattern.compile(".*([0-9]+)$");
@@ -268,7 +299,9 @@
//System.out.println(Integer.parseInt(m.group(1)));
for(CyFrame frame: frameList){
if(frame.getID().equals(command)){//frameList.get(Integer.parseInt(m.group(1)));
- frame.display();
+ frameIndex =
Integer.parseInt(fMatch.group(1));
+ //frame.display();
+ //updateThumbnails();
}
}
}
@@ -307,6 +340,9 @@
}
for (CyFrame frame: remove)
frameList.remove(frame);
+
+ //generateThumbnailList();
+ //generateMenuList();
updateThumbnails();
}
@@ -345,68 +381,138 @@
timer = new Timer(delay, taskPerformer);
+ //updateThumbnails();
//timer.setDelay(delay);
//timer.start();
}
+/*
+ public void generateThumbnailList(){
+ MouseListener popupListener = new PopupListener();
+ thumbnailList.clear();
+
+ for(CyFrame frame: frameList){
+
+ ImageIcon ic = new ImageIcon(frame.getFrameImage());
+
+ JButton thumbnailButton = new JButton(ic);
+ thumbnailButton.addMouseListener(dragnDrop);
+ thumbnailButton.addMouseListener(popupListener);
+ thumbnailButton.addActionListener(this);
+ thumbnailButton.setActionCommand(frame.getID());
+
+ thumbnailList.add(thumbnailButton);
+ }
+ }
+
+ public void generateMenuList(){
+
+ MouseListener popupListener = new PopupListener();
+ menuList.clear();
+ JMenuItem menuItem = null;
+
+ for(CyFrame frame: frameList){
+ JPopupMenu thumbnailMenu = new JPopupMenu();
+ JMenu interpolateMenu = new JMenu("Interpolate");
+ menuItem = new JMenuItem("10 Frames");
+ menuItem.addActionListener(this);
+
menuItem.setActionCommand(frame.getID()+"interpolate10_");
+ interpolateMenu.add(menuItem);
+
+ menuItem = new JMenuItem("20 Frames");
+ menuItem.addActionListener(this);
+
menuItem.setActionCommand(frame.getID()+"interpolate20_");
+ interpolateMenu.add(menuItem);
+
+ menuItem = new JMenuItem("50 Frames");
+ menuItem.addActionListener(this);
+
menuItem.setActionCommand(frame.getID()+"interpolate50_");
+ interpolateMenu.add(menuItem);
+
+ menuItem = new JMenuItem("100 Frames");
+ menuItem.addActionListener(this);
+
menuItem.setActionCommand(frame.getID()+"interpolate100_");
+ interpolateMenu.add(menuItem);
+
+ menuItem = new JMenuItem("Custom...");
+ menuItem.addActionListener(this);
+
menuItem.setActionCommand(frame.getID()+"interpolate0_");
+ interpolateMenu.add(menuItem);
+
+ thumbnailMenu.add(interpolateMenu);
+
+ menuItem = new JMenuItem("Delete");
+ menuItem.addActionListener(this);
+ menuItem.setActionCommand(frame.getID()+"delete_");
+ menuItem.addMouseListener(popupListener);
+ //menuItem.set("delete_"+frame.getID());
+ thumbnailMenu.add(menuItem);
+ menuList.add(thumbnailMenu);
+
+ }
+ }
+*/
+
+ /*
+ * Takes the current frameList and cycles through it to create a JButton
+ * for each frame with the corresponding thumbnail image. It also
creates
+ * a JPopupMenu for each frame in the frameList so that the right click
controls
+ * for interpolate and delete can be tied to each JButton.
+ *
+ */
public void updateThumbnails(){
+
mainPanel.remove(framePane);
framePanel = new JPanel();
-
+
BoxLayout box = new BoxLayout(framePanel, BoxLayout.X_AXIS);
framePanel.setLayout(box);
MouseListener popupListener = new PopupListener();
- //MouseListener mouseOver = new MouseOver();
- //Add listener to components that can bring up popup menus.
- //output.addMouseListener(popupListener);
- //menuBar.addMouseListener(popupListener);
-
- /*
- java.net.URL leftIconURL =
CyAnimatorDialog.class.getResource("leftArrow.png");
- java.net.URL rightIconURL =
CyAnimatorDialog.class.getResource("rightArrow.png");
-
- ImageIcon leftIcon = new ImageIcon();
- if (leftIconURL != null) {
- leftIcon = new ImageIcon(leftIconURL);
- }
-
- ImageIcon rightIcon = new ImageIcon();
- if (rightIconURL != null) {
- rightIcon = new ImageIcon(rightIconURL);
- }
-
- JButton leftArrow = new JButton(leftIcon);
- //leftArrow.setIcon(leftIcon);
- //leftArrow.setSize(new Dimension(200,200));
- framePanel.add(leftArrow);
- JButton rightArrow = new JButton(rightIcon);
- //rightArrow.setIcon(rightIcon);
- //rightArrow.setSize(new Dimension(200,200));
- */
-
- menuList = new ArrayList<JPopupMenu>();
+
+ //menuList = new ArrayList<JPopupMenu>();
//mainPanel.remove(framePanel);
int i = 0;
- int totalFrameLength = 0;
- DragAndDropManager dragnDrop = new
DragAndDropManager(frameList.size());
-
-
+ int totalFrameWidth = 0;
+ //dragnDrop = new DragAndDropManager();
+ dragnDrop.setFrameCount(frameList.size());
+ //dragnDrop.setFrameCount(thumbnailList.size());
+ /*
+ for(JButton button: thumbnailList){
+
+ Icon ic = button.getIcon();
+ totalFrameWidth = totalFrameWidth + ic.getIconWidth();
+ dragnDrop.setFrameHeight(ic.getIconHeight());
+ button.setName(i+"");
+ i++;
+
+ System.out.println(totalFrameWidth);
+ framePanel.add(button);
+ }
+ */
for(CyFrame frame: frameList){
//for(CyNetworkView view: viewList){
ImageIcon ic = new ImageIcon(frame.getFrameImage());
- JButton lab = new JButton(ic);
- lab.addActionListener(this);
- lab.setActionCommand(frame.getID());
- //lab.setIcon(ic);
- System.out.println(lab.getWidth());
- totalFrameLength = totalFrameLength + lab.getWidth();
+ JButton thumbnailButton = new JButton(ic);
+ thumbnailButton.addMouseListener(dragnDrop);
+ thumbnailButton.addActionListener(this);
+ thumbnailButton.setActionCommand(frame.getID());
+
+
+ //System.out.println(ic.getIconWidth());
+
+ //for some reason thumbnailButton.getWidth() returns 0 so I
had
+ //to improvise and use the icon width plus 13 pixels
for the border.
+ totalFrameWidth = totalFrameWidth + ic.getIconWidth() +
13;
+ dragnDrop.setFrameHeight(ic.getIconHeight());
+
+
thumbnailMenu = new JPopupMenu();
JMenu interpolateMenu = new JMenu("Interpolate");
menuItem = new JMenuItem("10 Frames");
@@ -444,20 +550,25 @@
thumbnailMenu.add(menuItem);
menuList.add(thumbnailMenu);
- //MouseListener
- lab.addMouseListener(dragnDrop); //mouseOver);
- lab.setName(i+"");
+
+ //mouseOver);
+ //thumbnailButton.addMouseListener(new
releaseListener());
+ //thumbnailButton.addPropertyChangeListener(this);
+
+ thumbnailButton.setName(i+"");
i++;
- lab.addMouseListener(popupListener);
- framePanel.add(lab);
-
+ thumbnailButton.addMouseListener(popupListener);
+ framePanel.add(thumbnailButton);
+
}
- dragnDrop.setFrameLength(totalFrameLength);
- //framePanel.add(rightArrow);
- //initialize();
+
+
+ dragnDrop.setFrameWidth(totalFrameWidth);
+
framePane = new JScrollPane(framePanel);
+
mainPanel.add(framePane);
- //setContentPane(mainPanel);
+
}
@@ -465,7 +576,6 @@
public CyFrame captureCurrentFrame(){
-
CyNetwork currentNetwork = Cytoscape.getCurrentNetwork();
CyFrame frame = new CyFrame(currentNetwork);
@@ -500,11 +610,24 @@
public void propertyChange ( PropertyChangeEvent e ) {
if(e.getPropertyName().equals("ATTRIBUTES_CHANGED")){
- initialize();
+ //initialize();
setVisible(true);
}
+ //System.out.println("RRRRRRRRRRRr"+e.getPropertyName());
+ //updateThumbnails();
+ if(e.getPropertyName().equals("pause")){
+ System.out.println("hhhh");
+ updateThumbnails();
+ }
}
+ public void focusGained(FocusEvent e){
+ updateThumbnails();
+ }
+
+ public void focusLost(FocusEvent e){
+
+ }
class SliderListener implements ChangeListener {
public void stateChanged(ChangeEvent e) {
JSlider source = (JSlider)e.getSource();
@@ -518,49 +641,167 @@
}
}
- class DragAndDropManager extends MouseAdapter implements MouseListener{
- int frameCount = 0;
- int totalFrameLength = 0;
+ /*
+ * Contains all of the code for managing mouse selections in relation
to the drag and drop features.
+ *
+ *
+ */
+ public class DragAndDropManager extends MouseMotionAdapter implements
MouseListener, MouseMotionListener{
+ private int frameCount = 0;
+ private int totalFrameWidth = 0;
+ private int frameWidth = 0;
+ private int frameHeight = 0;
+ private int currFrameIndex = 0;
+ private Component clickedComponent;
+ private int startX = 0;
+ private int startY = 0;
+ private int endX = 0;
+ private int endY = 0;
+ public DragAndDropManager(){}
- public DragAndDropManager(int frameCount){
- this.frameCount = frameCount;
+ public void mousePressed(MouseEvent e) {
+
+ //get starting point of the drag and drop
+ startX = e.getX();
+ startY = e.getY();
+
+ this.currFrameIndex =
Integer.parseInt(e.getComponent().getName());
}
- public void mousePressed(MouseEvent e) {
+ public void mouseReleased(MouseEvent e) {
- }
+ //get ending point of the drag and drop
+ endX = e.getX();
+ endY = e.getY();
+
+ //check to make sure the drag and drop is within 1.5
times the height
+ //of the frame in either direction of the y coordinate
+ if(endY >= 0 && endY < frameHeight*1.5){
+ System.out.println("here");
+ }
+ else{
+ if(endY < 0 && endY > frameHeight*-1.5){}
+ else{ return; }
+ }
+ int curr = currFrameIndex;
//Integer.parseInt(clickedComponent.getName());
+
+ //align the start position to the right or leftmost
point of the clicked frame
+ //based upon whether it is a forward or backwards drag
respectively.
+ int xgap = endX - startX;
+ if(xgap >= 0){ xgap = xgap - (frameWidth - startX); }
+ else{ xgap = xgap + (frameWidth - startX); }
+
+ //divide xgap by framewidth to determine the number of
frame positions which should be shifted
+ double shiftCount = xgap/frameWidth;
+ //round this same number
+ int shiftInt = Math.round(xgap/frameWidth);
+
+ //compare the raw number to the rounded number to see
if it was rounded up or down
+ //if it is rounded up then subtract 1 from the shift
count
+ if(shiftInt > shiftCount){
+ shuffleList(curr, curr+shiftInt-1);
+ }else{
+ shuffleList(curr, curr+shiftInt);
+ }
- public void mouseReleased(MouseEvent e) {
- System.out.println(e.paramString());
+ System.out.println("release X: "+e.getX()+" Y:
"+e.getY());
+ }
+
+ public void mouseDragged(MouseEvent e) {
+ System.out.println("hey");
+
}
+
+
+ /*
+ * Shuffles the list by inserting the frame which was clicked
(curr) into
+ * the position where the user released the mouse which is the
insert
+ * position.
+ *
+ * @param curr is the index of the frame that was clicked by
the user
+ * @param insertPos is the index in the frame list where the
frame will be inserted
+ */
+ public void shuffleList(int curr, int insertPos){
+
+ ArrayList<CyFrame> temp = new ArrayList<CyFrame>();
+
+ for(int i=0; i<frameList.size(); i++){
+
+
+ if(i == insertPos){
+ temp.add(frameList.get(curr));
+ continue;
+ }
+
+
+ if(i >= curr && curr < insertPos && i <
insertPos && i < frameList.size()-1){
+ temp.add(frameList.get(i+1));
+ continue;
+ }else{
+ if(i <= curr && curr > insertPos && i >
insertPos){
+ temp.add(frameList.get(i-1));
+ continue;
+ }
+ }
- public void mouseEntered(MouseEvent e) {
- //e.getComponent().
- //System.out.println(e.paramString());
+ temp.add(frameList.get(i));
+
+ }
+
+
+ frameList = temp;
+
+ //This is where I feel like updateThumbnails() should
go, however when this is done it freezes
+ //until another button is pressed (i.e. Add Frame,
pause, etc..) at which point the thumbnails update.
+
+ //updateThumbnails();
}
- public void mouseExited(MouseEvent e) {
- //saySomething("Mouse exited", e);
+ public void mouseEntered(MouseEvent e) {
+ //e.getComponent().requestFocus();
+
}
+ public void mouseExited(MouseEvent e) { }
+
public void mouseClicked(MouseEvent e) {
- //saySomething("Mouse clicked (# of clicks: "
- //+ e.getClickCount() + ")", e);
- System.out.println(e.getComponent().getName());
- System.out.println("Frame Count: "+frameCount+" Frame
Length: "+totalFrameLength);
+
+ this.currFrameIndex =
Integer.parseInt(e.getComponent().getName());
+ frameList.get(currFrameIndex).display();
+
}
/*
- * set the total length(in pixels) of all of the frames combined
+ * Sets the number of frames which is the number of thumbnail
buttons
*
- * @param the total frame length
+ * @param number of frames before interpolation
*/
- public void setFrameLength(int frameLength){
- this.totalFrameLength = frameLength;
+ public void setFrameCount(int frameCount){
+ this.frameCount = frameCount;
}
+ /*
+ * set the total width(in pixels) of all of the frames combined
+ *
+ * @param the total frame width
+ */
+ public void setFrameWidth(int totalFrameWidth){
+ this.totalFrameWidth = totalFrameWidth;
+ if(frameCount == 0){ frameWidth = 0; return; }
+ frameWidth = totalFrameWidth/frameCount;
+ }
+ /*
+ * set the frame height
+ *
+ * @param frame height
+ */
+ public void setFrameHeight(int frameHeight){
+ this.frameHeight = frameHeight;
+ }
+
+
}
@@ -571,7 +812,8 @@
}
public void mouseReleased(MouseEvent e) {
- maybeShowPopup(e);
+
+ maybeShowPopup(e);
}
private void maybeShowPopup(MouseEvent e) {
@@ -587,6 +829,8 @@
}
}
+
+
protected ImageIcon createImageIcon(String path, String description) {
java.net.URL imgURL = getClass().getResource(path);
if (imgURL != null) {
Modified: csplugins/trunk/soc/sfederow/CyAnimator/src/CyFrame.java
===================================================================
--- csplugins/trunk/soc/sfederow/CyAnimator/src/CyFrame.java 2009-07-30
00:13:55 UTC (rev 17621)
+++ csplugins/trunk/soc/sfederow/CyAnimator/src/CyFrame.java 2009-07-30
03:15:33 UTC (rev 17622)
@@ -1,10 +1,26 @@
package CyAnimator;
+
+import cytoscape.*;
+
+import cytoscape.layout.*;
+
+import cytoscape.visual.*;
+
+import ding.view.EdgeContextMenuListener;
+
+import ding.view.NodeContextMenuListener;
+
+import giny.view.*;
+
+import java.util.*;
+
import giny.model.Node;
import giny.view.NodeView;
import giny.model.Edge;
import giny.view.EdgeView;
+import java.awt.geom.Point2D;
import java.awt.Graphics2D;
import java.awt.Color;
import java.awt.Image;
@@ -22,6 +38,8 @@
import cytoscape.view.InternalFrameComponent;
import cytoscape.visual.VisualStyle;
+import ding.view.DGraphView;
+
public class CyFrame {
private String frameid = "";
@@ -48,6 +66,8 @@
private List<Node> nodeList = null;
private List<Edge> edgeList = null;
private int intercount = 0;
+ private Point2D centerPoint = null;
+ private DGraphView dview = null;
public CyFrame(CyNetwork currentNetwork){
nodePosMap = new HashMap<String, double[]>();
@@ -59,7 +79,9 @@
edgeColMap = new HashMap<String, Color>();
this.currentNetwork = currentNetwork;
networkView = Cytoscape.getCurrentNetworkView();
-
+ this.dview = (DGraphView)networkView;
+ this.centerPoint = dview.getCenter();
+
// Initialize our node view maps
Iterator<EdgeView> eviter = networkView.getEdgeViewsIterator();
while(eviter.hasNext()) {
@@ -82,6 +104,8 @@
// Get our initial edgeList
edgeList = currentNetwork.edgesList();
+
+
}
public void setNodeList(List<Node>nodeList) {
@@ -102,6 +126,8 @@
xalign = networkView.getComponent().getAlignmentX();
yalign = networkView.getComponent().getAlignmentY();
+ dview = (DGraphView)networkView;
+
for(Node node: nodeList)
{
@@ -111,7 +137,7 @@
double[] xy = new double[2];
xy[0] = nodeView.getXPosition();
xy[1] = nodeView.getYPosition();
-
+ centerPoint = dview.getCenter();
nodePosMap.put(node.getIdentifier(), xy);
Color nodeColor = (Color)nodeView.getUnselectedPaint();
Integer trans = nodeColor.getAlpha();
@@ -233,7 +259,14 @@
networkView.setBackgroundPaint(backgroundPaint);
networkView.setZoom(zoom);
//networkView.getComponent().
+ dview = (DGraphView)networkView;
+ //InternalFrameComponent ifc =
Cytoscape.getDesktop().getNetworkViewManager().getInternalFrameComponent(networkView);
+
+ dview.setCenter(centerPoint.getX(), centerPoint.getY());
+
+ //dview.setBounds(x, y, Math.round(ifc.getWidth()),
Math.round(ifc.getHeight()));
+ //ifc.setBounds(arg0, arg1, arg2, arg3)
networkView.updateView();
}
/*
@@ -442,7 +475,24 @@
return this.networkImage;
}
+ /*
+ * Get the center point for the frame
+ *
+ * @return the center for this frame
+ */
+ public Point2D getCenterPoint() {
+ return this.centerPoint;
+ }
+ /*
+ * Set the center point of the frame
+ *
+ * @param center point for a frame
+ */
+ public void setCenterPoint(Point2D pnt) {
+ this.centerPoint = pnt;
+ }
+
// At some point, need to pull the information from nv
// and map it to the new nv.
private void addNodeView(CyNetworkView view, NodeView nv, Node node) {
Modified: csplugins/trunk/soc/sfederow/CyAnimator/src/Interpolator.java
===================================================================
--- csplugins/trunk/soc/sfederow/CyAnimator/src/Interpolator.java
2009-07-30 00:13:55 UTC (rev 17621)
+++ csplugins/trunk/soc/sfederow/CyAnimator/src/Interpolator.java
2009-07-30 03:15:33 UTC (rev 17622)
@@ -7,6 +7,7 @@
import java.awt.Color;
import java.awt.Paint;
+import java.awt.geom.Point2D;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -33,7 +34,7 @@
networkInterpolators.add(new interpolateNetworkZoom());
networkInterpolators.add(new interpolateNetworkColor());
- //networkInterpolators.add(new interpolateNetworkPosition());
+ networkInterpolators.add(new interpolateNetworkCenter());
//generateInterpolatedFrames(one, two, 10);
}
@@ -529,5 +530,48 @@
}
return cyFrameArray;
}
- }
+ }
+
+ class interpolateNetworkCenter implements FrameInterpolator {
+
+ public interpolateNetworkCenter(){}
+
+ public CyFrame[] interpolate(List valueList, CyFrame frameOne,
CyFrame frameTwo,
+ int start, int stop, CyFrame[] cyFrameArray){
+
+ int framenum = (stop-start) - 1;
+
+ double xone = frameOne.getCenterPoint().getX();
+ double yone = frameOne.getCenterPoint().getY();
+
+ double xtwo = frameTwo.getCenterPoint().getX();
+ double ytwo = frameTwo.getCenterPoint().getY();
+
+ double incrementLength = (xtwo - xone)/framenum;
+ double[] xArray = new double[framenum+2];
+ xArray[1] = xone;
+
+ for(int k=1; k<framenum+1; k++){
+
+ Point2D xy = new Point2D.Double(0, 0);
+
+ xArray[k+1] = xArray[k] + incrementLength;
+ //xy.setLocation(xArray[k], arg1)[0] =
xArray[k];
+
+ //Do the position interpolation
+ if((xtwo - xone) == 0){
+ xy.setLocation(xArray[k], yone);
+ }else{
+
+ double y = yone + ((xArray[k] -
xone)*((ytwo-yone)/(xtwo -xone)));
+ xy.setLocation(xArray[k], y);
+ }
+
+ cyFrameArray[start+k].setCenterPoint(xy);
+ }
+
+ 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
-~----------~----~----~----~------~----~------~--~---