git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-2808 added conditions Present, NotPresent as options
[jalview.git]
/
src
/
jalview
/
renderer
/
ScaleRenderer.java
diff --git
a/src/jalview/renderer/ScaleRenderer.java
b/src/jalview/renderer/ScaleRenderer.java
index
164c7c7
..
d92608c
100644
(file)
--- a/
src/jalview/renderer/ScaleRenderer.java
+++ b/
src/jalview/renderer/ScaleRenderer.java
@@
-34,12
+34,24
@@
import java.util.List;
*/
public class ScaleRenderer
{
*/
public class ScaleRenderer
{
- public class ScaleMark
+ /**
+ * Represents one major or minor scale mark
+ */
+ public final class ScaleMark
{
{
+ /**
+ * true for a major scale mark, false for minor
+ */
public final boolean major;
public final boolean major;
+ /**
+ * visible column position (0..) e.g. 19
+ */
public final int column;
public final int column;
+ /**
+ * text (if any) to show e.g. "20"
+ */
public final String text;
ScaleMark(boolean isMajor, int col, String txt)
public final String text;
ScaleMark(boolean isMajor, int col, String txt)
@@
-48,22
+60,30
@@
public class ScaleRenderer
column = col;
text = txt;
}
column = col;
text = txt;
}
+
+ /**
+ * String representation for inspection when debugging only
+ */
+ @Override
+ public String toString()
+ {
+ return String.format("%s:%d:%s", major ? "major" : "minor", column,
+ text);
+ }
}
/**
}
/**
- * calculate positions markers on the alignment ruler
+ * Calculates position markers on the alignment ruler
*
* @param av
* @param startx
*
* @param av
* @param startx
- * left-most column in visible view
+ * left-most column in visible view (0..)
* @param endx
* @param endx
- * - right-most column in visible view
- * @return List of ScaleMark holding boolean: true/false for major/minor mark,
- * marker position in alignment column coords, a String to be rendered
- * at the position (or null)
+ * - right-most column in visible view (0..)
+ * @return
*/
*/
- public List<ScaleMark> calculateMarks(AlignViewportI av,
- int startx, int endx)
+ public List<ScaleMark> calculateMarks(AlignViewportI av, int startx,
+ int endx)
{
int scalestartx = (startx / 10) * 10;
{
int scalestartx = (startx / 10) * 10;
@@
-73,7
+93,7
@@
public class ScaleRenderer
{
// find bounds and set origin appopriately
// locate first visible position for this sequence
{
// find bounds and set origin appopriately
// locate first visible position for this sequence
- int[] refbounds = av.getColumnSelection()
+ int[] refbounds = av.getAlignment().getHiddenColumns()
.locateVisibleBoundsOfSequence(refSeq);
refSp = refbounds[0];
.locateVisibleBoundsOfSequence(refSeq);
refSp = refbounds[0];
@@
-87,39
+107,40
@@
public class ScaleRenderer
scalestartx += 5;
}
List<ScaleMark> marks = new ArrayList<ScaleMark>();
scalestartx += 5;
}
List<ScaleMark> marks = new ArrayList<ScaleMark>();
- String string;
- int refN, iadj;
// todo: add a 'reference origin column' to set column number relative to
// todo: add a 'reference origin column' to set column number relative to
- for (int i = scalestartx; i < endx; i += 5)
+ for (int i = scalestartx; i <= endx; i += 5)
{
if (((i - refSp) % 10) == 0)
{
{
if (((i - refSp) % 10) == 0)
{
+ String text;
if (refSeq == null)
{
if (refSeq == null)
{
- iadj = av.getColumnSelection().adjustForHiddenColumns(i - 1) + 1;
- string = String.valueOf(iadj);
+ int iadj = av.getAlignment().getHiddenColumns()
+ .adjustForHiddenColumns(i - 1) + 1;
+ text = String.valueOf(iadj);
}
else
{
}
else
{
- iadj = av.getColumnSelection().adjustForHiddenColumns(i - 1);
- refN = refSeq.findPosition(iadj);
+ int iadj = av.getAlignment().getHiddenColumns()
+ .adjustForHiddenColumns(i - 1);
+ int refN = refSeq.findPosition(iadj);
// TODO show bounds if position is a gap
// - ie L--R -> "1L|2R" for
// marker
if (iadj < refStartI)
{
// TODO show bounds if position is a gap
// - ie L--R -> "1L|2R" for
// marker
if (iadj < refStartI)
{
- string = String.valueOf(iadj - refStartI);
+ text = String.valueOf(iadj - refStartI);
}
else if (iadj > refEndI)
{
}
else if (iadj > refEndI)
{
- string = "+" + String.valueOf(iadj - refEndI);
+ text = "+" + String.valueOf(iadj - refEndI);
}
else
{
}
else
{
- string = String.valueOf(refN) + refSeq.getCharAt(iadj);
+ text = String.valueOf(refN) + refSeq.getCharAt(iadj);
}
}
}
}
- marks.add(new ScaleMark(true, i - startx - 1, string));
+ marks.add(new ScaleMark(true, i - startx - 1, text));
}
else
{
}
else
{