JAL-2388 Tidies and unit tests
[jalview.git] / src / jalview / viewmodel / OverviewDimensions.java
index eb4a6e6..a837d53 100644 (file)
@@ -202,8 +202,7 @@ public abstract class OverviewDimensions
    *          the alignment's hidden columns
    * @return a column collection
    */
-  public abstract AlignmentColsCollectionI getColumns(
-          HiddenColumns hiddenCols);
+  public abstract AlignmentColsCollectionI getColumns(AlignmentI al);
 
   /**
    * Get the collection of rows used by this overview dimensions object
@@ -218,4 +217,23 @@ public abstract class OverviewDimensions
    * Updates overview dimensions to account for current alignment dimensions
    */
   protected abstract void resetAlignmentDims();
+
+  protected void setBoxPosition(int startRes, int endRes, int startSeq,
+          int endSeq)
+  {
+    resetAlignmentDims();
+
+    // boxX, boxY is the x,y location equivalent to startRes, startSeq
+    boxX = Math.round((float) startRes * width / alwidth);
+    boxY = Math.round((float) startSeq * sequencesHeight / alheight);
+
+    // boxWidth is the width in residues translated to pixels
+    // since the box includes both the start and end residues, add 1 to the
+    // difference
+    boxWidth = Math
+            .round((float) (endRes - startRes + 1) * width / alwidth);
+    // boxHeight is the height in sequences translated to pixels
+    boxHeight = Math.round((float) (endSeq - startSeq + 1)
+            * sequencesHeight / alheight);
+  }
 }
\ No newline at end of file