Skip to content
Snippets Groups Projects
Commit fccdb5c8 authored by tjc's avatar tjc
Browse files

fix arrow heads

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@8584 ee4ac58c-ac51-4696-9907-e4b3aa274f04
parent 077bc660
No related branches found
No related tags found
No related merge requests found
......@@ -390,24 +390,14 @@ public class Block implements Transferable
BasicStroke.JOIN_MITER);
g2.setStroke(basicstroke);
/*if(arrowHead)
if(arrowTail)
{
xend-=strokeSize2;
int[] xPoints = {xend,xend,xend+(int)strokeSize};
int[] yPoints = {ymid+(int)strokeSize,ymid-(int)strokeSize,ymid};
int[] xPoints = {xstart+(int)strokeSize,xstart+(int)strokeSize,xstart};
int[] yPoints = {ypos+(int)strokeSize,ypos-(int)strokeSize,ypos};
xstart+=strokeSize/2;
g2.fillPolygon(xPoints,yPoints,3);
g2.drawLine(xstart,ymid,xend,ymid);
}
else if(arrowTail)
{
xstart+=strokeSize2;
int[] xPoints = {xstart,xstart,xstart-(int)strokeSize};
int[] yPoints = {ymid+(int)strokeSize,ymid-(int)strokeSize,ymid};
g2.fillPolygon(xPoints,yPoints,3);
g2.drawLine(xstart,ymid,xend,ymid);
}
else*/
if(rect == null)
rect = new Vector();
......@@ -441,6 +431,14 @@ public class Block implements Transferable
xstart = borderWidth2;
}
if(arrowHead)
{
int[] xPoints = {xend-(int)strokeSize,xend-(int)strokeSize,xend};
int[] yPoints = {ypos+(int)strokeSize,ypos-(int)strokeSize,ypos};
xend-=strokeSize/2;
g2.fillPolygon(xPoints,yPoints,3);
}
g2.drawLine(xstart,ypos,xend,ypos);
r = new Rectangle();
......@@ -484,58 +482,57 @@ public class Block implements Transferable
AffineTransform origin = g2.getTransform();
AffineTransform newOrig = (AffineTransform)(origin.clone());
//angle taken by brush stroke
double stroke = Math.toDegrees(Math.asin(getStrokeSize()/(dradii)));
double stroke2 = stroke/2.d;
angStart = current_dna.getAngleFromPosition(bstart,rad) ;
angEnd = current_dna.getAngleFromPosition(bend,rad) - angStart;
double shift = dradii*(1.d-getTrack().getPosition());
double bdiameter = ddiameter*getTrack().getPosition();
//
// to avoid rounding problems convert to int's
int strokeInt2 = Math.round(getStrokeSize()/2.f);
int strokeInt = strokeInt2*2;
int d2 = (int)(bdiameter/2.d);
int d = d2*2;
int locx = location.x+(int)shift;
int locy = location.y+(int)shift;
if(arrowHead)
{
angEnd += stroke2;
newOrig.rotate(Math.toRadians(-angStart-angEnd),
widthPanel/2.d,heightPanel/2.d);
angEnd += stroke2/3.d;
int xmid = location.x+(int)(ddiameter-shift);
locx+d2,locy+d2);
int xmid = locx+d;
int ymid = location.y+(int)(dradii);
int[] xPoints = {xmid-(int)getStrokeSize(),xmid+(int)getStrokeSize(),xmid};
int[] yPoints = {ymid,ymid,ymid+(int)getStrokeSize()};
int[] xPoints = {xmid-strokeInt,xmid+strokeInt,xmid};
int[] yPoints = {ymid-strokeInt,ymid-strokeInt,ymid};
g2.setTransform(newOrig);
g2.fillPolygon(xPoints,yPoints,3);
angEnd += Math.toDegrees(Math.atan(((float)(strokeInt)*0.8f)/(float)d2));
}
else if(arrowTail)
{
angStart += stroke2;
newOrig.rotate(Math.toRadians(-angStart),
widthPanel/2.d,heightPanel/2.d);
angStart -= stroke;
angEnd += stroke2;
locx+d2,locy+d2);
int xmid = location.x+(int)(ddiameter-shift);
int xmid = locx+d;
int ymid = location.y+(int)(dradii);
int[] xPoints = {xmid-(int)getStrokeSize(),xmid+(int)getStrokeSize(),xmid};
int[] yPoints = {ymid+(int)getStrokeSize(),ymid+(int)getStrokeSize(),ymid};
int[] xPoints = {xmid-strokeInt,xmid+strokeInt,xmid};
int[] yPoints = {ymid+strokeInt,ymid+strokeInt,ymid};
g2.setTransform(newOrig);
g2.fillPolygon(xPoints,yPoints,3);
double adj = Math.toDegrees(Math.atan(((float)strokeInt*0.8f)/(float)d2));
angStart -= adj;
angEnd += adj;
}
g2.setTransform(origin);
// double arcLength = Math.toRadians(angEnd)*(bdiameter/2.);
//
// to avoid rounding problems convert to int's
int strokeInt2 = Math.round(getStrokeSize()/2.f);
int strokeInt = strokeInt2*2;
int d2 = (int)(bdiameter/2.d);
int d = d2*2;
int locx = location.x+(int)shift;
int locy = location.y+(int)shift;
// if too small draw arc as a line
if(Math.abs(angEnd) < 0.5d)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment