X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2FMCview%2FAppletPDBCanvas.java;h=dc4cf0b6fda07d02f1b6393c721c31ad79d0e07a;hb=9a5435d4f6b25c70aa7c10c66f022ccd86eb4de1;hp=d6247f4ebc2f3d3a6cdb274d688763dbe4ce8b3c;hpb=8893c2ac9824d4c566ae69c73d34889c5316b058;p=jalview.git diff --git a/src/MCview/AppletPDBCanvas.java b/src/MCview/AppletPDBCanvas.java index d6247f4..dc4cf0b 100755 --- a/src/MCview/AppletPDBCanvas.java +++ b/src/MCview/AppletPDBCanvas.java @@ -76,6 +76,7 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion boolean pdbAction = false; Bond highlightBond1, highlightBond2; boolean errorLoading = false; + boolean seqColoursReady = false; public AppletPDBCanvas(jalview.appletgui.SeqCanvas seqcanvas, Sequence seq) { @@ -117,7 +118,7 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion ((PDBChain) pdb.chains.elementAt(i)).sequence, "pep"); as.calcScoreMatrix(); as.traceAlignment(); - PrintStream ps = new PrintStream(System.out) + PrintStream ps = new PrintStream(System.out) { public void print(String x) { mappingDetails.append(x); @@ -186,6 +187,7 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion Vector visiblebonds; void setupBonds() { + seqColoursReady = false; // Sort the bonds by z coord visiblebonds = new Vector(); @@ -202,6 +204,7 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion } } updateSeqColours(); + seqColoursReady = true; redrawneeded = true; repaint(); } @@ -360,7 +363,8 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion g.drawString("Error loading PDB data!!", 50, getSize().height/2); return; } - else if(visiblebonds==null) + + if( !seqColoursReady ) { g.setColor(Color.black); g.setFont(new Font("Verdana", Font.BOLD, 14)); @@ -414,7 +418,13 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion drawLabels(ig); } - + void setColours(jalview.schemes.ColourSchemeI cs) + { + bysequence = false; + pdb.setColours(cs); + redrawneeded = true; + repaint(); + } public void updateSeqColours() { if (pdbAction) @@ -488,8 +498,8 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion tmp.startCol = seqcanvas.getSequenceRenderer(). getResidueBoxColour( sequence, index); - // tmp.startCol = seqcanvas.getFeatureRenderer(). - // findFeatureColour(tmp.startCol, sequence, index); + tmp.startCol = seqcanvas.getFeatureRenderer(). + findFeatureColour(tmp.startCol, sequence, index); } } @@ -499,8 +509,8 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion { tmp.endCol = seqcanvas.getSequenceRenderer(). getResidueBoxColour( sequence, index); - // tmp.endCol = seqcanvas.getFeatureRenderer(). - // findFeatureColour(tmp.endCol, sequence, index); + tmp.endCol = seqcanvas.getFeatureRenderer(). + findFeatureColour(tmp.endCol, sequence, index); } } } @@ -706,35 +716,24 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion void highlightSeqcanvas(int pos) { - int index = seqcanvas.getViewport().getAlignment().findIndex(sequence); - - int size = pos==-1?0:3; - - if(highlightRes!=null) - size += highlightRes.size()*3; - - int [] array = new int[size]; - int i=0; + SearchResults searchResults = new SearchResults(); if(highlightRes!=null) { - for (i = 0; i < highlightRes.size(); i++) + for (int i = 0; i < highlightRes.size(); i++) { int a = Integer.parseInt(highlightRes.elementAt( i).toString())+1; - array[i * 3] = index; - array[ (i * 3) + 1] = a; - array[ (i * 3) + 2] = a; + + searchResults.addResult(sequence, a, a); } } if(pos!=-1) { - array[i * 3] = index; - array[i * 3 + 1] = pos+1; - array[i * 3 + 2] = pos+1; + searchResults.addResult(sequence, pos+1, pos+1); } - seqcanvas.highlightSearchResults(array); + seqcanvas.highlightSearchResults(searchResults); } @@ -925,6 +924,8 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion public void highlightRes(int ii) { + if(!seqColoursReady) + return; if (highlightRes != null && highlightRes.contains((ii-1) + ""))