Changeset 23791 in osm
- Timestamp:
- 2010-10-24T01:34:37+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/WayPointHelper.java
r23769 r23791 15 15 package org.openstreetmap.josm.plugins.elevation; 16 16 17 import java.awt.Color; 17 18 import java.util.ArrayList; 18 19 import java.util.Calendar; … … 132 133 public static String getElevationText(int elevation) { 133 134 return String.format("%d %s", elevation, getUnit()); 135 } 136 137 /** 138 * Gets the elevation string for a given elevation, e. g "300m" or "800ft". 139 * @param elevation 140 * @return 141 */ 142 public static String getElevationText(double elevation) { 143 return String.format("%d %s", (int)Math.round(elevation), getUnit()); 144 } 145 146 /** 147 * Gets the elevation string for a given way point, e. g "300m" or "800ft". 148 * @param elevation 149 * @return 150 */ 151 public static String getElevationText(WayPoint wpt) { 152 if (wpt == null) return null; 153 154 int elevation = (int)Math.round(WayPointHelper.getElevation(wpt)); 155 return String.format("%d %s", (int)elevation, getUnit()); 156 } 157 158 /** 159 * Get the time string for a given way point. 160 * @param wpt 161 * @return 162 */ 163 public static String getTimeText(WayPoint wpt) { 164 if (wpt == null) return null; 165 166 int hour = WayPointHelper.getHourOfWayPoint(wpt); 167 int min = WayPointHelper.getMinuteOfWayPoint(wpt); 168 return String.format("%02d:%02d", hour, min); 134 169 } 135 170 -
applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfilePanel.java
r23769 r23791 56 56 createOrUpdatePlotArea(); 57 57 addComponentListener(this); 58 addMouseMotionListener(this); 58 addMouseMotionListener(this); 59 59 } 60 60 … … 500 500 } 501 501 502 @Override 503 public String getToolTipText() { 504 WayPoint wpt = getSelectedWayPoint(); 505 if (wpt != null) { 506 return String.format("%s: %s", WayPointHelper.getTimeText(wpt), WayPointHelper.getElevationText(wpt)); 507 } 508 509 return super.getToolTipText(); 510 } 511 512 513 502 514 }
Note:
See TracChangeset
for help on using the changeset viewer.