public List<Point2> getHandles() { if (adjuster == null) return Collections.emptyList(); return createPoint2List(adjuster.getHandles()); }
@Override public PolygonROI requestNewHandle(double x, double y) { if (activeHandle == null) return roi; // Can only add if there is an active handle - distance to this will be used // Move the active handle if it is very close to the requested region // (removed) // Don't add a handle at almost the sample place as an existing handle if (handles.size() >= 2 && activeHandle == handles.get(handles.size() - 1) && handles.get(handles.size() - 2).distanceSq(x, y) < 4) { return roi; } // // If we have 2 points, which are identical, shift instead of creating // if (handles.size() >= 2 && activeHandle == handles.get(handles.size() - 1) && activeHandle.distanceSq(handles.get(handles.size() - 2)) < 0.000001) { // System.err.println("UPDATING HANDLE"); // return updateActiveHandleLocation(x, y, false); // } activeHandle = new MutablePoint(x, y); handles.add(activeHandle); roi = new PolygonROI(createPoint2List(handles), roi.getC(), roi.getZ(), roi.getT()); // System.out.println("UPDATED HANDLES BY REQUEST: " + handles.size()); return roi; }
@Override PolygonROI updateActiveHandleLocation(double xNew, double yNew, boolean shiftDown) { if (activeHandle == null) return roi; activeHandle.setLocation(xNew, yNew); roi = new PolygonROI(createPoint2List(handles), roi.getC(), roi.getZ(), roi.getT()); // System.out.println("UPDATED HANDLES: " + handles.size() + ", " + roi.nVertices()); return roi; }
@Override public PointsROI requestNewHandle(double x, double y) { activeHandle = new MutablePoint(x, y); handles.add(activeHandle); roi = new PointsROI(createPoint2List(handles), roi.getC(), roi.getZ(), roi.getT()); ensureHandlesUpdated(); activeHandle = grabHandle(x, y, Double.POSITIVE_INFINITY, false); // ensureHandlesUpdated(); // activeHandle = grabHandle(x, y, 1, false); // ensureHandlesUpdated(); // activeHandle = roi.getNearest(x, y, 0.01); return roi; }
@Override PointsROI updateActiveHandleLocation(double xNew, double yNew, boolean shiftDown) { if (activeHandle == null) return roi; activeHandle.setLocation(xNew, yNew); roi = new PointsROI(createPoint2List(handles), roi.getC(), roi.getZ(), roi.getT()); ensureHandlesUpdated(); activeHandle = grabHandle(xNew, yNew, Double.POSITIVE_INFINITY, shiftDown); // System.err.println("Calling: " + activeHandle + " - " + (handles == null ? 0 : handles.size())); return roi; }