X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FRotatableCanvas.java;h=b27ab8ae06d39173cd04aefd00ebd550ea914c76;hb=a28c9340eeadfdaa551a21b9dea1d0f1530126e3;hp=25754cd939ecffb9ff89b95f078b4aefd0a854b0;hpb=930a6609bc99bfb0827fc5d0d16666787aaba575;p=jalview.git diff --git a/src/jalview/appletgui/RotatableCanvas.java b/src/jalview/appletgui/RotatableCanvas.java index 25754cd..b27ab8a 100755 --- a/src/jalview/appletgui/RotatableCanvas.java +++ b/src/jalview/appletgui/RotatableCanvas.java @@ -32,8 +32,6 @@ public class RotatableCanvas extends Panel implements MouseListener, MouseMotionListener, KeyListener -//RubberbandListener, -//SequenceSelectionListener { RotatableMatrix idmat = new RotatableMatrix(3, 3); RotatableMatrix objmat = new RotatableMatrix(3, 3); @@ -82,17 +80,25 @@ public class RotatableCanvas float scalefactor = 1; AlignViewport av; -// Controller controller; + boolean showLabels = false; + public RotatableCanvas(AlignViewport av) + { + this.av = av; + } + + public void showLabels(boolean b) + { + showLabels = b; + repaint(); + } - public RotatableCanvas(AlignViewport av, - Vector points, int npoint) + public void setPoints(Vector points, int npoint) { this.points = points; this.npoint = npoint; - this.av = av; PaintRefresher.Register(this, av.alignment); -// + prefsize = getPreferredSize(); orig = new float[npoint][3]; @@ -287,29 +293,43 @@ public class RotatableCanvas public void paint(Graphics g) { - //Only create the image at the beginning - - if ( (img == null) || (prefsize.width != getSize().width) || - (prefsize.height != getSize().height)) + if (!jalview.bin.JalviewLite.AWT1) { - prefsize.width = getSize().width; - prefsize.height = getSize().height; - - scale = findScale(); - - // System.out.println("New scale = " + scale); - img = createImage(getSize().width, getSize().height); - ig = img.getGraphics(); - + MyGraphics.AntiAlias(g); } - drawBackground(ig, Color.black); - drawScene(ig); - if (drawAxes == true) + if (points == null) { - drawAxes(ig); + g.setFont(new Font("Verdana", Font.PLAIN, 18)); + g.drawString("Calculating PCA....", 20, getSize().height / 2); } + else + { + + //Only create the image at the beginning - + if ( (img == null) || (prefsize.width != getSize().width) || + (prefsize.height != getSize().height)) + { + prefsize.width = getSize().width; + prefsize.height = getSize().height; + + scale = findScale(); + + // System.out.println("New scale = " + scale); + img = createImage(getSize().width, getSize().height); + ig = img.getGraphics(); + + } - g.drawImage(img, 0, 0, this); + drawBackground(ig, Color.black); + drawScene(ig); + if (drawAxes == true) + { + drawAxes(ig); + } + + g.drawImage(img, 0, 0, this); + } } public void drawAxes(Graphics g) @@ -332,7 +352,7 @@ public class RotatableCanvas public void drawScene(Graphics g) { - boolean darker = false; + //boolean darker = false; int halfwidth = getSize().width / 2; int halfheight = getSize().height / 2; @@ -367,7 +387,14 @@ public class RotatableCanvas } g.fillRect(x - 3, y - 3, 6, 6); - g.setColor(Color.red); + if (showLabels) + { + g.setColor(Color.red); + g.drawString( ( (SequencePoint) points.elementAt(i)).sequence. + getName(), + x - 3, y - 4); + } + } // //Now the rectangle // if (rectx2 != -1 && recty2 != -1) { @@ -541,7 +568,7 @@ public class RotatableCanvas public void rectSelect(int x1, int y1, int x2, int y2) { - boolean changedSel = false; + //boolean changedSel = false; for (int i = 0; i < npoint; i++) { SequencePoint sp = (SequencePoint) points.elementAt(i);