[Schmitzm-commits] r549 - branches/1.0-gt2-2.6/src/schmitzm/geotools/gui
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Nov 23 14:30:20 CET 2009
Author: alfonx
Date: 2009-11-23 14:30:15 +0100 (Mon, 23 Nov 2009)
New Revision: 549
Modified:
branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/GridPanelFormatter_LatLon1.java
Log:
* Fromatting Minutes in Lat/long always with two digits
Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/GridPanelFormatter_LatLon1.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/GridPanelFormatter_LatLon1.java 2009-11-22 23:47:22 UTC (rev 548)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/GridPanelFormatter_LatLon1.java 2009-11-23 13:30:15 UTC (rev 549)
@@ -31,7 +31,11 @@
package schmitzm.geotools.gui;
import java.awt.Font;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+import javax.swing.text.NumberFormatter;
+
import org.geotools.referencing.crs.DefaultGeographicCRS;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
@@ -46,6 +50,7 @@
* Schmitz</a>
*/
public class GridPanelFormatter_LatLon1 extends GridPanelFormatter {
+ private static final DecimalFormat MINUTE_FORMAT = new DecimalFormat("00");
private static final Font font = new Font(Font.MONOSPACED, Font.PLAIN, 11);
private static final ResourceProvider RES = GeotoolsGUIUtil.RESOURCE;
@@ -126,7 +131,9 @@
degrees += Math.signum(minutes);
minutes -= Math.signum(minutes) * 60;
}
- String coordStr = Math.abs(degrees) + "°" + Math.abs(minutes) + "'";
+ int deegree = Math.abs(degrees);
+ int minute = Math.abs(minutes);
+ String coordStr = deegree + "°" + MINUTE_FORMAT.format(minute) + "'";
if (degrees != 0 || minutes != 0) {
if (panel.isVertical())
coordStr += RES
More information about the Schmitzm-commits
mailing list