From 7823886135453ef0f72bfc8764cf1cb4431ebc20 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 26 Sep 2019 14:52:52 +0100 Subject: [PATCH] JAL-3383 code tidying --- src/jalview/datamodel/Alignment.java | 4 - src/jalview/renderer/OverviewRenderer.java | 116 +++++++++++++--------------- 2 files changed, 55 insertions(+), 65 deletions(-) diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 26379d3..599d3a9 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -2041,10 +2041,6 @@ public class Alignment implements AlignmentI { sequences.get(i).resetColors(); } - // if (dataset != null) - // { - // dataset.resetColors(); - // } } } diff --git a/src/jalview/renderer/OverviewRenderer.java b/src/jalview/renderer/OverviewRenderer.java index 28221e4..f99a7ee 100644 --- a/src/jalview/renderer/OverviewRenderer.java +++ b/src/jalview/renderer/OverviewRenderer.java @@ -50,18 +50,18 @@ import javax.swing.Timer; public class OverviewRenderer { + public static final String UPDATE = "OverviewUpdate"; + // transparency of hidden cols/seqs overlay private static final float TRANSPARENCY = 0.5f; - public static final String UPDATE = "OverviewUpdate"; - private static final int MAX_PROGRESS = 100; - final static int STATE_INIT = 0; + private static final int STATE_INIT = 0; - final static int STATE_NEXT = 1; + private static final int STATE_NEXT = 1; - final static int STATE_DONE = 2; + private static final int STATE_DONE = 2; private int state; @@ -128,7 +128,29 @@ public class OverviewRenderer private AlignmentViewPanel panel; - // private int sequencesHeight; + private int ndone = 0; + + private AlignmentRowsCollectionI rows; + + private AlignmentColsCollectionI cols; + + private Iterator rowIterator; + + private int alignmentHeight; + + private int totalPixels; + + private int lastRowUpdate; + + private int lastUpdate; + + private int[] pixels; + + private BitSet bscol; + + private final int w; + + private final int h; public OverviewRenderer(AlignmentViewPanel panel, jalview.api.FeatureRenderer fr, OverviewDimensions od, @@ -153,28 +175,25 @@ public class OverviewRenderer AlignmentI alignment, ResidueShaderI resshader, OverviewResColourFinder colFinder, boolean showProgress) { - { - this.panel = panel; - finder = new FeatureColourFinder(fr); - al = alignment; - shader = resshader; - resColFinder = colFinder; - this.showProgress = showProgress; - - w = od.getWidth(); - h = od.getHeight(); - rows = od.getRows(alignment); - cols = od.getColumns(alignment); - graphHeight = od.getGraphHeight(); - alignmentHeight = od.getSequencesHeight(); - - pixelsPerSeq = od.getPixelsPerSeq(); - pixelsPerCol = od.getPixelsPerCol(); - colsPerPixel = Math.max(1, 1f / pixelsPerCol); - - skippingColumns = (pixelsPerCol < 1); - - } + this.panel = panel; + finder = new FeatureColourFinder(fr); + al = alignment; + shader = resshader; + resColFinder = colFinder; + this.showProgress = showProgress; + + w = od.getWidth(); + h = od.getHeight(); + rows = od.getRows(alignment); + cols = od.getColumns(alignment); + graphHeight = od.getGraphHeight(); + alignmentHeight = od.getSequencesHeight(); + + pixelsPerSeq = od.getPixelsPerSeq(); + pixelsPerCol = od.getPixelsPerCol(); + colsPerPixel = Math.max(1, 1f / pixelsPerCol); + + skippingColumns = (pixelsPerCol < 1); } /** @@ -423,16 +442,6 @@ public class OverviewRenderer : Math.round(icol * pixelsPerCol), w); } - private ActionListener listener = new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - mainLoop(); - } - - }; - private boolean loop() { if (delay <= 0) @@ -441,7 +450,14 @@ public class OverviewRenderer } if (timer == null) { - timer = new Timer(delay, listener); + timer = new Timer(delay, new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + mainLoop(); + } + }); timer.setRepeats(false); timer.start(); } @@ -482,28 +498,6 @@ public class OverviewRenderer panel.overviewDone(miniMe); } - int ndone = 0; - - private AlignmentRowsCollectionI rows; - - private AlignmentColsCollectionI cols; - - Iterator 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 -- 1.7.10.2