implement minElevation and maxElevation in GPX Explorer

This commit is contained in:
sonora 2011-08-23 02:11:10 +03:00
parent a0c233908a
commit ececa90ad2

View file

@ -115,6 +115,8 @@ public class LocalIndexHelper {
double diffElevationUp = 0; double diffElevationUp = 0;
double diffElevationDown = 0; double diffElevationDown = 0;
double totalElevation = 0; double totalElevation = 0;
double minElevation = 0;
double maxElevation = 0;
float maxSpeed = 0; float maxSpeed = 0;
int speedCount = 0; int speedCount = 0;
@ -139,6 +141,8 @@ public class LocalIndexHelper {
} }
totalElevation += subtrack.get(j).getAltitude(); totalElevation += subtrack.get(j).getAltitude();
minElevation = Math.min(totalElevation, minElevation);
maxElevation = Math.max(totalElevation, maxElevation);
if (j > 0) { if (j > 0) {
double diff = subtrack.get(j).getAltitude() - subtrack.get(j - 1).getAltitude(); double diff = subtrack.get(j).getAltitude() - subtrack.get(j - 1).getAltitude();
if(diff > 0){ if(diff > 0){
@ -165,7 +169,7 @@ public class LocalIndexHelper {
if(totalElevation != 0 || diffElevationUp != 0 || diffElevationDown != 0){ if(totalElevation != 0 || diffElevationUp != 0 || diffElevationDown != 0){
info.setDescription(info.getDescription() + info.setDescription(info.getDescription() +
app.getString(R.string.local_index_gpx_info_elevation, app.getString(R.string.local_index_gpx_info_elevation,
totalElevation / points, diffElevationUp, diffElevationDown)); totalElevation / points, minElevation, maxElevation, diffElevationUp, diffElevationDown));
} }
if(speedCount > 0){ if(speedCount > 0){
info.setDescription(info.getDescription() + info.setDescription(info.getDescription() +