import jalview.datamodel.SearchResults;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
+import jalview.renderer.ScaleRenderer;
+import jalview.renderer.ScaleRenderer.ScaleMark;
import jalview.viewmodel.AlignmentViewport;
import java.awt.Color;
private void drawNorthScale(Graphics g, int startx, int endx, int ypos)
{
- int scalestartx = startx - startx % 10 + 10;
-
+ updateViewport();
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) * avcharWidth,
- ypos - (avcharHeight / 2));
-
- g.drawLine(((i - startx - 1) * avcharWidth) + (avcharWidth / 2),
- (ypos + 2) - (avcharHeight / 2),
- ((i - startx - 1) * avcharWidth) + (avcharWidth / 2),
- ypos - 2);
+ if (mark.major)
+ {
+ if (mstring != null)
+ {
+ g.drawString(mstring, mpos * avcharWidth, ypos
+ - (avcharHeight / 2));
+ }
+ g.drawLine((mpos * avcharWidth) + (avcharWidth / 2), (ypos + 2)
+ - (avcharHeight / 2), (mpos * avcharWidth)
+ + (avcharWidth / 2),
+ ypos - 2);
+ }
}
}