// NORTH SCALE\r
for (int i = scalestartx; i < endx; i += 10)\r
{\r
- String string = String.valueOf(i);\r
+ String string = String.valueOf(av.getColumnSelection().adjustForHiddenColumns(i));\r
g.drawString(string, (i - startx - 1) * av.charWidth,\r
ypos - (av.charHeight / 2));\r
\r
*/\r
public void fastPaint(int horizontal, int vertical)\r
{\r
- if (fastPaint || gg == null)\r
+ if (gg == null)\r
{\r
return;\r
}\r
}\r
\r
gg.translate(transX, transY);\r
- drawPanel(gg, sr, er, ss, es, sr, ss, 0);\r
+ drawPanel(gg, sr, er, ss, es, 0);\r
gg.translate(-transX, -transY);\r
\r
repaint();\r
}\r
else\r
{\r
- drawPanel(gg, av.startRes, av.endRes, av.startSeq, av.endSeq,\r
- av.startRes, av.startSeq, 0);\r
+ drawPanel(gg, av.startRes, av.endRes, av.startSeq, av.endSeq, 0);\r
}\r
\r
g.drawImage(img, 0, 0, this);\r
}\r
\r
\r
- drawPanel(g, startRes, endx, 0, al.getHeight(), startRes, 0, ypos);\r
+ drawPanel(g, startRes, endx, 0, al.getHeight(), ypos);\r
\r
if(av.showAnnotation)\r
{\r
}\r
\r
\r
- void drawPanel(Graphics g1, int x1, int x2, int y1, int y2, int startx, int starty, int offset)\r
+ void drawPanel(Graphics g1, int startRes, int endRes,\r
+ int startSeq, int endSeq, int offset)\r
{\r
- Graphics2D g = (Graphics2D) g1;\r
- g.setFont(av.getFont());\r
+ if(!av.hasHiddenColumns)\r
+ {\r
+ draw(g1, startRes, endRes, startSeq, endSeq, offset);\r
+ }\r
+ else\r
+ {\r
+ java.util.Vector regions = av.getColumnSelection().getHiddenColumns();\r
\r
- SequenceI nextSeq;\r
- // int aaHeight = av.charHeight;\r
- // Font aafont = av.getFont();\r
+ int screenY = 0;\r
+ int blockStart = startRes;\r
+ int blockEnd = endRes;\r
\r
- /* dnafont = null, , dna = null, dnaHeight = av.charHeight\r
- if (av.getShowTranslation())\r
- {\r
- aaHeight = (int) (av.getCharHeight() * aaRatio);\r
- dnaHeight = (int) (av.getCharHeight() * (1 - aaRatio));\r
- java.awt.geom.AffineTransform transform = new java.awt.geom.AffineTransform();\r
- transform.scale(1f / 3f, 1);\r
- dnafont = new Font(av.getFont().getName(), av.getFont().getStyle(),\r
- dnaHeight);\r
- dnafont = dnafont.deriveFont(transform);\r
-\r
- aafont = new Font(av.getFont().getName(), av.getFont().getStyle(),\r
- aaHeight);\r
- transform = new java.awt.geom.AffineTransform();\r
- transform.scale(1 / aaRatio, 1);\r
- aafont = aafont.deriveFont(transform);\r
+ for (int i = 0; i < regions.size(); i++)\r
+ {\r
+ int[] region = (int[]) regions.elementAt(i);\r
+ int hideStart = region[0];\r
+ int hideEnd = region[1];\r
+\r
+ if (hideStart <= blockStart)\r
+ {\r
+ blockStart += (hideEnd - hideStart) + 1;\r
+ continue;\r
+ }\r
+\r
+ blockEnd = hideStart - 1;\r
+\r
+ g1.translate(screenY * av.charWidth, 0);\r
+\r
+ draw(g1, blockStart, blockEnd, startSeq, endSeq, offset);\r
+\r
+ g1.setColor(Color.blue);\r
+ g1.drawLine( (blockEnd - blockStart + 1) * av.charWidth - 1,\r
+ startSeq + offset,\r
+ (blockEnd - blockStart + 1) * av.charWidth - 1,\r
+ startSeq + (endSeq - startSeq) * av.charHeight + offset);\r
+ g1.drawLine( (blockEnd - blockStart + 1) * av.charWidth,\r
+ startSeq + offset,\r
+ (blockEnd - blockStart + 1) * av.charWidth,\r
+ startSeq + (endSeq - startSeq) * av.charHeight + offset);\r
+\r
+ g1.translate( -screenY * av.charWidth, 0);\r
+ screenY += blockEnd - blockStart + 1;\r
+ blockStart = hideEnd + 1;\r
+ }\r
+\r
+ if (screenY < (endRes - startRes))\r
+ {\r
+ blockEnd = blockStart + (endRes - startRes) - screenY;\r
+ g1.translate(screenY * av.charWidth, 0);\r
+ draw(g1, blockStart, blockEnd, startSeq, endSeq, offset);\r
+ g1.translate( -screenY * av.charWidth, 0);\r
+ }\r
}\r
-*/\r
\r
+ }\r
+\r
+\r
+\r
+\r
+ //int startRes, int endRes, int startSeq, int endSeq, int x, int y,\r
+ // int x1, int x2, int y1, int y2, int startx, int starty,\r
+ void draw(Graphics g1,\r
+ int startRes, int endRes,\r
+ int startSeq, int endSeq,\r
+ int offset)\r
+ {\r
+ Graphics2D g = (Graphics2D) g1;\r
+ g.setFont(av.getFont());\r
+\r
+ SequenceI nextSeq;\r
\r
/// First draw the sequences\r
/////////////////////////////\r
- for (int i = y1; i < y2; i++)\r
+ for (int i = startSeq; i < endSeq; i++)\r
{\r
nextSeq = av.alignment.getSequenceAt(i);\r
\r
- /* if(av.getShowTranslation())\r
- {\r
- dna = nextSeq;\r
- StringBuffer sb = new StringBuffer();\r
- for(int r = 0; r<nextSeq.getLength(); r+=3)\r
- {\r
- String codon = nextSeq.getSequence(r, r+3);\r
- codon = codon.replace('U', 'T');\r
- String res = ResidueProperties.codonTranslate(codon);\r
- if(res !=null )\r
- {\r
- if (res.equals("STOP"))\r
- sb.append("X");\r
- else\r
- sb.append(res);\r
- }\r
- }\r
- nextSeq = new Sequence("d", sb.toString());\r
- }*/\r
-\r
sr.drawSequence(g, nextSeq, av.alignment.findAllGroups(nextSeq),\r
- x1, x2, (x1 - startx) * av.charWidth,\r
- offset + ( (i - starty) * av.charHeight), av.charWidth,\r
- av.charHeight);\r
-\r
- /* if(av.getShowTranslation())\r
- {\r
- av.setGlobalColourScheme(new NucleotideColourScheme());\r
- g.setFont(dnafont);\r
- sr.drawSequence(g, dna, null,\r
- x1*3, (x2+2) * 3, ( (x1 - startx) * av.charWidth) / 3,\r
- offset + ( (i - starty) * av.charHeight) + aaHeight,\r
- av.charWidth / 3,\r
- dnaHeight);\r
- av.setGlobalColourScheme(cs);\r
- }*/\r
+ startRes, endRes,\r
+ offset + ( (i - startSeq) * av.charHeight));\r
\r
if (av.showSequenceFeatures)\r
{\r
- fr.drawSequence(g, nextSeq, x1, x2,\r
- (x1 - startx) * av.charWidth,\r
- offset + ((i - starty) * av.charHeight), av.charWidth,\r
+ fr.drawSequence(g1, nextSeq, startRes, endRes,\r
+ offset + ((i - startSeq) * av.charHeight), av.charWidth,\r
av.charHeight);\r
}\r
\r
//////////////////////////////////////////////////////////\r
if (searchResults != null)\r
{\r
- int[] visibleResults = searchResults.getResults(nextSeq, x1, x2);\r
+ int[] visibleResults = searchResults.getResults(nextSeq, startRes, endRes);\r
if (visibleResults != null)\r
for (int r = 0; r < visibleResults.length; r += 2)\r
{\r
sr.drawHighlightedText(nextSeq, visibleResults[r],\r
visibleResults[r + 1],\r
- (visibleResults[r] - startx) * av.charWidth,\r
- offset + ( (i - starty) * av.charHeight),\r
+ (visibleResults[r] - startRes) * av.charWidth,\r
+ offset + ( (i - startSeq) * av.charHeight),\r
av.charWidth, av.charHeight);\r
}\r
}\r
int top = -1;\r
int bottom = -1;\r
\r
- for (i = y1; i < y2; i++)\r
+ for (i = startSeq; i < endSeq; i++)\r
{\r
- sx = (group.getStartRes() - startx) * av.charWidth;\r
- sy = offset + ((i - starty) * av.charHeight);\r
+ sx = (group.getStartRes() - startRes) * av.charWidth;\r
+ sy = offset + ((i - startSeq) * av.charHeight);\r
ex = (((group.getEndRes() + 1) - group.getStartRes()) * av.charWidth) -\r
1;\r
\r
continue;\r
}\r
\r
- if ( (sx <= (x2-x1)*av.charWidth) &&\r
+ if ( (sx <= (endRes-startRes)*av.charWidth) &&\r
group.sequences.contains(av.alignment.getSequenceAt(\r
i)))\r
{\r
if (sx + ex > imgWidth)\r
ex = imgWidth;\r
\r
- else if (sx + ex >= (x2 - x1 + 1) * av.charWidth)\r
- ex = (x2 - x1 + 1) * av.charWidth;\r
+ else if (sx + ex >= (endRes - startRes + 1) * av.charWidth)\r
+ ex = (endRes - startRes + 1) * av.charWidth;\r
\r
if (top != -1)\r
{\r
\r
if (inGroup)\r
{\r
- sy = offset + ( (i - starty) * av.charHeight);\r
+ sy = offset + ( (i - startSeq) * av.charHeight);\r
if (sx >= 0 && sx < imgWidth)\r
g.drawLine(sx, oldY, sx, sy);\r
\r
\r
if (sx + ex > imgWidth)\r
ex = imgWidth;\r
- else if (sx + ex >= (x2 - x1 + 1) * av.charWidth)\r
- ex = (x2 - x1 + 1) * av.charWidth;\r
+ else if (sx + ex >= (endRes - startRes + 1) * av.charWidth)\r
+ ex = (endRes - startRes + 1) * av.charWidth;\r
\r
if (top != -1)\r
{\r
Color resBoxColour;\r
Graphics graphics;\r
boolean monospacedFont;\r
+ boolean forOverview = false;\r
\r
/**\r
* Creates a new SequenceRenderer object.\r
{\r
resBoxColour = cs.findColour(seq.getSequence(i, i + 1), i);\r
}\r
+ else if(forOverview && !jalview.util.Comparison.isGap(seq.getCharAt(i)))\r
+ {\r
+ resBoxColour = Color.lightGray;\r
+ }\r
else\r
{\r
- resBoxColour = Color.white;\r
+ resBoxColour = Color.white;\r
}\r
}\r
\r
* @param height DOCUMENT ME!\r
*/\r
public void drawSequence(Graphics g, SequenceI seq, SequenceGroup[] sg,\r
- int start, int end, int x1, int y1, int width, int height)\r
+ int start, int end, int y1)\r
{\r
allGroups = sg;\r
\r
graphics = g;\r
\r
- drawBoxes(seq, start, end, x1, y1, (int) width, height);\r
+ drawBoxes(seq, start, end, y1);\r
\r
fm = g.getFontMetrics();\r
\r
monospacedFont = fm.getStringBounds("M",g).getWidth()==fm.getStringBounds("|",g).getWidth();\r
\r
- drawText(seq, start, end, x1, y1, (int) width, height);\r
+ drawText(seq, start, end, y1);\r
}\r
\r
/**\r
* @param width DOCUMENT ME!\r
* @param height DOCUMENT ME!\r
*/\r
- public synchronized void drawBoxes(SequenceI seq, int start, int end, int x1, int y1,\r
- int width, int height)\r
+ public synchronized void drawBoxes(SequenceI seq, int start, int end, int y1)\r
{\r
int i = start;\r
int length = seq.getLength();\r
\r
int curStart = -1;\r
- int curWidth = width;\r
+ int curWidth = av.charWidth;\r
\r
Color tempColour = null;\r
\r
{\r
if (tempColour != null)\r
{\r
- graphics.fillRect(x1 + (width * (curStart - start)), y1,\r
- curWidth, height);\r
+ graphics.fillRect( av.charWidth * (curStart - start), y1,\r
+ curWidth, av.charHeight);\r
}\r
\r
graphics.setColor(resBoxColour);\r
\r
curStart = i;\r
- curWidth = width;\r
+ curWidth = av.charWidth;\r
tempColour = resBoxColour;\r
}\r
else\r
{\r
- curWidth += width;\r
+ curWidth += av.charWidth;\r
}\r
\r
i++;\r
}\r
\r
- graphics.fillRect(x1 + (width * (curStart - start)), y1, curWidth,\r
- height);\r
+ graphics.fillRect( av.charWidth * (curStart - start), y1, curWidth,\r
+ av.charHeight);\r
\r
}\r
\r
* @param width DOCUMENT ME!\r
* @param height DOCUMENT ME!\r
*/\r
- public void drawText(SequenceI seq, int start, int end, int x1, int y1,\r
- int width, int height)\r
+ public void drawText(SequenceI seq, int start, int end, int y1)\r
{\r
- y1 += height - height / 5; // height/5 replaces pady\r
+ y1 += av.charHeight - av.charHeight / 5; // height/5 replaces pady\r
int charOffset = 0;\r
char s;\r
\r
\r
if(monospacedFont && av.showText && allGroups.length==0 && !av.getColourText())\r
{\r
- graphics.drawString(seq.getSequence(start, end + 1), x1, y1);\r
+ graphics.drawString(seq.getSequence(start, end + 1), 0, y1);\r
}\r
else\r
{\r
}\r
}\r
\r
- charOffset = (width - fm.charWidth(s)) / 2;\r
+ charOffset = (av.charWidth - fm.charWidth(s)) / 2;\r
+\r
+ // System.out.print(s);\r
graphics.drawString(String.valueOf(s),\r
- charOffset + x1 + width * (i - start),\r
+ charOffset + av.charWidth * (i - start),\r
y1);\r
\r
}\r
+ // System.out.println("\n");\r
}\r
}\r
\r