()
| 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) |
no test coverage detected