+ * The next column is either the next set bit (when there are multiple pixels
+ * per column) or the next set bit for the column that aligns with the next
+ * pixel (when there are more columns than pixels).
+ *
+ * @param icol
+ * @param pixel
+ * @return
+ */
+ private int getNextCol(int icol, int pixel)
+ {
+ return bscol.nextSetBit(
+ pixelsPerCol >= 1 ? icol + 1 : (int) (pixel * colsPerPixel));
+ }
+
+ private int getNextPixel(int icol, int pixel)
+ {
+ return Math.min(
+ pixelsPerCol >= 1 || pixel == 0
+ ? Math.round(icol * pixelsPerCol)
+ : pixel,
+ w);
+ }
+
+ private ActionListener listener = new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ mainLoop();
+ }
+
+ };
+
+ private boolean loop()
+ {
+ if (delay <= 0)
+ {
+ return false;
+ }
+ if (timer == null)
+ {
+ timer = new Timer(delay, listener);
+ timer.setRepeats(false);
+ timer.start();
+ }
+ else
+ {
+ timer.restart();
+ }
+ return true;
+ }
+
+ private void done()
+ {
+ if (!redraw)
+ {
+ Platform.timeCheck(
+ "overviewrender " + ndone + " pixels row:" + row + " redraw:"
+ + redraw,
+ Platform.TIME_MARK);
+ }
+
+ overlayHiddenRegions();
+ if (showProgress)
+ {
+ // final update to progress bar if present
+ if (redraw)
+ {
+ // aborted in Java
+ // BH was pixelRow - 1, but that could go negative
+ sendProgressUpdate(pixelRow, alignmentHeight, 0, 0);
+ }
+ else
+ {
+ // sendProgressUpdate(alignmentHeight, miniMe.getHeight(), 0, 0);
+ sendProgressUpdate(1, 1, 0, 0);
+ }
+ }
+ panel.overviewDone(miniMe);
+ }
+
+ int ndone = 0;
+
+ private AlignmentRowsCollectionI rows;
+
+ private AlignmentColsCollectionI cols;
+
+ Iterator<Integer> rowIterator;
+
+ int alignmentHeight;
+
+ int totalPixels;
+
+ int lastRowUpdate;
+
+ int lastUpdate;
+
+ int[] pixels;
+
+ BitSet bscol;
+
+ int w, h;
+
+ /*
+ * Calculate progress update value and fire event
+ * @param rowOffset number of rows to offset calculation by
+ * @return new rowOffset - return value only to be used when at end of a row
+ */
+ private int sendProgressUpdate(int position, int maximum, int rowOffset,
+ int lastUpdate)
+ {
+ int newUpdate = rowOffset
+ + Math.round(MAX_PROGRESS * ((float) position / maximum));
+ if (newUpdate > lastUpdate)
+ {
+ changeSupport.firePropertyChange(UPDATE, rowOffset, newUpdate);
+ return newUpdate;
+ }
+ return newUpdate;
+ }
+
+ /*
+ * Find the RGB value of the colour of a sequence at a specified column position