- Timestamp:
- 08/08/07 02:46:26 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
bbtracker_common/trunk/src/org/bbtracker/ImperialUnitConverter.java
r52 r60 15 15 } 16 16 final float mph = speed * MS_TO_MPH_FACTOR; 17 return String.valueOf(((int) (mph * 10)) / 10f) + "mph";17 return Utils.floatToString(mph, false) + "mph"; 18 18 } 19 19 … … 35 35 return feet + "ft"; 36 36 } else { 37 return String.valueOf(((int) (miles * 10)) / 10f) + "mi";37 return Utils.doubleToString(miles, false) + "mi"; 38 38 } 39 39 } 40 40 41 public ScaleConfiguration getScale Configuration(final double lengthInMeter) {41 public ScaleConfiguration getScaleDistance(final double lengthInMeter) { 42 42 final double lengthInFoot = lengthInMeter * METER_TO_FOOT_FACTOR; 43 43 double factor = METER_TO_FOOT_FACTOR; … … 55 55 } 56 56 57 conf.lengthInUnits = getRoundScaleSize(available); 58 conf.lengthInMeter = conf.lengthInUnits / factor; 57 final int lengthInUnits = getRoundScaleSize(available); 58 conf.lengthInSourceUnits = lengthInUnits / factor; 59 conf.labelLocation = new float[] { 0.0f, 0.5f, 1.0f }; 60 conf.labelValue = new float[] { 0f, lengthInUnits / 2, lengthInUnits }; 59 61 return conf; 60 62 } 63 64 public ScaleConfiguration getScaleElevation(final int min, final int max) { 65 return getScaleConfiguration("ft", min * METER_TO_FOOT_FACTOR, max * METER_TO_FOOT_FACTOR); 66 } 67 68 public ScaleConfiguration getScaleSpeed(final double maxSpeed) { 69 return getScaleConfiguration("mph", 0, (float) (maxSpeed * MS_TO_MPH_FACTOR)); 70 } 61 71 }
Note: See TracChangeset
for help on using the changeset viewer.