import jalview.api.AlignmentColsCollectionI;
import jalview.api.AlignmentRowsCollectionI;
import jalview.datamodel.AlignmentI;
-import jalview.datamodel.AllColsCollection;
-import jalview.datamodel.AllRowsCollection;
-import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.HiddenColumns;
import jalview.datamodel.HiddenSequences;
+import jalview.datamodel.VisibleColsCollection;
+import jalview.datamodel.VisibleRowsCollection;
public class OverviewDimensionsAllVisible extends OverviewDimensions
{
- private float pixelsPerCol;
-
- private float pixelsPerSeq;
+ private ViewportRanges alRanges;
public OverviewDimensionsAllVisible(ViewportRanges ranges,
boolean showAnnotationPanel)
{
super(ranges, showAnnotationPanel);
-
- int alwidth = ranges.getVisibleAlignmentWidth();
- int alheight = ranges.getVisibleAlignmentHeight();
-
- pixelsPerCol = (float) width / alwidth;
- pixelsPerSeq = (float) sequencesHeight / alheight;
+ alRanges = ranges;
+ resetAlignmentDims();
}
@Override
public void updateViewportFromMouse(int mousex, int mousey,
- HiddenSequences hiddenSeqs, ColumnSelection hiddenCols,
- ViewportRanges ranges)
+ HiddenSequences hiddenSeqs, HiddenColumns hiddenCols)
{
+ resetAlignmentDims();
+
int x = mousex;
int y = mousey;
- int alwidth = ranges.getVisibleAlignmentWidth();
- int alheight = ranges.getVisibleAlignmentHeight();
-
if (x < 0)
{
x = 0;
int xAsRes = Math.round((float) x * alwidth / width);
// get viewport width in residues
- int vpwidth = ranges.getEndRes() - ranges.getStartRes() + 1;
+ int vpwidth = alRanges.getEndRes() - alRanges.getStartRes() + 1;
if (xAsRes + vpwidth > alwidth)
{
// get viewport height in sequences
// add 1 because height includes both endSeq and startSeq
- int vpheight = ranges.getEndSeq() - ranges.getStartSeq() + 1;
+ int vpheight = alRanges.getEndSeq() - alRanges.getStartSeq() + 1;
if (yAsSeq + vpheight > alheight)
{
@Override
public void setBoxPosition(HiddenSequences hiddenSeqs,
- ColumnSelection hiddenCols, ViewportRanges ranges)
+ HiddenColumns hiddenCols)
{
- int alwidth = ranges.getVisibleAlignmentWidth();
- int alheight = ranges.getVisibleAlignmentHeight();
+ resetAlignmentDims();
// work with visible values of startRes and endRes
- int startRes = ranges.getStartRes();
- int endRes = ranges.getEndRes();
+ int startRes = alRanges.getStartRes();
+ int endRes = alRanges.getEndRes();
// work with visible values of startSeq and endSeq
- int startSeq = ranges.getStartSeq();
- int endSeq = ranges.getEndSeq();
+ int startSeq = alRanges.getStartSeq();
+ int endSeq = alRanges.getEndSeq();
// boxX, boxY is the x,y location equivalent to startRes, startSeq
boxX = Math.round((float) startRes * width / alwidth);
}
@Override
- public AlignmentColsCollectionI getColumns(ViewportRanges ranges,
- ColumnSelection hiddenCols)
- {
- return new AllColsCollection(0,
- ranges.getVisibleAlignmentWidth() - 1, hiddenCols);
- }
-
- @Override
- public AlignmentRowsCollectionI getRows(ViewportRanges ranges,
- AlignmentI al)
+ public AlignmentColsCollectionI getColumns(HiddenColumns hiddenCols)
{
- return new AllRowsCollection(0,
- ranges.getVisibleAlignmentHeight() - 1, al);
+ return new VisibleColsCollection(0,
+ alRanges.getAbsoluteAlignmentWidth() - 1, hiddenCols);
}
@Override
- public float getPixelsPerCol()
+ public AlignmentRowsCollectionI getRows(AlignmentI al)
{
- return pixelsPerCol;
+ return new VisibleRowsCollection(0,
+ alRanges.getAbsoluteAlignmentHeight() - 1, al);
}
@Override
- public float getPixelsPerSeq()
+ protected void resetAlignmentDims()
{
- return pixelsPerSeq;
+ alwidth = alRanges.getVisibleAlignmentWidth();
+ alheight = alRanges.getVisibleAlignmentHeight();
}
}