[Schmitzm-commits] r857 - trunk/src/schmitzm/geotools/gui
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri May 21 16:15:58 CEST 2010
Author: alfonx
Date: 2010-05-21 16:15:58 +0200 (Fri, 21 May 2010)
New Revision: 857
Modified:
trunk/src/schmitzm/geotools/gui/GeoMapPane.java
Log:
Modified: trunk/src/schmitzm/geotools/gui/GeoMapPane.java
===================================================================
--- trunk/src/schmitzm/geotools/gui/GeoMapPane.java 2010-05-21 13:25:55 UTC (rev 856)
+++ trunk/src/schmitzm/geotools/gui/GeoMapPane.java 2010-05-21 14:15:58 UTC (rev 857)
@@ -37,10 +37,18 @@
import java.awt.Insets;
import java.util.HashMap;
+import javax.measure.quantity.Quantity;
+import javax.measure.unit.Unit;
+
import org.geotools.map.MapContext;
import org.geotools.renderer.lite.StreamingRenderer;
import org.geotools.renderer.shape.ShapefileRenderer;
+import org.geotools.resources.CRSUtilities;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
+import org.opengis.referencing.cs.CoordinateSystem;
+import cern.clhep.Units;
+
import schmitzm.geotools.GTUtil;
import schmitzm.geotools.map.event.JMapPaneListener;
import schmitzm.geotools.map.event.MapAreaChangedEvent;
@@ -207,6 +215,17 @@
public void performMapPaneEvent(XMapPaneEvent e) {
if (e instanceof ScaleChangedEvent) {
ScaleChangedEvent sce = (ScaleChangedEvent) e;
+
+ Unit<? extends Quantity> METRE = Unit.valueOf("m");
+ Unit<? extends Quantity> DEEGREE = Unit.valueOf("°");
+ CoordinateSystem cs = getMapPane().getMapContext().getCoordinateReferenceSystem().getCoordinateSystem();
+ if (!(CRSUtilities.getUnit(cs).equals(METRE))){
+ System.out.println("map cs is not m");
+ if (CRSUtilities.getUnit(cs).equals(DEEGREE)){
+ System.out.println("map cs is in °");
+ }
+ }
+
getScalePane().setScale(sce.getNewScale());
}
if (e instanceof MapAreaChangedEvent) {
More information about the Schmitzm-commits
mailing list