MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / makeLine

Method makeLine

ij/src/main/java/ij/macro/Functions.java:933–963  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

931 }
932
933 void makeLine() {
934 double x1d = getFirstArg();
935 double y1d = getNextArg();
936 double x2d = getNextArg();
937 interp.getComma();
938 double y2d = interp.getExpression();
939 interp.getToken();
940 if (interp.token==')')
941 IJ.makeLine(x1d, y1d, x2d, y2d);
942 else {
943 Polygon points = new Polygon();
944 points.addPoint((int)Math.round(x1d),(int)Math.round(y1d));
945 points.addPoint((int)Math.round(x2d),(int)Math.round(y2d));
946 while (interp.token==',') {
947 int x = (int)Math.round(interp.getExpression());
948 if (points.npoints==2 && interp.nextToken()==')') {
949 interp.getRightParen();
950 Roi line = new Line(x1d, y1d, x2d, y2d);
951 line.updateWideLine((float)x);
952 getImage().setRoi(line);
953 return;
954 }
955 interp.getComma();
956 int y = (int)Math.round(interp.getExpression());
957 points.addPoint(x,y);
958 interp.getToken();
959 }
960 getImage().setRoi(new PolygonRoi(points, Roi.POLYLINE));
961 }
962 resetImage();
963 }
964
965 void makeArrow() {
966 String options = "";

Callers 1

doFunctionMethod · 0.95

Calls 14

getFirstArgMethod · 0.95
getNextArgMethod · 0.95
makeLineMethod · 0.95
getImageMethod · 0.95
resetImageMethod · 0.95
getCommaMethod · 0.80
getExpressionMethod · 0.80
getRightParenMethod · 0.80
updateWideLineMethod · 0.80
getTokenMethod · 0.45
addPointMethod · 0.45
roundMethod · 0.45

Tested by

no test coverage detected