Has own featurerenderer
authoramwaterhouse <Andrew Waterhouse>
Fri, 24 Mar 2006 15:24:53 +0000 (15:24 +0000)
committeramwaterhouse <Andrew Waterhouse>
Fri, 24 Mar 2006 15:24:53 +0000 (15:24 +0000)
src/MCview/PDBCanvas.java

index 80b65ae..d702264 100755 (executable)
@@ -73,6 +73,7 @@ public class PDBCanvas extends JPanel implements MouseListener, MouseMotionListe
     Vector highlightRes;\r
     boolean pdbAction = false;\r
     boolean seqColoursReady = false;\r
+    jalview.gui.FeatureRenderer fr;\r
 \r
     public PDBCanvas(jalview.gui.SeqCanvas seqcanvas, Sequence seq)\r
     {\r
@@ -477,6 +478,16 @@ public class PDBCanvas extends JPanel implements MouseListener, MouseMotionListe
     void colourBySequence(PDBChain chain)\r
     {\r
      // System.out.println("colour by seq");\r
+     boolean showFeatures = false;\r
+     if(seqcanvas.getViewport().getShowSequenceFeatures())\r
+     {\r
+       showFeatures = true;\r
+       if (fr == null)\r
+         fr = new jalview.gui.FeatureRenderer(seqcanvas.getViewport());\r
+\r
+       fr.transferSettings( seqcanvas.getFeatureRenderer() );\r
+     }\r
+\r
       for (int i = 0; i < chain.bonds.size(); i++)\r
       {\r
         Bond tmp = (Bond) chain.bonds.elementAt(i);\r
@@ -498,8 +509,8 @@ public class PDBCanvas extends JPanel implements MouseListener, MouseMotionListe
               if(tmp.startCol==null)\r
                 tmp.startCol = Color.white;\r
 \r
-              tmp.startCol = seqcanvas.getFeatureRenderer().\r
-                  findFeatureColour(tmp.startCol, sequence, index);\r
+              if(showFeatures)\r
+                tmp.startCol = fr.findFeatureColour(tmp.startCol, sequence, index);\r
             }\r
         }\r
 \r
@@ -515,19 +526,23 @@ public class PDBCanvas extends JPanel implements MouseListener, MouseMotionListe
                   getResidueBoxColour( sequence, index);\r
               if(tmp.endCol==null)\r
                 tmp.endCol = Color.white;\r
-              tmp.endCol = seqcanvas.getFeatureRenderer().\r
-                  findFeatureColour(tmp.endCol, sequence, index);\r
+              if(showFeatures)\r
+                tmp.endCol = fr.findFeatureColour(tmp.endCol, sequence, index);\r
             }\r
         }\r
       }\r
     }\r
 \r
 \r
+    Zsort zsort;\r
     public void drawScene(Graphics g)\r
     {\r
         if (zbuffer)\r
         {\r
-            Zsort.Zsort(visiblebonds);\r
+          if(zsort==null)\r
+            zsort = new Zsort();\r
+\r
+          zsort.Zsort(visiblebonds);\r
         }\r
 \r
         Bond tmpBond=null;\r
@@ -550,7 +565,8 @@ public class PDBCanvas extends JPanel implements MouseListener, MouseMotionListe
 \r
             if (depthcue && !bymolecule)\r
             {\r
-                if (tmpBond.start[2] < (centre[2] - (maxwidth / 6))) {\r
+                if (tmpBond.start[2] < (centre[2] - (maxwidth / 6)))\r
+                {\r
                     g.setColor(tmpBond.startCol.darker().darker());\r
                     drawLine(g, xstart, ystart, xmid, ymid);\r
                     g.setColor(tmpBond.endCol.darker().darker());\r