aa[i].height += 16;\r
}\r
\r
- if (aa[i].isGraph)\r
+ if (aa[i].graph>0)\r
{\r
aa[i].height += GRAPH_HEIGHT;\r
}\r
}\r
\r
\r
- if (row.isGraph)\r
+ if (row.graph>0)\r
{\r
// this is so that we draw the characters below the graph\r
y += row.height;\r
0))) / 2;\r
g.setColor(row.annotations[j].colour);\r
\r
- if (j == 0 || row.isGraph)\r
+ if (j == 0 || row.graph>0)\r
{\r
g.drawString(row.annotations[j].displayCharacter, x+charOffset,\r
y + iconOffset + 3);\r
}\r
}\r
\r
- if (validRes && row.isGraph)\r
+ if (validRes && row.graph>0)\r
{\r
- g.setColor(new Color(0, 0, 180));\r
+ ///g.setColor(new Color(0, 0, 180));\r
\r
- int height = (int) ((row.annotations[j].value / row.graphMax) * GRAPH_HEIGHT);\r
+ if(row.graph== AlignmentAnnotation.LINE_GRAPH )\r
+ drawLineGraph(g, row, j, j+1, x, y);\r
+ else if(row.graph == AlignmentAnnotation.BAR_GRAPH )\r
+ drawBarGraph(g, row, j, j+1, x, y);\r
\r
- if (row.windowLength > 1)\r
- {\r
- int total = 0;\r
-\r
- for (int i2 = j - (row.windowLength / 2);\r
- i2 < (j + (row.windowLength / 2)); i2++)\r
- {\r
- if ((i2 < 0) || (i2 >= av.alignment.getWidth()))\r
- {\r
- continue;\r
- }\r
-\r
- total += row.annotations[i2].value;\r
- }\r
-\r
- total /= row.windowLength;\r
- height = (int) ((total / row.graphMax) * GRAPH_HEIGHT);\r
- }\r
+ //int height = (int) ((row.annotations[j].value / row.graphMax) * GRAPH_HEIGHT);\r
\r
- g.setColor(row.annotations[j].colour);\r
- g.fillRect(x, y - height, av.charWidth, height);\r
+ // g.setColor(row.annotations[j].colour);\r
+ // g.fillRect(x, y - height, av.charWidth, height);\r
}\r
}\r
\r
}\r
}\r
\r
- if (row.isGraph && row.hasText)\r
+ if (row.graph>0 && row.hasText)\r
{\r
y += av.charHeight;\r
}\r
\r
- if (!row.isGraph)\r
+ if (row.graph==0)\r
{\r
y += aa[i].height;\r
}\r
}\r
}\r
\r
- // used by overview window\r
- public void drawGraph(Graphics g, AlignmentAnnotation aa, int width, int y, int sRes, int eRes)\r
+ public void drawLineGraph(Graphics g, AlignmentAnnotation aa, int sRes, int eRes, int x, int y)\r
{\r
- g.setColor(Color.white);\r
- g.fillRect(0, 0, width, y);\r
- g.setColor(new Color(0, 0, 180));\r
+ g.setColor(new Color(0, 0, 0));\r
+ if(sRes==0)\r
+ sRes++;\r
\r
+ int y1=y, y2=y;\r
+ for (int j = sRes; j < eRes; j++)\r
+ {\r
+ if(aa.annotations[j-1]!=null)\r
+ y1 = y - (int) ((aa.annotations[j-1].value / aa.graphMax) * GRAPH_HEIGHT);\r
\r
- int x = 0, height;\r
+ if(aa.annotations[j]!=null)\r
+ y2 = y - (int) ((aa.annotations[j].value / aa.graphMax) * GRAPH_HEIGHT);\r
\r
- for (int j = sRes; j < eRes; j++)\r
- {\r
- g.setColor(new Color(0, 0, 180));\r
+ g.drawLine(x-av.charWidth/2, y1, x+av.charWidth/2, y2);\r
+\r
+ x += av.charWidth;\r
+ }\r
+ }\r
\r
- height = (int) ((aa.annotations[j].value / aa.graphMax) * GRAPH_HEIGHT);\r
- if(height>y)\r
- height = y;\r
+ public void drawBarGraph(Graphics g, AlignmentAnnotation aa, int sRes, int eRes, int x, int y)\r
+ {\r
+ g.setColor(new Color(0, 0, 180));\r
+ int j, height=0;\r
+ for (j = sRes; j < eRes; j++)\r
+ {\r
+ g.setColor(aa.annotations[j].colour);\r
+ height = (int) ((aa.annotations[j].value / aa.graphMax) * GRAPH_HEIGHT);\r
\r
- g.fillRect(x, y - height, av.charWidth, height);\r
- x += av.charWidth;\r
+ g.fillRect(x, y - height, av.charWidth, height);\r
+ x += av.charWidth;\r
}\r
}\r
+\r
+ // used by overview window\r
+ public void drawGraph(Graphics g, AlignmentAnnotation aa, int width, int y, int sRes, int eRes)\r
+ {\r
+ g.setColor(Color.white);\r
+ g.fillRect(0, 0, width, y);\r
+ g.setColor(new Color(0, 0, 180));\r
+\r
+ int x = 0, height;\r
+\r
+ for (int j = sRes; j < eRes; j++)\r
+ {\r
+ g.setColor(new Color(0, 0, 180));\r
+\r
+ height = (int) ((aa.annotations[j].value / aa.graphMax) * y);\r
+ if(height>y)\r
+ height = y;\r
+\r
+ g.fillRect(x, y - height, av.charWidth, height);\r
+ x += av.charWidth;\r
+ }\r
+ }\r
+\r
}\r