X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FRotatableCanvas.java;h=615b4034e340caf928e8f338bb58db18994e4c99;hb=37651a9d177de05ff938276071c16ba95ac44c73;hp=4241c5fe884393497597289191b69cab22ddab03;hpb=be32c14cd8e48fe0a207cd7030cb9cd46f894678;p=jalview.git diff --git a/src/jalview/gui/RotatableCanvas.java b/src/jalview/gui/RotatableCanvas.java index 4241c5f..615b403 100755 --- a/src/jalview/gui/RotatableCanvas.java +++ b/src/jalview/gui/RotatableCanvas.java @@ -20,43 +20,52 @@ */ package jalview.gui; -import java.util.*; -import java.awt.*; -import java.awt.event.*; - -import javax.swing.*; - import jalview.api.RotatableCanvasI; -import jalview.datamodel.*; -import jalview.math.*; +import jalview.datamodel.Point; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; +import jalview.datamodel.SequencePoint; +import jalview.math.RotatableMatrix; +import jalview.math.RotatableMatrix.Axis; +import jalview.util.ColorUtils; import jalview.util.MessageManager; import jalview.viewmodel.AlignmentViewport; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.RenderingHints; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.awt.event.MouseWheelEvent; +import java.awt.event.MouseWheelListener; +import java.util.Vector; + +import javax.swing.JPanel; +import javax.swing.ToolTipManager; + /** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ + * Models a Panel on which a set of points, and optionally x/y/z axes, can be + * drawn, and rotated or zoomed with the mouse */ public class RotatableCanvas extends JPanel implements MouseListener, MouseMotionListener, KeyListener, RotatableCanvasI { - RotatableMatrix idmat = new RotatableMatrix(3, 3); - - RotatableMatrix objmat = new RotatableMatrix(3, 3); - - RotatableMatrix rotmat = new RotatableMatrix(3, 3); + private static final int DIMS = 3; // RubberbandRectangle rubberband; boolean drawAxes = true; - int omx = 0; - - int mx = 0; + int mouseX = 0; - int omy = 0; - - int my = 0; + int mouseY = 0; Image img; @@ -64,13 +73,13 @@ public class RotatableCanvas extends JPanel implements MouseListener, Dimension prefsize; - float[] centre = new float[3]; + Point centre; - float[] width = new float[3]; + float[] width = new float[DIMS]; - float[] max = new float[3]; + float[] max = new float[DIMS]; - float[] min = new float[3]; + float[] min = new float[DIMS]; float maxwidth; @@ -78,11 +87,11 @@ public class RotatableCanvas extends JPanel implements MouseListener, int npoint; - Vector points; + Vector points; - float[][] orig; + Point[] orig; - float[][] axes; + Point[] axisEndPoints; int startx; @@ -112,24 +121,38 @@ public class RotatableCanvas extends JPanel implements MouseListener, boolean applyToAllViews = false; - // Controller controller; - public RotatableCanvas(AlignmentPanel ap) + boolean first = true; + + /** + * Constructor + * + * @param panel + */ + public RotatableCanvas(AlignmentPanel panel) { - this.av = ap.av; - this.ap = ap; + this.av = panel.av; + this.ap = panel; + axisEndPoints = new Point[DIMS]; addMouseWheelListener(new MouseWheelListener() { + @Override public void mouseWheelMoved(MouseWheelEvent e) { - if (e.getWheelRotation() > 0) + double wheelRotation = e.getPreciseWheelRotation(); + if (wheelRotation > 0) { + /* + * zoom in + */ scale = (float) (scale * 1.1); repaint(); } - - else + else if (wheelRotation < 0) { + /* + * zoom out + */ scale = (float) (scale * 0.9); repaint(); } @@ -138,15 +161,19 @@ public class RotatableCanvas extends JPanel implements MouseListener, } - public void showLabels(boolean b) + /** + * Refreshes the display with labels shown (or not) + * + * @param show + */ + public void showLabels(boolean show) { - showLabels = b; + showLabels = show; repaint(); } - boolean first = true; - - public void setPoints(Vector points, int npoint) + @Override + public void setPoints(Vector points, int npoint) { this.points = points; this.npoint = npoint; @@ -157,40 +184,15 @@ public class RotatableCanvas extends JPanel implements MouseListener, ToolTipManager.sharedInstance().setDismissDelay(10000); } prefsize = getPreferredSize(); - orig = new float[npoint][3]; + orig = new Point[npoint]; for (int i = 0; i < npoint; i++) { - SequencePoint sp = (SequencePoint) points.elementAt(i); - - for (int j = 0; j < 3; j++) - { - orig[i][j] = sp.coord[j]; - } + SequencePoint sp = points.elementAt(i); + orig[i] = sp.coord; } - // Initialize the matrices to identity - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 3; j++) - { - if (i != j) - { - idmat.addElement(i, j, 0); - objmat.addElement(i, j, 0); - rotmat.addElement(i, j, 0); - } - else - { - idmat.addElement(i, j, 0); - objmat.addElement(i, j, 0); - rotmat.addElement(i, j, 0); - } - } - } - - axes = new float[3][3]; - initAxes(); + resetAxes(); findCentre(); findWidth(); @@ -198,86 +200,56 @@ public class RotatableCanvas extends JPanel implements MouseListener, scale = findScale(); if (first) { - addMouseListener(this); - addMouseMotionListener(this); } first = false; } - public void initAxes() + /** + * Resets axes to the initial state: x-axis to the right, y-axis up, z-axis to + * back (so obscured in a 2-D display) + */ + protected void resetAxes() { - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 3; j++) - { - if (i != j) - { - axes[i][j] = 0; - } - else - { - axes[i][j] = 1; - } - } - } + axisEndPoints[0] = new Point(1f, 0f, 0f); + axisEndPoints[1] = new Point(0f, 1f, 0f); + axisEndPoints[2] = new Point(0f, 0f, 1f); } /** - * DOCUMENT ME! + * Computes and saves the maximum and minimum (x, y, z) positions of any + * sequence point, and also the min-max range (width) for each dimension, and + * the maximum width for all dimensions */ - public void findWidth() + protected void findWidth() { - max = new float[3]; - min = new float[3]; + max = new float[DIMS]; + min = new float[DIMS]; - max[0] = (float) -1e30; - max[1] = (float) -1e30; - max[2] = (float) -1e30; + max[0] = Float.MIN_VALUE; + max[1] = Float.MIN_VALUE; + max[2] = Float.MIN_VALUE; - min[0] = (float) 1e30; - min[1] = (float) 1e30; - min[2] = (float) 1e30; + min[0] = Float.MAX_VALUE; + min[1] = Float.MAX_VALUE; + min[2] = Float.MAX_VALUE; - for (int i = 0; i < 3; i++) + for (SequencePoint sp : points) { - for (int j = 0; j < npoint; j++) - { - SequencePoint sp = (SequencePoint) points.elementAt(j); - - if (sp.coord[i] >= max[i]) - { - max[i] = sp.coord[i]; - } - - if (sp.coord[i] <= min[i]) - { - min[i] = sp.coord[i]; - } - } + max[0] = Math.max(max[0], sp.coord.x); + max[1] = Math.max(max[1], sp.coord.y); + max[2] = Math.max(max[2], sp.coord.z); + min[0] = Math.min(min[0], sp.coord.x); + min[1] = Math.min(min[1], sp.coord.y); + min[2] = Math.min(min[2], sp.coord.z); } - // System.out.println("xmax " + max[0] + " min " + min[0]); - // System.out.println("ymax " + max[1] + " min " + min[1]); - // System.out.println("zmax " + max[2] + " min " + min[2]); width[0] = Math.abs(max[0] - min[0]); width[1] = Math.abs(max[1] - min[1]); width[2] = Math.abs(max[2] - min[2]); - maxwidth = width[0]; - - if (width[1] > width[0]) - { - maxwidth = width[1]; - } - - if (width[2] > width[1]) - { - maxwidth = width[2]; - } - - // System.out.println("Maxwidth = " + maxwidth); + maxwidth = Math.max(width[0], Math.max(width[1], width[2])); } /** @@ -285,50 +257,47 @@ public class RotatableCanvas extends JPanel implements MouseListener, * * @return DOCUMENT ME! */ - public float findScale() + protected float findScale() { int dim; - int width; + int w; int height; if (getWidth() != 0) { - width = getWidth(); + w = getWidth(); height = getHeight(); } else { - width = prefsize.width; + w = prefsize.width; height = prefsize.height; } - if (width < height) + if (w < height) { - dim = width; + dim = w; } else { dim = height; } - return (float) ((dim * scalefactor) / (2 * maxwidth)); + return (dim * scalefactor) / (2 * maxwidth); } /** - * DOCUMENT ME! + * Computes and saves the position of the centre of the view */ - public void findCentre() + protected void findCentre() { - // Find centre coordinate findWidth(); - centre[0] = (max[0] + min[0]) / 2; - centre[1] = (max[1] + min[1]) / 2; - centre[2] = (max[2] + min[2]) / 2; + float x = (max[0] + min[0]) / 2; + float y = (max[1] + min[1]) / 2; + float z = (max[2] + min[2]) / 2; - // System.out.println("Centre x " + centre[0]); - // System.out.println("Centre y " + centre[1]); - // System.out.println("Centre z " + centre[2]); + centre = new Point(x, y, z); } /** @@ -336,6 +305,7 @@ public class RotatableCanvas extends JPanel implements MouseListener, * * @return DOCUMENT ME! */ + @Override public Dimension getPreferredSize() { if (prefsize != null) @@ -353,6 +323,7 @@ public class RotatableCanvas extends JPanel implements MouseListener, * * @return DOCUMENT ME! */ + @Override public Dimension getMinimumSize() { return getPreferredSize(); @@ -364,6 +335,7 @@ public class RotatableCanvas extends JPanel implements MouseListener, * @param g * DOCUMENT ME! */ + @Override public void paintComponent(Graphics g1) { @@ -374,8 +346,9 @@ public class RotatableCanvas extends JPanel implements MouseListener, if (points == null) { g.setFont(new Font("Verdana", Font.PLAIN, 18)); - g.drawString(MessageManager.getString("label.calculating_pca") - + "....", 20, getHeight() / 2); + g.drawString( + MessageManager.getString("label.calculating_pca") + "....", + 20, getHeight() / 2); } else { @@ -396,7 +369,7 @@ public class RotatableCanvas extends JPanel implements MouseListener, drawBackground(ig, bgColour); drawScene(ig); - if (drawAxes == true) + if (drawAxes) { drawAxes(ig); } @@ -406,31 +379,37 @@ public class RotatableCanvas extends JPanel implements MouseListener, } /** - * DOCUMENT ME! + * Resets the view to initial state (no rotation) + */ + public void resetView() + { + img = null; + resetAxes(); + } + + /** + * Draws lines for the x, y, z axes * * @param g - * DOCUMENT ME! */ public void drawAxes(Graphics g) { g.setColor(Color.yellow); - for (int i = 0; i < 3; i++) + for (int i = 0; i < DIMS; i++) { - g.drawLine(getWidth() / 2, getHeight() / 2, (int) ((axes[i][0] - * scale * max[0]) + (getWidth() / 2)), (int) ((axes[i][1] - * scale * max[1]) + (getHeight() / 2))); + g.drawLine(getWidth() / 2, getHeight() / 2, + (int) ((axisEndPoints[i].x * scale * max[0]) + (getWidth() / 2)), + (int) ((axisEndPoints[i].y * scale * max[1]) + (getHeight() / 2))); } } /** - * DOCUMENT ME! + * Fills the background with the specified colour * * @param g - * DOCUMENT ME! * @param col - * DOCUMENT ME! */ public void drawBackground(Graphics g, Color col) { @@ -439,60 +418,41 @@ public class RotatableCanvas extends JPanel implements MouseListener, } /** - * DOCUMENT ME! + * Draws points (6x6 squares) for the sequences of the PCA, and labels + * (sequence names) if configured to do so. The sequence points colours are + * taken from the sequence ids in the alignment (converting black to white). + * Sequences 'at the back' (z-coordinate is negative) are shaded slightly + * darker to help give a 3-D sensation. * * @param g - * DOCUMENT ME! */ public void drawScene(Graphics g1) { - Graphics2D g = (Graphics2D) g1; g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - int halfwidth = getWidth() / 2; - int halfheight = getHeight() / 2; - for (int i = 0; i < npoint; i++) { - SequencePoint sp = (SequencePoint) points.elementAt(i); - int x = (int) ((float) (sp.coord[0] - centre[0]) * scale) + halfwidth; - int y = (int) ((float) (sp.coord[1] - centre[1]) * scale) - + halfheight; - float z = sp.coord[1] - centre[2]; - - if (av.getSequenceColour(sp.sequence) == Color.black) - { - g.setColor(Color.white); - } - else - { - g.setColor(av.getSequenceColour(sp.sequence)); - } - - if (av.getSelectionGroup() != null) - { - if (av.getSelectionGroup().getSequences(null) - .contains(((SequencePoint) points.elementAt(i)).sequence)) - { - g.setColor(Color.gray); - } - } - - if (z < 0) - { - g.setColor(g.getColor().darker()); - } - + /* + * sequence point colour as sequence id, but + * gray if sequence is currently selected + */ + SequencePoint sp = points.elementAt(i); + Color sequenceColour = getSequencePointColour(sp); + g.setColor(sequenceColour); + + int halfwidth = getWidth() / 2; + int halfheight = getHeight() / 2; + int x = (int) ((sp.coord.x - centre.x) * scale) + halfwidth; + int y = (int) ((sp.coord.y - centre.y) * scale) + halfheight; g.fillRect(x - 3, y - 3, 6, 6); + if (showLabels) { g.setColor(Color.red); - g.drawString( - ((SequencePoint) points.elementAt(i)).sequence.getName(), - x - 3, y - 4); + g.drawString(sp.getSequence().getName(), x - 3, y - 4); } } @@ -505,51 +465,55 @@ public class RotatableCanvas extends JPanel implements MouseListener, } /** - * DOCUMENT ME! + * Determines the colour to use when drawing a sequence point. The colour is + * taken from the sequence id, with black converted to white, and then + * graduated from darker (at the back) to brighter (at the front) based on the + * z-axis coordinate of the point. * - * @return DOCUMENT ME! + * @param sp + * @return */ - public Dimension minimumsize() + protected Color getSequencePointColour(SequencePoint sp) { - return prefsize; - } + SequenceI sequence = sp.getSequence(); + Color sequenceColour = av.getSequenceColour(sequence); + if (sequenceColour == Color.black) + { + sequenceColour = Color.white; + } + if (av.getSelectionGroup() != null) + { + if (av.getSelectionGroup().getSequences(null).contains(sequence)) + { + sequenceColour = Color.gray; + } + } - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Dimension preferredsize() - { - return prefsize; + /* + * graduate from front (brighter) to back (darker) + */ + sequenceColour = ColorUtils.getGraduatedColour(sp.coord.z, min[2], + max[2], sequenceColour); + + return sequenceColour; } - /** - * DOCUMENT ME! - * - * @param evt - * DOCUMENT ME! - */ + @Override public void keyTyped(KeyEvent evt) { } - /** - * DOCUMENT ME! - * - * @param evt - * DOCUMENT ME! - */ + @Override public void keyReleased(KeyEvent evt) { } /** - * DOCUMENT ME! + * Responds to up or down arrow key by zooming in or out, respectively * * @param evt - * DOCUMENT ME! */ + @Override public void keyPressed(KeyEvent evt) { if (evt.getKeyCode() == KeyEvent.VK_UP) @@ -564,8 +528,9 @@ public class RotatableCanvas extends JPanel implements MouseListener, } else if (evt.getKeyChar() == 's') { - System.err.println("DEBUG: Rectangle selection"); // log.debug - + // Cache.log.warn("DEBUG: Rectangle selection"); + // todo not yet enabled as rectx2, recty2 are always -1 + // need to set them in mouseDragged if ((rectx2 != -1) && (recty2 != -1)) { rectSelect(rectx1, recty1, rectx2, recty2); @@ -575,62 +540,40 @@ public class RotatableCanvas extends JPanel implements MouseListener, repaint(); } - /** - * DOCUMENT ME! - * - * @param evt - * DOCUMENT ME! - */ + @Override public void mouseClicked(MouseEvent evt) { } - /** - * DOCUMENT ME! - * - * @param evt - * DOCUMENT ME! - */ + @Override public void mouseEntered(MouseEvent evt) { } - /** - * DOCUMENT ME! - * - * @param evt - * DOCUMENT ME! - */ + @Override public void mouseExited(MouseEvent evt) { } - /** - * DOCUMENT ME! - * - * @param evt - * DOCUMENT ME! - */ + @Override public void mouseReleased(MouseEvent evt) { } /** - * DOCUMENT ME! - * - * @param evt - * DOCUMENT ME! + * If the mouse press is at (within 2 pixels of) a sequence point, toggles + * (adds or removes) the corresponding sequence as a member of the viewport + * selection group. This supports configuring a group in the alignment by + * clicking on points in the PCA display. */ + @Override public void mousePressed(MouseEvent evt) { int x = evt.getX(); int y = evt.getY(); - mx = x; - my = y; - - omx = mx; - omy = my; + mouseX = x; + mouseY = y; startx = x; starty = y; @@ -641,7 +584,7 @@ public class RotatableCanvas extends JPanel implements MouseListener, rectx2 = -1; recty2 = -1; - SequenceI found = findPoint(x, y); + SequenceI found = findSequenceAtPoint(x, y); if (found != null) { @@ -657,8 +600,8 @@ public class RotatableCanvas extends JPanel implements MouseListener, { aps[a].av.setSelectionGroup(new SequenceGroup()); aps[a].av.getSelectionGroup().addOrRemove(found, true); - aps[a].av.getSelectionGroup().setEndRes( - aps[a].av.getAlignment().getWidth() - 1); + aps[a].av.getSelectionGroup() + .setEndRes(aps[a].av.getAlignment().getWidth() - 1); } } PaintRefresher.Refresh(this, av.getSequenceSetId()); @@ -669,34 +612,34 @@ public class RotatableCanvas extends JPanel implements MouseListener, repaint(); } - // private void fireSequenceSelectionEvent(Selection sel) { - // controller.handleSequenceSelectionEvent(new - // SequenceSelectionEvent(this,sel)); - // } + /** + * Sets the tooltip to the name of the sequence within 2 pixels of the mouse + * position, or clears the tooltip if none found + */ + @Override public void mouseMoved(MouseEvent evt) { - SequenceI found = findPoint(evt.getX(), evt.getY()); + SequenceI found = findSequenceAtPoint(evt.getX(), evt.getY()); - if (found != null) - { - this.setToolTipText(found.getName()); - } - else - { - this.setToolTipText(null); - } + this.setToolTipText(found == null ? null : found.getName()); } /** - * DOCUMENT ME! + * Action handler for a mouse drag. Rotates the display around the X axis (for + * up/down mouse movement) and/or the Y axis (for left/right mouse movement). * * @param evt - * DOCUMENT ME! */ + @Override public void mouseDragged(MouseEvent evt) { - mx = evt.getX(); - my = evt.getY(); + int xPos = evt.getX(); + int yPos = evt.getY(); + + if (xPos == mouseX && yPos == mouseY) + { + return; + } // Check if this is a rectangle drawing drag if ((evt.getModifiers() & InputEvent.BUTTON2_MASK) != 0) @@ -706,88 +649,105 @@ public class RotatableCanvas extends JPanel implements MouseListener, } else { - rotmat.setIdentity(); + /* + * get the identity transformation... + */ + RotatableMatrix rotmat = new RotatableMatrix(); + + /* + * rotate around the X axis for change in Y + * (mouse movement up/down); note we are equating a + * number of pixels with degrees of rotation here! + */ + if (yPos != mouseY) + { + rotmat.rotate(yPos - mouseY, Axis.X); + } - rotmat.rotate((float) (my - omy), 'x'); - rotmat.rotate((float) (mx - omx), 'y'); + /* + * rotate around the Y axis for change in X + * (mouse movement left/right) + */ + if (xPos != mouseX) + { + rotmat.rotate(xPos - mouseX, Axis.Y); + } + /* + * apply the composite transformation to sequence points + */ for (int i = 0; i < npoint; i++) { - SequencePoint sp = (SequencePoint) points.elementAt(i); - sp.coord[0] -= centre[0]; - sp.coord[1] -= centre[1]; - sp.coord[2] -= centre[2]; + SequencePoint sp = points.elementAt(i); + sp.translateBack(centre); // Now apply the rotation matrix sp.coord = rotmat.vectorMultiply(sp.coord); // Now translate back again - sp.coord[0] += centre[0]; - sp.coord[1] += centre[1]; - sp.coord[2] += centre[2]; + sp.translate(centre); } - for (int i = 0; i < 3; i++) + /* + * rotate the x/y/z axis positions + */ + for (int i = 0; i < DIMS; i++) { - axes[i] = rotmat.vectorMultiply(axes[i]); + axisEndPoints[i] = rotmat.vectorMultiply(axisEndPoints[i]); } - omx = mx; - omy = my; + mouseX = xPos; + mouseY = yPos; paint(this.getGraphics()); } } /** - * DOCUMENT ME! + * Adds any sequences whose displayed points are within the given rectangle to + * the viewport's current selection. Intended for key 's' after dragging to + * select a region of the PCA. * * @param x1 - * DOCUMENT ME! * @param y1 - * DOCUMENT ME! * @param x2 - * DOCUMENT ME! * @param y2 - * DOCUMENT ME! */ - public void rectSelect(int x1, int y1, int x2, int y2) + protected void rectSelect(int x1, int y1, int x2, int y2) { for (int i = 0; i < npoint; i++) { - SequencePoint sp = (SequencePoint) points.elementAt(i); - int tmp1 = (int) (((sp.coord[0] - centre[0]) * scale) + ((float) getWidth() / 2.0)); - int tmp2 = (int) (((sp.coord[1] - centre[1]) * scale) + ((float) getHeight() / 2.0)); + SequencePoint sp = points.elementAt(i); + int tmp1 = (int) (((sp.coord.x - centre.x) * scale) + + (getWidth() / 2.0)); + int tmp2 = (int) (((sp.coord.y - centre.y) * scale) + + (getHeight() / 2.0)); if ((tmp1 > x1) && (tmp1 < x2) && (tmp2 > y1) && (tmp2 < y2)) { if (av != null) { + SequenceI sequence = sp.getSequence(); if (!av.getSelectionGroup().getSequences(null) - .contains(sp.sequence)) + .contains(sequence)) { - av.getSelectionGroup().addSequence(sp.sequence, true); + av.getSelectionGroup().addSequence(sequence, true); } } } } - - // if (changedSel) { - // fireSequenceSelectionEvent(av.getSelection()); - // } } /** - * DOCUMENT ME! + * Answers the first sequence found whose point on the display is within 2 + * pixels of the given coordinates, or null if none is found * * @param x - * DOCUMENT ME! * @param y - * DOCUMENT ME! * - * @return DOCUMENT ME! + * @return */ - public SequenceI findPoint(int x, int y) + protected SequenceI findSequenceAtPoint(int x, int y) { int halfwidth = getWidth() / 2; int halfheight = getHeight() / 2; @@ -796,21 +756,22 @@ public class RotatableCanvas extends JPanel implements MouseListener, for (int i = 0; i < npoint; i++) { - SequencePoint sp = (SequencePoint) points.elementAt(i); - int px = (int) ((float) (sp.coord[0] - centre[0]) * scale) + SequencePoint sp = points.elementAt(i); + int px = (int) ((sp.coord.x - centre.x) * scale) + halfwidth; - int py = (int) ((float) (sp.coord[1] - centre[1]) * scale) + int py = (int) ((sp.coord.y - centre.y) * scale) + halfheight; if ((Math.abs(px - x) < 3) && (Math.abs(py - y) < 3)) { found = i; + break; } } if (found != -1) { - return ((SequencePoint) points.elementAt(found)).sequence; + return points.elementAt(found).getSequence(); } else { @@ -818,6 +779,12 @@ public class RotatableCanvas extends JPanel implements MouseListener, } } + /** + * Answers the panel the PCA is associated with (all panels for this alignment + * if 'associate with all panels' is selected). + * + * @return + */ AlignmentPanel[] getAssociatedPanels() { if (applyToAllViews) @@ -826,24 +793,7 @@ public class RotatableCanvas extends JPanel implements MouseListener, } else { - return new AlignmentPanel[] - { ap }; + return new AlignmentPanel[] { ap }; } } - - /** - * - * @return x,y,z positions of point s (index into points) under current - * transform. - */ - public double[] getPointPosition(int s) - { - double pts[] = new double[3]; - float[] p = ((SequencePoint) points.elementAt(s)).coord; - pts[0] = p[0]; - pts[1] = p[1]; - pts[2] = p[2]; - return pts; - } - }