Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: UDIG 1.1.0, UDIG 1.1.1, UDIG 1.2.M2, UDIG 1.2.M3
-
Fix Version/s: UDIG 1.2.M4
-
Component/s: application
-
Labels:None
-
Environment:XP, jre1.6.0_07_win32_gdal, Eclipse Ganymede.
Description
There is error in cursorPosition code. Whenever the world co-ordinate is in the exponential form (say 3.3100324202343583E7), the data displayed in the text field is not correct. It is because 3.3100324202343583E7 is being treated as 3.310032420234358 and not 33100324.20234358. My suggestion is that you just need to convert the double in exponential from to decimal form.
Problem is in function:
private String getString(double value) { if (Double.isNaN(value) ){ return Messages.CursorPosition_not_a_number; } if( Double.isInfinite(value) ){ return Messages.CursorPosition_infinity; } String string = String.valueOf(value); string+="00"; //$NON-NLS-1$ // calculate number of digits to display based on zoom level Coordinate coordFactor = getContext().getPixelSize(); double inverse = (double)1 / coordFactor.x; String strFactor = String.valueOf(inverse); int factor = strFactor.lastIndexOf('.'); int end=Math.max(1, Math.min(string.lastIndexOf('.') + factor, string.length() - 1)); //// This line generates the wrong end. string = string.substring(0, end); if( string.endsWith(".") ){ //$NON-NLS-1$ string=string.substring(0,string.length()-1); } return string; }