Changeset 23736 in osm for applications/editors/josm/plugins
- Timestamp:
- 2010-10-21T23:11:58+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/ElevationProfileBase.java
r23721 r23736 52 52 private int maxHeight; 53 53 private int avrgHeight; 54 private double dist; 54 55 private Date start = new Date(); 55 56 private Date end = new Date(); … … 62 63 private int gain; 63 64 private int lastEle; 65 private WayPoint lastWayPoint; 64 66 65 67 private static boolean ignoreZeroHeight = true; … … 133 135 gain = 0; 134 136 lastEle = 0; 137 dist = 0.0; 135 138 136 139 for (WayPoint wayPoint : this.wayPoints) { … … 331 334 } 332 335 336 337 /* (non-Javadoc) 338 * @see org.openstreetmap.josm.plugins.elevation.IElevationProfile#getDistance() 339 */ 340 @Override 341 public double getDistance() { 342 return dist / 1000.0; // dist is in meters 343 } 344 333 345 /** 334 346 * Returns the time between start and end of the track. … … 474 486 475 487 sumEle += ele; 476 lastEle = ele; 477 } 488 lastEle = ele; 489 } 490 491 // determine distance 492 if (lastWayPoint != null) { 493 double d = wp.getCoor().greatCircleDistance(lastWayPoint.getCoor()); 494 dist += d; 495 } 496 lastWayPoint = wp; 478 497 } 479 498 } -
applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IElevationProfile.java
r23709 r23736 62 62 */ 63 63 public abstract int getMaxHeight(); 64 65 /** 66 * Gets the distance of the track in kilometers. 67 */ 68 public abstract double getDistance(); 64 69 65 70 /** -
applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfileDialog.java
r23721 r23736 38 38 import javax.swing.JTextField; 39 39 40 import org.openstreetmap.josm.Main;41 40 import org.openstreetmap.josm.data.gpx.GpxData; 42 41 import org.openstreetmap.josm.gui.MapView; … … 84 83 85 84 private ElevationProfileLayer profileLayer; 85 private JLabel distLabel; 86 86 87 87 /** … … 133 133 c.gridx = 1; 134 134 c.gridy = 0; 135 dataPanel.add(new JLabel(tr(" Lowest")), c);135 dataPanel.add(new JLabel(tr("Min")), c); 136 136 c.gridx = 2; 137 137 c.gridy = 0; 138 dataPanel.add(new JLabel(tr("Av erage")), c);138 dataPanel.add(new JLabel(tr("Avrg")), c); 139 139 c.gridx = 3; 140 140 c.gridy = 0; 141 dataPanel.add(new JLabel(tr(" Highest")), c);141 dataPanel.add(new JLabel(tr("Max")), c); 142 142 c.gridx = 4; 143 143 c.gridy = 0; 144 dataPanel.add(new JLabel(tr(" Gain")), c);144 dataPanel.add(new JLabel(tr("Dist")), c); 145 145 c.gridx = 5; 146 146 c.gridy = 0; 147 dataPanel.add(new JLabel(tr("Time ")), c); 147 dataPanel.add(new JLabel(tr("Gain")), c); 148 c.gridx = 6; 149 c.gridy = 0; 150 dataPanel.add(new JLabel(tr("Time")), c); 148 151 149 152 // second row 150 153 c.gridx = 0; 151 154 c.gridy = 1; 152 dataPanel.add(new JLabel(tr("Ele vation")), c);155 dataPanel.add(new JLabel(tr("Ele")), c); 153 156 c.gridx = 1; 154 157 c.gridy = 1; … … 168 171 c.gridx = 4; 169 172 c.gridy = 1; 173 distLabel = new JLabel("0 km"); 174 dataPanel.add(distLabel, c); 175 176 c.gridx = 5; 177 c.gridy = 1; 170 178 elevationGainLabel = new JLabel("0 m"); 171 179 dataPanel.add(elevationGainLabel, c); 172 180 173 c.gridx = 5;181 c.gridx = 6; 174 182 c.gridy = 1; 175 183 totalTimeLabel = new JLabel("0"); … … 179 187 c.gridx = 0; 180 188 c.gridy = 2; 181 c.gridwidth = 6;189 c.gridwidth = 7; 182 190 dataPanel.add(new JSeparator(), c); 183 191 … … 313 321 .getGain())); 314 322 totalTimeLabel.setText(String.format("%d:%d h", hours, minutes)); 323 distLabel.setText(String.format("%5.2f km", profile 324 .getDistance())); 315 325 } else { 316 326 minHeightLabel.setText("-"); … … 319 329 elevationGainLabel.setText("-"); 320 330 totalTimeLabel.setText("-"); 331 distLabel.setText("-"); 321 332 } 322 333
Note:
See TracChangeset
for help on using the changeset viewer.