package jalview.gui;
import jalview.datamodel.AlignmentI;
-import jalview.datamodel.SearchResults;
+import jalview.datamodel.SearchResultsI;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
+import jalview.renderer.ScaleRenderer;
+import jalview.renderer.ScaleRenderer.ScaleMark;
import java.awt.BasicStroke;
import java.awt.BorderLayout;
AlignViewport av;
- SearchResults searchResults = null;
-
boolean fastPaint = false;
int LABEL_WEST;
private void drawNorthScale(Graphics g, int startx, int endx, int ypos)
{
updateViewport();
- int scalestartx = startx - (startx % 10) + 10;
-
- g.setColor(Color.black);
- // NORTH SCALE
- for (int i = scalestartx; i < endx; i += 10)
+ for (ScaleMark mark : new ScaleRenderer().calculateMarks(av, startx,
+ endx))
{
- int value = i;
- if (av.hasHiddenColumns())
+ int mpos = mark.column; // (i - startx - 1)
+ if (mpos < 0)
{
- value = av.getColumnSelection().adjustForHiddenColumns(value);
+ continue;
}
+ String mstring = mark.text;
- g.drawString(String.valueOf(value), (i - startx - 1) * charWidth,
- ypos - (charHeight / 2));
-
- g.drawLine(((i - startx - 1) * charWidth) + (charWidth / 2),
- (ypos + 2) - (charHeight / 2), ((i - startx - 1) * charWidth)
- + (charWidth / 2), ypos - 2);
+ if (mark.major)
+ {
+ if (mstring != null)
+ {
+ g.drawString(mstring, mpos * charWidth, ypos - (charHeight / 2));
+ }
+ g.drawLine((mpos * charWidth) + (charWidth / 2), (ypos + 2)
+ - (charHeight / 2), (mpos * charWidth) + (charWidth / 2),
+ ypos - 2);
+ }
}
}
if (av.isShowSequenceFeatures())
{
- fr.drawSequence(g, nextSeq, startRes, endRes, offset
+ fr.drawSequence(g, nextSeq, startRes,
+ endRes, offset
+ ((i - startSeq) * charHeight));
}
// / Highlight search Results once all sequences have been drawn
// ////////////////////////////////////////////////////////
- if (searchResults != null)
+ if (av.hasSearchResults())
{
- int[] visibleResults = searchResults.getResults(nextSeq, startRes,
- endRes);
+ int[] visibleResults = av.getSearchResults().getResults(nextSeq,
+ startRes, endRes);
if (visibleResults != null)
{
for (int r = 0; r < visibleResults.length; r += 2)
* @param results
* DOCUMENT ME!
*/
- public void highlightSearchResults(SearchResults results)
+ public void highlightSearchResults(SearchResultsI results)
{
img = null;
- searchResults = results;
+ av.setSearchResults(results);
repaint();
}