Converts the current cursor location to a string.
(int x, int y)
| 2933 | |
| 2934 | /** Converts the current cursor location to a string. */ |
| 2935 | public String getLocationAsString(int x, int y) { |
| 2936 | Calibration cal = getCalibration(); |
| 2937 | if (getProperty("FHT")!=null) |
| 2938 | return getFFTLocation(x, height-y, cal); |
| 2939 | String xx="", yy=""; |
| 2940 | if (cal.scaled()) { |
| 2941 | xx = " ("+x+")"; |
| 2942 | yy = " ("+y+")"; |
| 2943 | } |
| 2944 | String s = " x="+d2s(cal.getX(x)) + xx + ", y=" + d2s(cal.getY(y,height)) + yy; |
| 2945 | if (getStackSize()>1) { |
| 2946 | Roi roi2 = getRoi(); |
| 2947 | if (roi2==null || roi2.getState()==Roi.NORMAL) { |
| 2948 | int z = isDisplayedHyperStack()?getSlice()-1:getCurrentSlice()-1; |
| 2949 | String zz = cal.scaled()&&cal.getZ(z)!=z?" ("+z+")":""; |
| 2950 | s += ", z="+d2s(cal.getZ(z))+zz; |
| 2951 | } |
| 2952 | } |
| 2953 | return s; |
| 2954 | } |
| 2955 | |
| 2956 | private String d2s(double n) { |
| 2957 | return n==(int)n?Integer.toString((int)n):IJ.d2s(n); |
no test coverage detected