[Schmitzm-commits] r859 - in trunk: src/schmitzm/data src/schmitzm/geotools/gui src_junit/schmitzm/geotools/gui

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri May 21 16:45:15 CEST 2010


Author: mojays
Date: 2010-05-21 16:45:15 +0200 (Fri, 21 May 2010)
New Revision: 859

Modified:
   trunk/src/schmitzm/data/DistanceUnit.java
   trunk/src/schmitzm/geotools/gui/ScalePanel.java
   trunk/src_junit/schmitzm/geotools/gui/ScalePanelTest.java
Log:
DistanceUnit.METER refactored to METERS

Modified: trunk/src/schmitzm/data/DistanceUnit.java
===================================================================
--- trunk/src/schmitzm/data/DistanceUnit.java	2010-05-21 14:34:53 UTC (rev 858)
+++ trunk/src/schmitzm/data/DistanceUnit.java	2010-05-21 14:45:15 UTC (rev 859)
@@ -42,7 +42,7 @@
   /** Kilometers */
   KM,
   /** Meters */
-  METER,
+  METERS,
   /** Miles (= 1.609344km) */
   MILES,
   /** Yards (= 1/1760 miles) */
@@ -83,9 +83,9 @@
    */
   public double getConversionFactor(DistanceUnit units) {
     switch ( this ) {
-      case METER: return KM.getConversionFactor(units)/1000.0;
+      case METERS: return KM.getConversionFactor(units)/1000.0;
       case KM: switch (units) {
-                  case METER: return 1000;
+                  case METERS: return 1000;
                   case KM: return 1;
                   case MILES: return 1/MILE_TO_KM;
                   case YARDS: return getConversionFactor(MILES) * MILE_TO_YARD;
@@ -93,7 +93,7 @@
                }
                break;
       case MILES: switch (units) {
-                    case METER: return getConversionFactor(KM) * 1000;
+                    case METERS: return getConversionFactor(KM) * 1000;
                     case KM: return MILE_TO_KM;
                     case MILES: return 1;
                     case YARDS: return MILE_TO_YARD;

Modified: trunk/src/schmitzm/geotools/gui/ScalePanel.java
===================================================================
--- trunk/src/schmitzm/geotools/gui/ScalePanel.java	2010-05-21 14:34:53 UTC (rev 858)
+++ trunk/src/schmitzm/geotools/gui/ScalePanel.java	2010-05-21 14:45:15 UTC (rev 859)
@@ -85,7 +85,7 @@
      */
     public DistanceUnit getSecondaryUnit() {
       switch (this) {
-        case METRIC: return DistanceUnit.METER;
+        case METRIC: return DistanceUnit.METERS;
         case US: return DistanceUnit.FEET;
       }
       throw new UnsupportedOperationException("Unexpected ScaleUnits type: "+LangUtil.getSimpleClassName(this));
@@ -131,7 +131,7 @@
    * Liefert die dargestellte Aufloesung in Meilen pro Pixel.
    */
   public double getScaleInMiles() {
-    return DistanceUnit.METER.convertDistanceTo(getScaleInMeters(),DistanceUnit.MILES);
+    return DistanceUnit.METERS.convertDistanceTo(getScaleInMeters(),DistanceUnit.MILES);
   }
 
   /**
@@ -195,13 +195,13 @@
 
     // Breite in Darstellungseinheit umrechnen
     DistanceUnit dispUnit  = units.getMainUnit();
-    double maxW_unit = DistanceUnit.METER.convertDistanceTo(maxW_meter, dispUnit);
+    double maxW_unit = DistanceUnit.METERS.convertDistanceTo(maxW_meter, dispUnit);
     if ( maxW_unit < 1 ) {
       dispUnit  = units.getSecondaryUnit();
       maxW_unit = units.getMainUnit().convertDistanceTo(maxW_unit, dispUnit);
     }
     // Pixel pro Meter umrechnen in Pixel pro Darstellungseinheit
-    final double pixelsPerUnit = getScaleInPixels() / DistanceUnit.METER.getConversionFactor(dispUnit);
+    final double pixelsPerUnit = getScaleInPixels() / DistanceUnit.METERS.getConversionFactor(dispUnit);
     
     // Ausmasse der Skala (stellt immer volle 10/100/1000/... Einheiten dar)
     final long   scaleW_unit  = (long)Math.pow(10, (long)Math.log10(maxW_unit));

Modified: trunk/src_junit/schmitzm/geotools/gui/ScalePanelTest.java
===================================================================
--- trunk/src_junit/schmitzm/geotools/gui/ScalePanelTest.java	2010-05-21 14:34:53 UTC (rev 858)
+++ trunk/src_junit/schmitzm/geotools/gui/ScalePanelTest.java	2010-05-21 14:45:15 UTC (rev 859)
@@ -11,8 +11,8 @@
 
   @Test
   public void testScalePanel_DistanceUnit() {
-    assertEquals(0.001,DistanceUnit.METER.getConversionFactor(DistanceUnit.KM),0.0);
-    assertEquals(1000.0,DistanceUnit.KM.getConversionFactor(DistanceUnit.METER),0.0);
+    assertEquals(0.001,DistanceUnit.METERS.getConversionFactor(DistanceUnit.KM),0.0);
+    assertEquals(1000.0,DistanceUnit.KM.getConversionFactor(DistanceUnit.METERS),0.0);
     
     assertEquals(1.609344,DistanceUnit.MILES.getConversionFactor(DistanceUnit.KM),0.0);
     assertEquals(1/1.609344,DistanceUnit.KM.getConversionFactor(DistanceUnit.MILES),0.0);
@@ -26,14 +26,14 @@
     assertEquals(1760*3,DistanceUnit.MILES.getConversionFactor(DistanceUnit.FEET),0.0);
     assertEquals(1/(1760.0*3),DistanceUnit.FEET.getConversionFactor(DistanceUnit.MILES),0.0);
 
-    assertEquals(0.9144,DistanceUnit.YARDS.getConversionFactor(DistanceUnit.METER),0.0001);
-    assertEquals(1.0936133,DistanceUnit.METER.getConversionFactor(DistanceUnit.YARDS),0.000001);
+    assertEquals(0.9144,DistanceUnit.YARDS.getConversionFactor(DistanceUnit.METERS),0.0001);
+    assertEquals(1.0936133,DistanceUnit.METERS.getConversionFactor(DistanceUnit.YARDS),0.000001);
 
-    assertEquals(3.2808399,DistanceUnit.METER.getConversionFactor(DistanceUnit.FEET),0.001);
-    assertEquals(1/3.2808399,DistanceUnit.FEET.getConversionFactor(DistanceUnit.METER),0.001);
+    assertEquals(3.2808399,DistanceUnit.METERS.getConversionFactor(DistanceUnit.FEET),0.001);
+    assertEquals(1/3.2808399,DistanceUnit.FEET.getConversionFactor(DistanceUnit.METERS),0.001);
 
-    assertEquals(1.234,DistanceUnit.METER.convertDistanceTo(1234, DistanceUnit.KM),0.0);
-    assertEquals(12070.08,DistanceUnit.MILES.convertDistanceTo(7.5, DistanceUnit.METER),0.0);
+    assertEquals(1.234,DistanceUnit.METERS.convertDistanceTo(1234, DistanceUnit.KM),0.0);
+    assertEquals(12070.08,DistanceUnit.MILES.convertDistanceTo(7.5, DistanceUnit.METERS),0.0);
     
     System.out.println( ScalePanel.convertScaleToLabelUnit(1.68, DistanceUnit.MILES, ScaleUnits.US));
   }



More information about the Schmitzm-commits mailing list