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

Method makePolygon

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

Source from the content-addressed store, hash-verified

4468 }
4469
4470 private void makePolygon() {
4471 Polygon points = new Polygon();
4472 points.addPoint((int)Math.round(getFirstArg()), (int)Math.round(getNextArg()));
4473 interp.getToken();
4474 while (interp.token==',') {
4475 int x = (int)Math.round(interp.getExpression());
4476 interp.getComma();
4477 int y = (int)Math.round(interp.getExpression());
4478 points.addPoint(x,y);
4479 interp.getToken();
4480 }
4481 if (points.npoints<3)
4482 interp.error("Fewer than 3 points");
4483 ImagePlus imp = getImage();
4484 Roi previousRoi = imp.getRoi();
4485 if (shiftKeyDown||altKeyDown) imp.saveRoi();
4486 imp.setRoi(new PolygonRoi(points, Roi.POLYGON));
4487 Roi roi = imp.getRoi();
4488 if (previousRoi!=null && roi!=null)
4489 updateRoi(roi);
4490 resetImage();
4491 shiftKeyDown = altKeyDown = false;
4492 }
4493
4494 void updateRoi(Roi roi) {
4495 if (shiftKeyDown || altKeyDown)

Callers 1

doFunctionMethod · 0.95

Calls 14

getFirstArgMethod · 0.95
getNextArgMethod · 0.95
getImageMethod · 0.95
getRoiMethod · 0.95
saveRoiMethod · 0.95
setRoiMethod · 0.95
updateRoiMethod · 0.95
resetImageMethod · 0.95
getExpressionMethod · 0.80
getCommaMethod · 0.80
addPointMethod · 0.45
roundMethod · 0.45

Tested by

no test coverage detected