- // /Shall we ignore gaps???? - JBPNote: Add Flag for forcing this or not
- StringBuffer noGapsSB = new StringBuffer();
- int insertCount = 0;
- Vector spaces = new Vector();
+ /**
+ * Answers the start-end column range of the visible region of
+ * <code>sequence</code> starting at or after the given <code>column</code>.
+ * If there are no hidden columns, this just returns the remaining width of
+ * the sequence. The range is restricted to the current <code>selection</code>
+ * if there is one. Answers null if there are no visible columns at or after
+ * <code>column</code>.
+ */
+ protected Range getNextVisibleSequenceRegion(SequenceI sequence,
+ int column)
+ {
+ int seqColStart = column;
+ int seqColEnd = sequence.getLength() - 1;
+
+ /*
+ * restrict search to (next) visible column region,
+ * in case there are hidden columns
+ */
+ AlignmentI alignment = viewport.getAlignment();
+ VisibleContigsIterator visibleRegions = alignment.getHiddenColumns()
+ .getVisContigsIterator(column, alignment.getWidth(),
+ false);
+ int[] visible = visibleRegions.hasNext() ? visibleRegions.next() : null;
+ if (visible == null)
+ {
+ columnIndex = seqColEnd + 1;
+ return null;
+ }
+ seqColStart = Math.max(seqColStart, visible[0]);
+ seqColEnd = Math.min(seqColEnd, visible[1]);