(JAL-958) - normalised sequence logo for applet
[jalview.git] / src / jalview / gui / OverviewPanel.java
index 6bc630c..7e00f2e 100755 (executable)
@@ -1,23 +1,24 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
- * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * This file is part of Jalview.
  * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License 
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
  */
 package jalview.gui;
 
+import jalview.renderer.AnnotationRenderer;
+
 import java.awt.*;
 import java.awt.event.*;
 import java.awt.image.*;
@@ -37,6 +38,7 @@ public class OverviewPanel extends JPanel implements Runnable
 
   AlignmentPanel ap;
 
+  final AnnotationRenderer renderer = new AnnotationRenderer();
   float scalew = 1f;
 
   float scaleh = 1f;
@@ -67,7 +69,7 @@ public class OverviewPanel extends JPanel implements Runnable
    * Creates a new OverviewPanel object.
    * 
    * @param ap
-   *                DOCUMENT ME!
+   *          DOCUMENT ME!
    */
   public OverviewPanel(AlignmentPanel ap)
   {
@@ -129,6 +131,8 @@ public class OverviewPanel extends JPanel implements Runnable
       {
         if (!av.wrapAlignment)
         {
+          // TODO: feature: jv2.5 detect shift drag and update selection from
+          // it.
           boxX = evt.getX();
           boxY = evt.getY();
           checkValid();
@@ -355,12 +359,13 @@ public class OverviewPanel extends JPanel implements Runnable
 
     if (av.conservation != null)
     {
+      renderer.updateFromAlignViewport(av); 
       for (col = 0; col < width; col++)
       {
         lastcol = (int) (col * sampleCol);
         {
           mg.translate(col, sequencesHeight);
-          ap.annotationPanel.drawGraph(mg, av.conservation,
+          renderer.drawGraph(mg, av.conservation,
                   (int) (sampleCol) + 1, graphHeight,
                   (int) (col * sampleCol), (int) (col * sampleCol) + 1);
           mg.translate(-col, -sequencesHeight);
@@ -387,8 +392,7 @@ public class OverviewPanel extends JPanel implements Runnable
   {
     int fullsizeWidth = av.alignment.getWidth() * av.getCharWidth();
     int fullsizeHeight = (av.alignment.getHeight() + av.alignment
-            .getHiddenSequences().getSize())
-            * av.getCharHeight();
+            .getHiddenSequences().getSize()) * av.getCharHeight();
 
     int startRes = av.getStartRes();
     int endRes = av.getEndRes();
@@ -436,7 +440,7 @@ public class OverviewPanel extends JPanel implements Runnable
    * DOCUMENT ME!
    * 
    * @param g
-   *                DOCUMENT ME!
+   *          DOCUMENT ME!
    */
   public void paintComponent(Graphics g)
   {