import jalview.datamodel.HiddenColumns;
import jalview.datamodel.HiddenSequences;
-import java.awt.Dimension;
import java.awt.Graphics;
-import java.awt.Rectangle;
public abstract class OverviewDimensions
{
protected float heightRatio;
- private Rectangle vpbox = new Rectangle();
-
/**
* Create an OverviewDimensions object
*
* true if the annotation panel is to be shown, false otherwise
*/
public OverviewDimensions(ViewportRanges ranges,
- boolean showAnnotationPanel, Dimension dim)
+ boolean showAnnotationPanel)
{
- if (!showAnnotationPanel)
- {
- graphHeight = 0;
- }
-
// scale the initial size of overviewpanel to shape of alignment
float initialScale = (float) ranges.getAbsoluteAlignmentWidth()
/ (float) ranges.getAbsoluteAlignmentHeight();
- if (dim != null)
+ if (!showAnnotationPanel)
{
- width = dim.width;
- sequencesHeight = dim.height;
- return;
+ graphHeight = 0;
}
+
if (ranges.getAbsoluteAlignmentWidth() > ranges
.getAbsoluteAlignmentHeight())
{
*/
public void drawBox(Graphics g)
{
- // System.out.println("OD drawBox " + boxX + " " + boxY + " " + boxWidth
- // + " " + boxHeight);
- updateBox();
g.drawRect(boxX, boxY, boxWidth, boxHeight);
g.drawRect(boxX + 1, boxY + 1, boxWidth - 2, boxHeight - 2);
}
public void setHeight(int h)
{
- // BH 2019 problem was that component.resize() can come
- // after setBoxPosition().
- // Solution was to move setting of box dimensions to paint
sequencesHeight = h - graphHeight;
heightRatio = (float) alheight / sequencesHeight;
}
int vpheight)
{
resetAlignmentDims();
- vpbox = new Rectangle(startRes, startSeq, vpwidth, vpheight);
- updateBox();
- }
- public void updateBox()
- {
// boxX, boxY is the x,y location equivalent to startRes, startSeq
- int xPos = Math.min(vpbox.x, alwidth - vpbox.width + 1);
+ int xPos = Math.min(startRes, alwidth - vpwidth + 1);
boxX = Math.round(xPos / widthRatio);
- boxY = Math.round(vpbox.y / heightRatio);
+ boxY = Math.round(startSeq / heightRatio);
// boxWidth is the width in residues translated to pixels
- boxWidth = Math.max(1, Math.round(vpbox.width / widthRatio));
+ boxWidth = Math.round(vpwidth / widthRatio);
// boxHeight is the height in sequences translated to pixels
- boxHeight = Math.max(1, Math.round(vpbox.height / heightRatio));
+ boxHeight = Math.round(vpheight / heightRatio);
}
/**