import jalview.datamodel.AlignmentI;
import jalview.datamodel.HiddenColumns;
+import jalview.datamodel.HiddenColumns.VisibleBlocksVisBoundsIterator;
import jalview.datamodel.SearchResultsI;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
else
{
int screenY = 0;
- final int screenYMax = endRes - startRes;
int blockStart = startRes;
- int blockEnd = endRes; // equals blockStart + screenYMax - screenY;
+ int blockEnd = endRes;
HiddenColumns hidden = av.getAlignment().getHiddenColumns();
- Iterator<int[]> regions = hidden.iterator();
+ VisibleBlocksVisBoundsIterator regions = (VisibleBlocksVisBoundsIterator) hidden
+ .getVisibleBlocksIterator(startRes, endRes, true);
+
while (regions.hasNext())
{
int[] region = regions.next();
- int hideStart = region[0];
- int hideEnd = region[1];
-
- if (hideStart <= blockStart)
- {
- blockStart += (hideEnd - hideStart) + 1;
- blockEnd += (hideEnd - hideStart) + 1;
- continue;
- }
+ blockEnd = region[1];
+ blockStart = region[0];
/*
* draw up to just before the next hidden region, or the end of
* the visible region, whichever comes first
*/
- blockEnd = Math.min(blockEnd, hideStart - 1);
g1.translate(screenY * avcharWidth, 0);
draw(g1, blockStart, blockEnd, startSeq, endSeq, offset);
* draw the downline of the hidden column marker (ScalePanel draws the
* triangle on top) if we reached it
*/
- if (av.getShowHiddenMarkers() && blockEnd == hideStart - 1)
+ if (av.getShowHiddenMarkers()
+ && (regions.hasNext() || regions.endsAtHidden()))
{
g1.setColor(Color.blue);
g1.drawLine((blockEnd - blockStart + 1) * avcharWidth - 1,
g1.translate(-screenY * avcharWidth, 0);
screenY += blockEnd - blockStart + 1;
- blockStart = hideEnd + 1;
- blockEnd = blockStart + screenYMax - screenY;
-
- if (screenY > screenYMax)
- {
- // already rendered last block
- return;
- }
- }
-
- if (screenY <= screenYMax)
- {
- // remaining visible region to render
- g1.translate(screenY * avcharWidth, 0);
- draw(g1, blockStart, blockEnd, startSeq, endSeq, offset);
- g1.translate(-screenY * avcharWidth, 0);
}
}
}
private int currentPosition = 0;
- private boolean endsAtHidden = true;
+ private boolean endsAtHidden = false;
VisibleBlocksVisBoundsIterator(int start, int end, boolean usecopy)
{
int hiddenSoFar = 0;
int visSoFar = 0;
int maxVisible = end - start;
+ endsAtHidden = false;
// iterate until a region begins within (start,end]
int i = 0;
visSoFar += blockEnd - blockStart + 1;
blockStart = region[1] + 1;
- blockEnd = end + hiddenSoFar;
+
hiddenSoFar += region[1] - region[0] + 1;
+ blockEnd = end + hiddenSoFar;
i++;
}
if (visSoFar < maxVisible)
{
blockEnd = blockStart + maxVisible - visSoFar;
- int[] contig = new int[] { blockStart,
- blockEnd };
+ int[] contig = new int[] { blockStart, blockEnd };
vcontigs.add(contig);
- endsAtHidden = false;
+ if (i < hiddenColumns.size()
+ && hiddenColumns.get(i)[0] - 1 == blockEnd)
+ {
+ endsAtHidden = true;
+ }
}
}
else
{
+ // there are no hidden columns, return a single visible contig
int[] contig = new int[] { start, end };
vcontigs.add(contig);
endsAtHidden = false;
else
{
int screenY = 0;
- final int screenYMax = endRes - startRes;
int blockStart = startRes;
- int blockEnd = endRes; // equals blockStart + screenYMax - screenY;
+ int blockEnd = endRes;
HiddenColumns hidden = av.getAlignment().getHiddenColumns();
VisibleBlocksVisBoundsIterator regions = (VisibleBlocksVisBoundsIterator) hidden
- .getVisibleBlocksIterator(startRes, endRes, true);// hidden.iterator();
+ .getVisibleBlocksIterator(startRes, endRes, true);
+
while (regions.hasNext())
{
int[] region = regions.next();
blockEnd = region[1];
blockStart = region[0];
-/* int hideStart = region[0];
- int hideEnd = region[1];
- if (hideStart <= blockStart)
- {
- blockStart += (hideEnd - hideStart) + 1; // convert startRes to an
- // absolute value
- blockEnd += (hideEnd - hideStart) + 1;
- continue;
- }
-*/
/*
* draw up to just before the next hidden region, or the end of
* the visible region, whichever comes first
*/
-// blockEnd = Math.min(hideStart - 1,
-// blockEnd);
g1.translate(screenY * charWidth, 0);
draw(g1, blockStart, blockEnd, startSeq, endSeq, yOffset);
* triangle on top) if we reached it
*/
if (av.getShowHiddenMarkers()
- && (regions.hasNext() || regions.endsAtHidden()))// blockEnd ==
- // hideStart - 1)
+ && (regions.hasNext() || regions.endsAtHidden()))
{
g1.setColor(Color.blue);
g1.translate(-screenY * charWidth, 0);
screenY += blockEnd - blockStart + 1;
- /* blockStart = hideEnd + 1;
- blockEnd = blockStart + screenYMax - screenY;
-
- if (screenY > screenYMax)
- {
- // already rendered last block
- return;
- }*/
}
-
- /* if (screenY <= screenYMax)
- {
- // remaining visible region to render
- blockEnd = blockStart + screenYMax - screenY;
- g1.translate(screenY * charWidth, 0);
- draw(g1, blockStart, blockEnd, startSeq, endSeq, yOffset);
-
- g1.translate(-screenY * charWidth, 0);
- }*/
}
}
int blockEnd = endRes;
HiddenColumns hidden = av.getAlignment().getHiddenColumns();
- Iterator<int[]> regions = hidden.iterator();
+ VisibleBlocksVisBoundsIterator regions = (VisibleBlocksVisBoundsIterator) hidden
+ .getVisibleBlocksIterator(startRes, endRes, true);
while (regions.hasNext())
{
int[] region = regions.next();
- int hideStart = region[0];
- int hideEnd = region[1];
-
- if (hideStart <= blockStart)
- {
- blockStart += (hideEnd - hideStart) + 1;
- continue;
- }
-
- blockEnd = hideStart - 1;
+ blockEnd = region[1];
+ blockStart = region[0];
g.translate(screenY * charWidth, 0);
drawPartialGroupOutline(g, group,
g.translate(-screenY * charWidth, 0);
screenY += blockEnd - blockStart + 1;
- blockStart = hideEnd + 1;
-
- if (screenY > (endRes - startRes))
- {
- // already rendered last block
- break;
- }
- }
-
- if (screenY <= (endRes - startRes))
- {
- // remaining visible region to render
- blockEnd = blockStart + (endRes - startRes) - screenY;
- g.translate(screenY * charWidth, 0);
- drawPartialGroupOutline(g, group,
- blockStart, blockEnd, startSeq, endSeq, offset);
-
- g.translate(-screenY * charWidth, 0);
}
}
}