// Draw the scale numbers
gg.setColor(Color.black);
+ List<Object[]> marks = calculateMarks(startx, endx);
+ int maxX = 0;
+ for (Object[] mark : marks)
+ {
+ boolean major = Boolean.valueOf((Boolean) mark[0]);
+ int mpos = ((Integer) mark[1]).intValue(); // (i - startx - 1)
+ String mstring = (String) mark[2];
+ if (mstring != null)
+ {
+ if (mpos * avCharWidth > maxX)
+ {
+ gg.drawString(mstring, mpos * avCharWidth, y);
+ maxX = (mpos + 2) * avCharWidth + fm.stringWidth(mstring);
+ }
+ }
+ if (major)
+ {
+ gg.drawLine((mpos * avCharWidth) + (avCharWidth / 2), y + 2,
+ (mpos * avCharWidth) + (avCharWidth / 2), y + (yOf * 2));
+ }
+ else
+ {
+ gg.drawLine((mpos * avCharWidth) + (avCharWidth / 2), y + yOf,
+ (mpos * avCharWidth) + (avCharWidth / 2), y + (yOf * 2));
+ }
+ }
+ if (av.hasHiddenColumns())
+ {
+ if (reveal != null && reveal[0] > startx && reveal[0] < endx)
+ {
+ gg.drawString(MessageManager.getString("label.reveal_columns"),
+ reveal[0] * avCharWidth, 0);
+ }
+ }
+
+ }
+
+ /**
+ * calculate positions markers on the alignment ruler
+ *
+ * @return List { Object { .. } } Boolean: true/false for major/minor mark,
+ * Integer: marker position in alignment column coords, String: null
+ * or a String to be rendered at the position.
+ */
+ public List<Object[]> calculateMarks(int startx, int endx)
+ {
+ new ArrayList<Object[]>();
+
int scalestartx = (startx / 10) * 10;
SequenceI refSeq = av.getAlignment().getSeqrep();
}
marks.add(amark);
}
- maxX=0;
- for (Object[] mark : marks)
- {
- boolean major = Boolean.valueOf((Boolean) mark[0]);
- int mpos = ((Integer) mark[1]).intValue(); // (i - startx - 1)
- String mstring = (String) mark[2];
- if (mstring != null)
- {
- if (mpos * avCharWidth > maxX)
- {
- gg.drawString(mstring, mpos * avCharWidth, y);
- maxX = (mpos + 2) * avCharWidth + fm.stringWidth(mstring);
- }
- }
- if (major)
- {
- gg.drawLine((mpos * avCharWidth) + (avCharWidth / 2), y + 2,
- (mpos * avCharWidth) + (avCharWidth / 2), y + (yOf * 2));
- }
- else
- {
- gg.drawLine((mpos * avCharWidth) + (avCharWidth / 2), y + yOf,
- (mpos * avCharWidth) + (avCharWidth / 2), y + (yOf * 2));
- }
- }
- if (av.hasHiddenColumns())
- {
- if (reveal != null && reveal[0] > startx && reveal[0] < endx)
- {
- gg.drawString(MessageManager.getString("label.reveal_columns"),
- reveal[0] * avCharWidth, 0);
- }
- }
-
+ return marks;
}
}