]> gitweb.fperrin.net Git - GpsPrune.git/blobdiff - tim/prune/gui/profile/AltitudeData.java
Version 15, March 2013
[GpsPrune.git] / tim / prune / gui / profile / AltitudeData.java
index 9c19862166b2421b4cdaab9d102a75b5eb26dad6..9600b1674ade17a296a9e43f9a1dc4039dfcffe1 100644 (file)
@@ -30,9 +30,9 @@ public class AltitudeData extends ProfileData
                final double multFactor = _unitSet.getAltitudeUnit().getMultFactorFromStd();
                if (_track != null)
                {
-                       for (int i=0; i<_track.getNumPoints(); i++)
+                       try
                        {
-                               try
+                               for (int i=0; i<_track.getNumPoints(); i++)
                                {
                                        DataPoint point = _track.getPoint(i);
                                        if (point != null && point.hasAltitude())
@@ -43,15 +43,16 @@ public class AltitudeData extends ProfileData
                                                if (value < _minValue || !_hasData) {_minValue = value;}
                                                if (value > _maxValue || !_hasData) {_maxValue = value;}
 
-                                               _hasData = true;
+                                               // if all values are zero then that's no data
+                                               _hasData = _hasData || (point.getAltitude().getValue() != 0);
                                                _pointHasData[i] = true;
                                        }
                                        else _pointHasData[i] = false;
                                }
-                               catch (ArrayIndexOutOfBoundsException obe)
-                               {} // must be due to the track size changing during calculation
-                                  // assume that a redraw will be triggered
                        }
+                       catch (ArrayIndexOutOfBoundsException obe)
+                       {} // must be due to the track size changing during calculation
+                          // assume that a redraw will be triggered
                }
        }