}
}
+ public void drawWrappedSelection(Graphics2D g, SequenceGroup group,
+ int canvasWidth,
+ int canvasHeight, int startRes)
+ {
+ int hgap = charHeight;
+ if (av.getScaleAboveWrapped())
+ {
+ hgap += charHeight;
+ }
+
+ int cWidth = (canvasWidth - LABEL_EAST - LABEL_WEST) / charWidth;
+ int cHeight = av.getAlignment().getHeight() * charHeight;
+
+ int endx;
+ int ypos = hgap;
+ int maxwidth = av.getAlignment().getWidth();
+
+ if (av.hasHiddenColumns())
+ {
+ maxwidth = av.getAlignment().getHiddenColumns()
+ .findColumnPosition(maxwidth);
+ }
+
+ while ((ypos <= canvasHeight) && (startRes < maxwidth))
+ {
+ endx = startRes + cWidth - 1;
+
+ if (endx > maxwidth)
+ {
+ endx = maxwidth;
+ }
+
+ g.translate(LABEL_WEST, 0);
+
+ drawUnwrappedSelection(g, group, startRes, endx, 0,
+ av.getAlignment().getHeight() - 1,
+ ypos);
+
+ g.translate(-LABEL_WEST, 0);
+
+ ypos += cHeight + getAnnotationHeight() + hgap;
+
+ startRes += cWidth;
+ }
+ }
+
AnnotationPanel annotations;
int getAnnotationHeight()
return null;
}
- if (!av.getWrapAlignment())
+ /*if (!av.getWrapAlignment())
{
LABEL_EAST = 0;
LABEL_WEST = 0;
- }
+ }*/
// set up drawing colour
Graphics2D g = (Graphics2D) selectionImage.getGraphics();
- g.translate(LABEL_WEST, 0);
+ // g.translate(LABEL_WEST, 0);
// set background to transparent
g.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR, 0.0f));
g.fillRect(0, 0, selectionImage.getWidth(), selectionImage.getHeight());
{ 5f, 3f }, 0f));
g.setColor(Color.RED);
+ if (!av.getWrapAlignment())
+ {
+ drawUnwrappedSelection(g, group, startRes, endRes, startSeq, endSeq,
+ 0);
+ }
+ else
+ {
+ drawWrappedSelection(g, group, getWidth(), getHeight(),
+ av.getRanges().getStartRes());
+ }
+
+ g.dispose();
+ return selectionImage;
+ }
+
+ private void drawUnwrappedSelection(Graphics2D g, SequenceGroup group,
+ int startRes, int endRes, int startSeq, int endSeq, int offset)
+ {
if (!av.hasHiddenColumns())
{
- drawSelectionGroupPart(g, group, startRes, endRes, startSeq, endSeq);
+ drawSelectionGroupPart(g, group, startRes, endRes, startSeq, endSeq,
+ offset);
}
else
{
g.translate(screenY * charWidth, 0);
drawSelectionGroupPart(g, group,
- blockStart, blockEnd, startSeq, endSeq);
+ blockStart, blockEnd, startSeq, endSeq, offset);
g.translate(-screenY * charWidth, 0);
screenY += blockEnd - blockStart + 1;
blockEnd = blockStart + (endRes - startRes) - screenY;
g.translate(screenY * charWidth, 0);
drawSelectionGroupPart(g, group,
- blockStart, blockEnd, startSeq, endSeq);
+ blockStart, blockEnd, startSeq, endSeq, offset);
g.translate(-screenY * charWidth, 0);
}
}
- g.translate(-LABEL_WEST, 0);
- g.dispose();
- return selectionImage;
+ // g.translate(-LABEL_WEST, 0);
}
/*
* Draw the selection group as a separate image and overlay
*/
private void drawSelectionGroupPart(Graphics2D g, SequenceGroup group,
- int startRes, int endRes, int startSeq, int endSeq)
+ int startRes, int endRes, int startSeq, int endSeq,
+ int verticalOffset)
{
// set up values in case the alignment is wrapped
- int verticalOffset = 0;
+ /*int verticalOffset = 0;
int horizontalOffset = 0;
if (av.getWrapAlignment())
{
// vertical offset is increased by slice number * number of sequences * height of each sequence
verticalOffset = slice * (av.getAlignment().getHeight() * charHeight
+ getAnnotationHeight() + hgap) + hgap;
-
+
// horizontal offset is number of residues to subtract from group residue
// position
horizontalOffset = (slice * cWidth);
- }
+ }*/
int visWidth = (endRes - startRes + 1) * charWidth;
int ex = -1;
// position of start residue of group relative to startRes, in pixels
- sx = (group.getStartRes() - startRes - horizontalOffset) * charWidth;
+ sx = (group.getStartRes() - startRes) * charWidth;
// width of group in pixels
- ex = (((group.getEndRes() + 1) - group.getStartRes() - horizontalOffset)
+ ex = (((group.getEndRes() + 1) - group.getStartRes())
* charWidth) - 1;
for (i = startSeq; i <= endSeq; i++)