[Schmitzm-commits] r851 - trunk/src/schmitzm/geotools/gui

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri May 21 12:49:08 CEST 2010


Author: mojays
Date: 2010-05-21 12:49:08 +0200 (Fri, 21 May 2010)
New Revision: 851

Modified:
   trunk/src/schmitzm/geotools/gui/ScalePane.java
   trunk/src/schmitzm/geotools/gui/ScalePanel.java
Log:
Units-Definition moved from ScalePane to scalePanel and renamed.

Modified: trunk/src/schmitzm/geotools/gui/ScalePane.java
===================================================================
--- trunk/src/schmitzm/geotools/gui/ScalePane.java	2010-05-21 10:25:08 UTC (rev 850)
+++ trunk/src/schmitzm/geotools/gui/ScalePane.java	2010-05-21 10:49:08 UTC (rev 851)
@@ -43,6 +43,7 @@
 import org.geotools.resources.CRSUtilities;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 
+import schmitzm.geotools.gui.ScalePanel.ScaleUnits;
 import schmitzm.swing.JPanel;
 
 /**
@@ -57,19 +58,6 @@
 	private static final DecimalFormat numFormat = new DecimalFormat(
 			"###,###,##0.00");
 
-	/**
-	 * ScalePane can show the scale in the following units.
-	 */
-	public enum UNITS {
-		/**
-		 * Show units in meters and switch to kilometers when the numbers get
-		 * huge
-		 **/
-		metersKilometers,
-		/** Show units in feet and switch to miles when the numbers get huge **/
-		feetMiles
-	}
-
 	/** Massstab-Balken */
 	private ScalePanel scalePanel = new ScalePanel();
 
@@ -77,20 +65,6 @@
 	private JLabel scaleLabel = new JLabel("");
 
 	/**
-	 * The units the scale will be presented in. By default meters and
-	 * kilometers are used.
-	 **/
-	private UNITS units = UNITS.metersKilometers;
-
-	/**
-	 * @return the units used in the scale. Not all possible Unit values are
-	 *         allowed.
-	 */
-	public UNITS getUnits() {
-		return units;
-	}
-
-	/**
 	 * Liefert die dargestellte Aufloesung in Pixel pro Meter.
 	 */
 	public double getScaleInPixels() {
@@ -114,13 +88,21 @@
 	}
 
 	/**
+	 * Returns the units used in the scale.
+	 * Not all possible Unit values are allowed.
+	 */
+	public ScalePanel.ScaleUnits getUnits() {
+	  return scalePanel.getUnits();
+	}
+  
+	/**
 	 * Define the unit used in the scale. Not all possible Unit values are
 	 * allowed.
 	 */
-	public void setUnits(UNITS unit) {
-		this.units = unit;
+	public void setUnits(ScalePanel.ScaleUnits unit) {
+	  scalePanel.setUnits(unit);
 	}
-
+  	  
 	/**
 	 * Liefert die dargestellte Aufloesung in Metern pro Pixel.
 	 */

Modified: trunk/src/schmitzm/geotools/gui/ScalePanel.java
===================================================================
--- trunk/src/schmitzm/geotools/gui/ScalePanel.java	2010-05-21 10:25:08 UTC (rev 850)
+++ trunk/src/schmitzm/geotools/gui/ScalePanel.java	2010-05-21 10:49:08 UTC (rev 851)
@@ -49,9 +49,28 @@
  * @version 1.0
  */
 public class ScalePanel extends JPanel {
+  /**
+   * ScalePane can show the scale in the following units.
+   */
+  public static enum ScaleUnits {
+      /**
+       * Show units in meters and switch to kilometers when the numbers get
+       * huge
+       **/
+      METRIC,
+      /** Show units in feet and switch to miles when the numbers get huge **/
+      US
+  }
+
   private static final DecimalFormat numFormat = new DecimalFormat("###,###,##0");
   public final static Color[] barColor  = new Color[] { Color.BLACK, Color.WHITE };
 
+  /**
+   * The units the scale will be presented in. By default meters and
+   * kilometers are used.
+   **/
+  private ScaleUnits units = ScaleUnits.METRIC;
+
   /** Beinhaltet die aktuell dargestellte Aufloesung. Der Wert entspricht den
    *  Metern, die durch einen Bildschirm-Pixel dargestellt werden.*/
   protected double scale = 1;
@@ -79,6 +98,22 @@
   }
 
   /**
+   * Returns the units used in the scale.
+   * Not all possible Unit values are allowed.
+   */
+  public ScaleUnits getUnits() {
+      return units;
+  }
+
+  /**
+   * Define the unit used in the scale. Not all possible Unit values are
+   * allowed.
+   */
+  public void setUnits(ScaleUnits unit) {
+      this.units = unit;
+  }
+
+  /**
    * Setzt die Aufloesung des Mass-Stabs und aktualisiert die Anzeige der
    * Komponente.
    * @param meters Meter, die durch einen Bildschirm-Pixel repraesentiert werden



More information about the Schmitzm-commits mailing list