int oldstarty;\r
int oldendx;\r
int oldendy;\r
-\r
public boolean paintFlag = false;\r
+\r
boolean showScores = false;\r
+ boolean displaySearch = false;\r
+ int [] searchResults = null;\r
\r
int chunkHeight;\r
int chunkWidth;\r
\r
- Graphics debugG;\r
- // FeatureRenderer fr = new FeatureRenderer();\r
- // BlockRenderer br = new BlockRenderer();\r
- // CpGRenderer cgr = new CpGRenderer();\r
-\r
- ColourSchemeI cs = new ZappoColourScheme();\r
+ ColourSchemeI cs = new ZappoColourScheme();\r
\r
public SeqCanvas(AlignViewport av)\r
{\r
*/\r
\r
public void paintComponent(Graphics g) {\r
- debugG = g;\r
\r
AlignmentI da = av.getAlignment();\r
\r
if (img == null ||\r
imgWidth != getWidth() ||\r
- imgHeight != getHeight() ||\r
- paintFlag == true) {\r
+ imgHeight != getHeight()\r
+ || paintFlag)\r
+ {\r
\r
imgWidth = (getWidth() > 0 ? getWidth() : 1);\r
imgHeight = (getHeight() > 0 ? getHeight() : 1);\r
img = createImage(imgWidth,imgHeight);\r
gg = img.getGraphics();\r
\r
- // SMJS I added this in to update the AV when the size changes\r
- // until I figure out how this should be done\r
- setFont(av.getFont());\r
-\r
gg.setFont(av.getFont());\r
\r
- paintFlag = false;\r
-\r
oldstartx = -1;\r
oldendx = -1;\r
oldstarty = -1;\r
oldendy = -1;\r
+ paintFlag = false;\r
}\r
\r
int startx = av.getStartRes();\r
}\r
\r
\r
- gg.setColor(Color.red);\r
- gg.drawRect( groupX, groupY, groupendX-groupX, groupendY-groupY );\r
- gg.drawRect( groupX+1, groupY+1, groupendX-groupX-2, groupendY-groupY-2 );\r
+ // gg.setColor(Color.red);\r
+ // gg.drawRect( groupX, groupY, groupendX-groupX, groupendY-groupY );\r
+ // gg.drawRect( groupX+1, groupY+1, groupendX-groupX-2, groupendY-groupY-2 );\r
\r
\r
g.drawImage(img,0,0,this);\r
SequenceGroup group;\r
for (int i = y1 ; i < y2 ;i++)\r
{\r
- RendererI r = sr;\r
/* if (av.getSelection().contains(av.getAlignment().getSequenceAt(i))) {\r
r = fr;\r
System.out.println("use feature renderer");\r
group = av.alignment.findGroup( nextSeq );\r
if( group!=null )\r
{\r
- r.drawSequence(g, group.cs, nextSeq,\r
+ sr.drawSequence(g, group.cs, nextSeq,\r
x1,\r
x2,\r
(int) ( (x1 - startx) * charWidth),\r
}\r
else\r
{\r
- r.drawSequence(g, cs, nextSeq,\r
+ sr.drawSequence(g, cs, nextSeq,\r
x1,\r
x2,\r
(int) ( (x1 - startx) * charWidth),\r
\r
}\r
\r
- }\r
\r
- public int groupX, groupY, groupendX, groupendY;\r
+ if(displaySearch)\r
+ {\r
+ for(int r=0; r<searchResults.length; r+=3)\r
+ {\r
+ int searchSeq = searchResults[r];\r
+ int searchStart = searchResults[r+1];\r
+ int searchEnd = searchResults[r+2];\r
+\r
+ if (searchSeq >= y1 && searchSeq <= y2)\r
+ {\r
+ SequenceRenderer ssr = (SequenceRenderer) sr;\r
+ ssr.drawHighlightedText(g, av.getAlignment().getSequenceAt(searchSeq),\r
+ searchStart,\r
+ searchEnd,\r
+ (int) ( (searchStart - startx) * charWidth),\r
+ offset +\r
+ AlignmentUtil.getPixelHeight(starty, searchSeq,\r
+ charHeight),\r
+ (int) charWidth,\r
+ charHeight);\r
+\r
+ }\r
+ }\r
+ }\r
\r
\r
+ }\r
+\r
+ // public int groupX, groupY, groupendX, groupendY;\r
+\r
public void fillBackground(Graphics g,Color c, int x1,int y1,int width,int height) {\r
g.setColor(c);\r
g.fillRect(x1,y1,width,height);\r
return chunkWidth;\r
}\r
\r
+ public void highlightSearchResults(int [] results)\r
+ {\r
+ // results are in the order sequence, startRes, endRes\r
+ searchResults = results;\r
+ displaySearch = true;\r
+ paintFlag = true;\r
+ repaint();\r
+ }\r
+\r
+\r
}\r