Skip to content
Snippets Groups Projects
Commit 52314760 authored by Irina LEE's avatar Irina LEE
Browse files

update add a arrow in connector

parent 4ffcf3e8
No related branches found
No related tags found
1 merge request!72Syscams
...@@ -42,9 +42,11 @@ import ui.*; ...@@ -42,9 +42,11 @@ import ui.*;
import ui.util.IconManager; import ui.util.IconManager;
import java.awt.*; import java.awt.*;
import java.awt.geom.Line2D; import java.awt.geom.Point2D;
import java.util.Vector; import java.util.Vector;
import myutil.GraphicLib;
/** /**
* Class SysCAMSPortConnector * Class SysCAMSPortConnector
* Connector used in SystemC-AMS Component task diagrams * Connector used in SystemC-AMS Component task diagrams
...@@ -104,27 +106,10 @@ public class SysCAMSPortConnector extends TGConnector implements ScalableTGComp ...@@ -104,27 +106,10 @@ public class SysCAMSPortConnector extends TGConnector implements ScalableTGComp
g.setFont(fold); g.setFont(fold);
} }
} }
double phi = Math.toRadians(40); if (Point2D.distance(x1, y1, x2, y2) < GraphicLib.longueur * 1.5) {
int barb = 20; g.drawLine(x1, y1, x2, y2);
int lineSize = 3; } else {
GraphicLib.arrowWithLine(g, 1, 0, 10, x1, y1, x2, y2, true);
Point begin = new Point(x1, y1-(lineSize/3));
Point end = new Point(x2, y2-(lineSize/3));
g.setStroke(new BasicStroke(lineSize - 1));
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.drawLine(begin.x, begin.y, end.x, end.y);
double dy = end.y - begin.y;
double dx = end.x - begin.x;
double theta = Math.atan2(dy, dx);
double x, y, rho = theta + phi;
for (int j = 0; j < 2; j++) {
x = end.x - barb * Math.cos(rho);
y = end.y - barb * Math.sin(rho);
g.setStroke(new BasicStroke(lineSize - 1));
g.draw(new Line2D.Double(end.x, end.y, x, y));
rho = theta - phi;
} }
return; return;
} catch (Exception e) { } catch (Exception e) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment