git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
90ff735
)
JAL-2778 Reduced calculation load for overview box
author
kiramt
<k.mourao@dundee.ac.uk>
Fri, 3 Nov 2017 10:50:03 +0000
(10:50 +0000)
committer
kiramt
<k.mourao@dundee.ac.uk>
Fri, 3 Nov 2017 10:50:03 +0000
(10:50 +0000)
src/jalview/viewmodel/OverviewDimensions.java
patch
|
blob
|
history
src/jalview/viewmodel/OverviewDimensionsHideHidden.java
patch
|
blob
|
history
src/jalview/viewmodel/OverviewDimensionsShowHidden.java
patch
|
blob
|
history
diff --git
a/src/jalview/viewmodel/OverviewDimensions.java
b/src/jalview/viewmodel/OverviewDimensions.java
index
170f4e9
..
d7f2e61
100644
(file)
--- a/
src/jalview/viewmodel/OverviewDimensions.java
+++ b/
src/jalview/viewmodel/OverviewDimensions.java
@@
-58,6
+58,10
@@
public abstract class OverviewDimensions
protected int alheight;
protected int alheight;
+ protected float widthRatio;
+
+ protected float heightRatio;
+
/**
* Create an OverviewDimensions object
*
/**
* Create an OverviewDimensions object
*
diff --git
a/src/jalview/viewmodel/OverviewDimensionsHideHidden.java
b/src/jalview/viewmodel/OverviewDimensionsHideHidden.java
index
c158ce7
..
1cc42bb
100644
(file)
--- a/
src/jalview/viewmodel/OverviewDimensionsHideHidden.java
+++ b/
src/jalview/viewmodel/OverviewDimensionsHideHidden.java
@@
-64,8
+64,8
@@
public class OverviewDimensionsHideHidden extends OverviewDimensions
// calculate translation in pixel terms:
// get mouse location in viewport coords, add translation in viewport
// coords, and update viewport as usual
// calculate translation in pixel terms:
// get mouse location in viewport coords, add translation in viewport
// coords, and update viewport as usual
- int vpx = Math.round((float) mousex * alwidth / width);
- int vpy = Math.round((float) mousey * alheight / sequencesHeight);
+ int vpx = Math.round(mousex * widthRatio);
+ int vpy = Math.round(mousey * heightRatio);
updateViewportFromTopLeft(vpx + xdiff, vpy + ydiff, hiddenSeqs,
hiddenCols);
updateViewportFromTopLeft(vpx + xdiff, vpy + ydiff, hiddenSeqs,
hiddenCols);
@@
-162,19
+162,22
@@
public class OverviewDimensionsHideHidden extends OverviewDimensions
{
alwidth = ranges.getVisibleAlignmentWidth();
alheight = ranges.getVisibleAlignmentHeight();
{
alwidth = ranges.getVisibleAlignmentWidth();
alheight = ranges.getVisibleAlignmentHeight();
+
+ widthRatio = (float) alwidth / width;
+ heightRatio = (float) alheight / sequencesHeight;
}
@Override
protected int getLeftXFromCentreX(int mousex, HiddenColumns hidden)
{
}
@Override
protected int getLeftXFromCentreX(int mousex, HiddenColumns hidden)
{
- int vpx = Math.round((float) mousex * alwidth / width);
+ int vpx = Math.round(mousex * widthRatio);
return vpx - ranges.getViewportWidth() / 2;
}
@Override
protected int getTopYFromCentreY(int mousey, HiddenSequences hidden)
{
return vpx - ranges.getViewportWidth() / 2;
}
@Override
protected int getTopYFromCentreY(int mousey, HiddenSequences hidden)
{
- int vpy = Math.round((float) mousey * alheight / sequencesHeight);
+ int vpy = Math.round(mousey * heightRatio);
return vpy - ranges.getViewportHeight() / 2;
}
return vpy - ranges.getViewportHeight() / 2;
}
@@
-184,8
+187,8
@@
public class OverviewDimensionsHideHidden extends OverviewDimensions
{
// get alignment position of x and box (can get directly from vpranges) and
// calculate difference between the positions
{
// get alignment position of x and box (can get directly from vpranges) and
// calculate difference between the positions
- int vpx = Math.round((float) x * alwidth / width);
- int vpy = Math.round((float) y * alheight / sequencesHeight);
+ int vpx = Math.round(x * widthRatio);
+ int vpy = Math.round(y * heightRatio);
xdiff = ranges.getStartRes() - vpx;
ydiff = ranges.getStartSeq() - vpy;
xdiff = ranges.getStartRes() - vpx;
ydiff = ranges.getStartSeq() - vpy;
diff --git
a/src/jalview/viewmodel/OverviewDimensionsShowHidden.java
b/src/jalview/viewmodel/OverviewDimensionsShowHidden.java
index
9dde16e
..
ec2efa2
100644
(file)
--- a/
src/jalview/viewmodel/OverviewDimensionsShowHidden.java
+++ b/
src/jalview/viewmodel/OverviewDimensionsShowHidden.java
@@
-97,10
+97,10
@@
public class OverviewDimensionsShowHidden extends OverviewDimensions
// get mouse location in viewport coords, add translation in viewport
// coords,
// convert back to pixel coords
// get mouse location in viewport coords, add translation in viewport
// coords,
// convert back to pixel coords
- int vpx = Math.round((float) mousex * alwidth / width);
+ int vpx = Math.round(mousex * widthRatio);
int visXAsRes = hiddenCols.findColumnPosition(vpx) + xdiff;
int visXAsRes = hiddenCols.findColumnPosition(vpx) + xdiff;
- int vpy = Math.round((float) mousey * alheight / sequencesHeight);
+ int vpy = Math.round(mousey * heightRatio);
int visYAsRes = hiddenSeqs.findIndexWithoutHiddenSeqs(vpy) + ydiff;
// update viewport accordingly
int visYAsRes = hiddenSeqs.findIndexWithoutHiddenSeqs(vpy) + ydiff;
// update viewport accordingly
@@
-225,12
+225,15
@@
public class OverviewDimensionsShowHidden extends OverviewDimensions
{
alwidth = ranges.getAbsoluteAlignmentWidth();
alheight = ranges.getAbsoluteAlignmentHeight();
{
alwidth = ranges.getAbsoluteAlignmentWidth();
alheight = ranges.getAbsoluteAlignmentHeight();
+
+ widthRatio = (float) alwidth / width;
+ heightRatio = (float) alheight / sequencesHeight;
}
@Override
protected int getLeftXFromCentreX(int mousex, HiddenColumns hidden)
{
}
@Override
protected int getLeftXFromCentreX(int mousex, HiddenColumns hidden)
{
- int vpx = Math.round((float) mousex * alwidth / width);
+ int vpx = Math.round(mousex * widthRatio);
return hidden.subtractVisibleColumns(ranges.getViewportWidth() / 2,
vpx);
}
return hidden.subtractVisibleColumns(ranges.getViewportWidth() / 2,
vpx);
}
@@
-238,7
+241,7
@@
public class OverviewDimensionsShowHidden extends OverviewDimensions
@Override
protected int getTopYFromCentreY(int mousey, HiddenSequences hidden)
{
@Override
protected int getTopYFromCentreY(int mousey, HiddenSequences hidden)
{
- int vpy = Math.round((float) mousey * alheight / sequencesHeight);
+ int vpy = Math.round(mousey * heightRatio);
return hidden.subtractVisibleRows(ranges.getViewportHeight() / 2, vpy);
}
return hidden.subtractVisibleRows(ranges.getViewportHeight() / 2, vpy);
}
@@
-248,8
+251,8
@@
public class OverviewDimensionsShowHidden extends OverviewDimensions
{
// get alignment position of x and box (can get directly from vpranges) and
// calculate difference between the positions
{
// get alignment position of x and box (can get directly from vpranges) and
// calculate difference between the positions
- int vpx = Math.round((float) x * alwidth / width);
- int vpy = Math.round((float) y * alheight / sequencesHeight);
+ int vpx = Math.round(x * widthRatio);
+ int vpy = Math.round(y * heightRatio);
xdiff = ranges.getStartRes() - hiddenCols.findColumnPosition(vpx);
ydiff = ranges.getStartSeq()
xdiff = ranges.getStartRes() - hiddenCols.findColumnPosition(vpx);
ydiff = ranges.getStartSeq()