Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/ElevationHelper.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/ElevationHelper.java	(revision 29978)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/ElevationHelper.java	(revision 29979)
@@ -1,13 +1,13 @@
 /**
- * This program is free software: you can redistribute it and/or modify it under 
- * the terms of the GNU General Public License as published by the 
- * Free Software Foundation, either version 3 of the License, or 
- * (at your option) any later version. 
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
  * 
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
- * See the GNU General Public License for more details. 
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
  * 
- * You should have received a copy of the GNU General Public License along with this program. 
+ * You should have received a copy of the GNU General Public License along with this program.
  * If not, see <http://www.gnu.org/licenses/>.
  */
@@ -28,347 +28,337 @@
  * Provides methods to access way point attributes and some utility methods regarding elevation stuff (
  * e. g. special text formats, unit conversion, geoid calc).
- * @author Oliver Wieland <oliver.wieland@online.de> 
+ * @author Oliver Wieland <oliver.wieland@online.de>
  */
 public class ElevationHelper {
-	public static double METER_TO_FEET = 3.280948;
-	
-	/* Countries which use the imperial system instead of the metric system. */
-	private static String IMPERIAL_SYSTEM_COUNTRIES[] = {
-		"en_US", 	/* USA */
-		"en_CA",	/* Canada */
-		"en_AU",	/* Australia */
-		"en_NZ",	/* New Zealand */
-//		"de_DE",	/* for testing only */
-		"en_ZA"	/* South Africa */
-	};
-	
-	/** The 'no elevation' data magic. */
-	public static double NO_ELEVATION = Double.NaN;
-	
-	/**
-	 * The name of the elevation height of a way point.
-	 */
-	public static final String HEIGHT_ATTRIBUTE = "ele";
-	
-	private static UnitMode unitMode = UnitMode.NotSelected;
-		
-	private static GeoidCorrectionKind geoidKind = GeoidCorrectionKind.None;
-	
-	/** The HGT reader instance. */
-	private static HgtReader hgt = new HgtReader();
-	
-	/**
-	 * Gets the current mode of GEOID correction.
-	 * @return
-	 */
-	public static GeoidCorrectionKind getGeoidKind() {
-		return geoidKind;
-	}
-
-	public static void setGeoidKind(GeoidCorrectionKind geoidKind) {
-		ElevationHelper.geoidKind = geoidKind;
-	}
-	
-	/**
-	 * Gets the current unit mode (metric or imperial).
-	 * @return
-	 */
-	public static UnitMode getUnitMode() {
-		//TODO: Use this until /JOSM/src/org/openstreetmap/josm/gui/NavigatableComponent.java 
-		// has a an appropriate method 
-		
-		// unit mode already determined?
-		if (unitMode != UnitMode.NotSelected) {
-			return unitMode;
-		}
-		
-		// Set default
-		unitMode = UnitMode.Metric;
-		
-		// Check if user could prefer imperial system 
-		Locale l = Locale.getDefault();		
-		for (int i = 0; i < IMPERIAL_SYSTEM_COUNTRIES.length; i++) {
-			String ctry = l.toString();
-			if (IMPERIAL_SYSTEM_COUNTRIES[i].equals(ctry)) {
-				unitMode = UnitMode.Imperial;
-			}
-		}
-		
-		return unitMode;
-	}
-	
-	/**
-	 * Gets the unit string for elevation ("m" or "ft").
-	 * @return
-	 */
-	public static String getUnit() {		
-		switch (getUnitMode()) {
-		case Metric:
-			return "m";
-		case Imperial:
-			return "ft";
-		default:
-			throw new RuntimeException("Invalid or unsupported unit mode: " + unitMode);
-		}
-	}
-	
-	/**
-	 * Checks if given value is a valid elevation value.
-	 *
-	 * @param ele the ele
-	 * @return true, if is valid elevation
-	 */
-	public static boolean isValidElevation(double ele) {
-	    return !Double.isNaN(ele);
-	}
-	
-	/**
-	 * Gets the elevation (Z coordinate) of a GPX way point in meter or feet (for
-	 * US, UK, ZA, AU, NZ and CA). 
-	 * 
-	 * @param wpt
-	 *            The way point instance.
-	 * @return The x coordinate or <code>NO_ELEVATION</code>, if the given way point is null or contains
-	 *         not height attribute.
-	 */
-	public static double getElevation(WayPoint wpt) {
-	    if (wpt == null) return NO_ELEVATION;
-	    
-	    // try to get elevation from HGT file
-	    double eleInt = getInternalElevation(wpt.getCoor());	    
-	    if (isValidElevation(eleInt)) {
-		return convert(eleInt);
+    public static double METER_TO_FEET = 3.280948;
+
+    /* Countries which use the imperial system instead of the metric system. */
+    private static String IMPERIAL_SYSTEM_COUNTRIES[] = {
+	"en_US", 	/* USA */
+	"en_CA",	/* Canada */
+	"en_AU",	/* Australia */
+	"en_NZ",	/* New Zealand */
+	//		"de_DE",	/* for testing only */
+	"en_ZA"	/* South Africa */
+    };
+
+    /** The 'no elevation' data magic. */
+    public static double NO_ELEVATION = Double.NaN;
+
+    /**
+     * The name of the elevation height of a way point.
+     */
+    public static final String HEIGHT_ATTRIBUTE = "ele";
+
+    private static UnitMode unitMode = UnitMode.NotSelected;
+
+    private static GeoidCorrectionKind geoidKind = GeoidCorrectionKind.None;
+
+    /** The HGT reader instance. */
+    private static HgtReader hgt = new HgtReader();
+
+    /**
+     * Gets the current mode of GEOID correction.
+     * @return
+     */
+    public static GeoidCorrectionKind getGeoidKind() {
+	return geoidKind;
+    }
+
+    public static void setGeoidKind(GeoidCorrectionKind geoidKind) {
+	ElevationHelper.geoidKind = geoidKind;
+    }
+
+    /**
+     * Gets the current unit mode (metric or imperial).
+     * @return
+     */
+    public static UnitMode getUnitMode() {
+	//TODO: Use this until /JOSM/src/org/openstreetmap/josm/gui/NavigatableComponent.java
+	// has a an appropriate method
+
+	// unit mode already determined?
+	if (unitMode != UnitMode.NotSelected) {
+	    return unitMode;
+	}
+
+	// Set default
+	unitMode = UnitMode.Metric;
+
+	// Check if user could prefer imperial system
+	Locale l = Locale.getDefault();
+	for (int i = 0; i < IMPERIAL_SYSTEM_COUNTRIES.length; i++) {
+	    String ctry = l.toString();
+	    if (IMPERIAL_SYSTEM_COUNTRIES[i].equals(ctry)) {
+		unitMode = UnitMode.Imperial;
 	    }
-	    
-	    // no HGT, check for elevation data in GPX
-	    if (!wpt.attr.containsKey(HEIGHT_ATTRIBUTE)) {
-		// GPX has no elevation data :-(
-		return NO_ELEVATION;
+	}
+
+	return unitMode;
+    }
+
+    /**
+     * Gets the unit string for elevation ("m" or "ft").
+     * @return
+     */
+    public static String getUnit() {
+	switch (getUnitMode()) {
+	case Metric:
+	    return "m";
+	case Imperial:
+	    return "ft";
+	default:
+	    throw new RuntimeException("Invalid or unsupported unit mode: " + unitMode);
+	}
+    }
+
+    /**
+     * Checks if given value is a valid elevation value.
+     *
+     * @param ele the ele
+     * @return true, if is valid elevation
+     */
+    public static boolean isValidElevation(double ele) {
+	return !Double.isNaN(ele);
+    }
+
+    /**
+     * Gets the elevation (Z coordinate) of a GPX way point in meter or feet (for
+     * US, UK, ZA, AU, NZ and CA).
+     * 
+     * @param wpt
+     *            The way point instance.
+     * @return The x coordinate or <code>NO_ELEVATION</code>, if the given way point is null or contains
+     *         not height attribute.
+     */
+    public static double getElevation(WayPoint wpt) {
+	if (wpt == null) return NO_ELEVATION;
+
+	// try to get elevation from HGT file
+	double eleInt = getSrtmElevation(wpt.getCoor());
+	if (isValidElevation(eleInt)) {
+	    return convert(eleInt);
+	}
+
+	// no HGT, check for elevation data in GPX
+	if (!wpt.attr.containsKey(HEIGHT_ATTRIBUTE)) {
+	    // GPX has no elevation data :-(
+	    return NO_ELEVATION;
+	}
+
+	// Parse elevation from GPX data
+	String height = wpt.getString(ElevationHelper.HEIGHT_ATTRIBUTE);
+	try {
+	    double z = Double.parseDouble(height);
+
+	    return convert(z);
+	} catch (NumberFormatException e) {
+	    System.err.println(String.format(
+		    "Cannot parse double from '%s': %s", height, e
+		    .getMessage()));
+	    return NO_ELEVATION;
+	}
+    }
+
+
+    private static double getElevation(LatLon ll) {
+	double ele = getSrtmElevation(ll);
+	//System.out.println("Get elevation " + ll + " => " + ele);
+	return convert(ele);
+    }
+
+    /**
+     * Converts the value to feet, if required.
+     *
+     * @param ele the elevation to convert
+     * @return the double
+     */
+    private static double convert(double ele) {
+	if (isValidElevation(ele)) {
+	    if (getUnitMode() == UnitMode.Imperial) {
+		// translate to feet
+		return meter2Feet(ele);
+	    } else {
+		// keep 'as is'
+		return ele;
 	    }
-
-	    // Parse elevation from GPX data
-	    String height = wpt.getString(ElevationHelper.HEIGHT_ATTRIBUTE);
-	    try {
-		double z = Double.parseDouble(height);
-
-		return convert(z);
-	    } catch (NumberFormatException e) {
-		System.err.println(String.format(
-			"Cannot parse double from '%s': %s", height, e
-			.getMessage()));
-		return NO_ELEVATION;
+	}
+	return NO_ELEVATION;
+    }
+
+    /**
+     * Computes the slope <b>in percent</b> between two way points. E. g. an elevation gain of 12m
+     * within a distance of 100m is equal to a slope of 12%.
+     *
+     * @param w1 the first way point
+     * @param w2 the second way point
+     * @return the slope in percent
+     */
+    public static double computeSlope(LatLon w1, LatLon w2) {
+	// same coordinates? -> return 0, if yes
+	if (w1.equals(w2)) return 0;
+
+	// get distance in meters and divide it by 100 in advance
+	double distInMeter = convert(w1.greatCircleDistance(w2) / 100.0);
+
+	// get elevation (difference) - is converted automatically to feet
+	int ele1 = (int) ElevationHelper.getElevation(w1);
+	int ele2 = (int) ElevationHelper.getElevation(w2);
+	int dH = ele2 - ele1;
+
+	// Slope in percent is define as elevation gain/loss in meters related to a distance of 100m
+	return dH / distInMeter;
+    }
+
+    /**
+     * Converts meter into feet
+     *
+     * @param meter the meter
+     * @return the double
+     */
+    public static double meter2Feet(double meter) {
+	return meter * METER_TO_FEET;
+    }
+
+    /**
+     * Gets the elevation string for a given elevation, e. g "300m" or "800ft".
+     * @param elevation
+     * @return
+     */
+    public static String getElevationText(int elevation) {
+	return String.format("%d %s", elevation, getUnit());
+    }
+
+    /**
+     * Gets the elevation string for a given elevation, e. g "300m" or "800ft".
+     * @param elevation
+     * @return
+     */
+    public static String getElevationText(double elevation) {
+	return String.format("%d %s", (int)Math.round(elevation), getUnit());
+    }
+
+    /**
+     * Gets the elevation string for a given way point, e. g "300m" or "800ft".
+     *
+     * @param wpt the way point
+     * @return the elevation text
+     */
+    public static String getElevationText(WayPoint wpt) {
+	if (wpt == null) return "-";
+
+	int elevation = (int)Math.round(ElevationHelper.getElevation(wpt));
+	return String.format("%d %s", elevation, getUnit());
+    }
+
+    /**
+     * Get the time string for a given way point.
+     * @param wpt
+     * @return
+     */
+    public static String getTimeText(WayPoint wpt) {
+	if (wpt == null) return null;
+
+	int hour = ElevationHelper.getHourOfWayPoint(wpt);
+	int min = ElevationHelper.getMinuteOfWayPoint(wpt);
+	return String.format("%02d:%02d", hour, min);
+    }
+
+    /**
+     * Gets the SRTM elevation (Z coordinate) of the given coordinate.
+     * 
+     * @param ll
+     *            The coordinate.
+     * @return The z coordinate or {@link Double#NaN}, if elevation value could not be obtained
+     *         not height attribute.
+     */
+    public static double getSrtmElevation(LatLon ll) {
+	if (ll != null) {
+	    // Try to read data from SRTM file
+	    // TODO: Option to switch this off
+	    double eleHgt = hgt.getElevationFromHgt(ll);
+
+	    //System.out.println("Get elevation from HGT " + ll + " => " + eleHgt);
+	    if (isValidElevation(eleHgt)) {
+		return eleHgt;
 	    }
 	}
-	
-	
-	public static double getElevation(LatLon ll) {
-		double ele = getInternalElevation(ll);
-		//System.out.println("Get elevation " + ll + " => " + ele);
-		return convert(ele);
-	}
-
-	/**
-	 * Converts the value to feet, if required.
-	 *
-	 * @param ele the elevation to convert
-	 * @return the double
-	 */
-	private static double convert(double ele) {
-	    if (isValidElevation(ele)) {
-	        if (getUnitMode() == UnitMode.Imperial) {
-	    		// translate to feet
-	    		return meter2Feet(ele);
-	        } else {
-	            // keep 'as is'
-	            return ele;
-	        }
-	    } 
-	    return NO_ELEVATION;	    
-	}
-	
-	/**
-	 * Computes the slope <b>in percent</b> between two way points. E. g. an elevation gain of 12m 
-	 * within a distance of 100m is equal to a slope of 12%. 
-	 *
-	 * @param w1 the first way point
-	 * @param w2 the second way point
-	 * @return the slope in percent
-	 */
-	public static double computeSlope(LatLon w1, LatLon w2) {
-	    	// same coordinates? -> return 0, if yes
-	    	if (w1.equals(w2)) return 0;
-	    
-		// get distance in meters and divide it by 100 in advance
-		double distInMeter = convert(w1.greatCircleDistance(w2) / 100.0);
-		
-		// get elevation (difference) - is converted automatically to feet
-		int ele1 = (int) ElevationHelper.getElevation(w1);
-		int ele2 = (int) ElevationHelper.getElevation(w2);
-		int dH = ele2 - ele1;
-		
-		// Slope in percent is define as elevation gain/loss in meters related to a distance of 100m
-		return dH / distInMeter;
-	}
-	
-	/**
-	 * Converts meter into feet
-	 *
-	 * @param meter the meter
-	 * @return the double
-	 */
-	public static double meter2Feet(double meter) {
-	    return meter * METER_TO_FEET;
-	}
-	
-	/**
-	 * Gets the elevation string for a given elevation, e. g "300m" or "800ft".
-	 * @param elevation
-	 * @return
-	 */
-	public static String getElevationText(int elevation) {
-		return String.format("%d %s", elevation, getUnit());
-	}
-	
-	/**
-	 * Gets the elevation string for a given elevation, e. g "300m" or "800ft".
-	 * @param elevation
-	 * @return
-	 */
-	public static String getElevationText(double elevation) {
-		return String.format("%d %s", (int)Math.round(elevation), getUnit());
-	}
-	
-	/**
-	 * Gets the elevation string for a given way point, e. g "300m" or "800ft".
-	 *
-	 * @param wpt the way point
-	 * @return the elevation text
-	 */
-	public static String getElevationText(WayPoint wpt) {
-		return getElevationText(wpt.getCoor());
-	}
-	
-	/**
-	 * Gets the elevation string for a given coordinate, e. g "300m" or "800ft".
-	 *
-	 * @param coor the coordinate
-	 * @return the elevation text
-	 */
-	public static String getElevationText(LatLon coor) {
-		if (coor == null) return null;
-		
-		int elevation = (int)Math.round(ElevationHelper.getElevation(coor));
-		return String.format("%d %s", (int)elevation, getUnit());
-	}
-	
-	/**
-	 * Get the time string for a given way point.
-	 * @param wpt
-	 * @return
-	 */
-	public static String getTimeText(WayPoint wpt) {
-		if (wpt == null) return null; 
-		
-		int hour = ElevationHelper.getHourOfWayPoint(wpt);
-		int min = ElevationHelper.getMinuteOfWayPoint(wpt);		
-		return String.format("%02d:%02d", hour, min);
-	}
-
-	/**
-	 * Gets the elevation (Z coordinate) of a GPX way point.
-	 * 
-	 * @param ll
-	 *            The way point instance.
-	 * @return The x coordinate or 0, if the given way point is null or contains
-	 *         not height attribute.
-	 */
-	private static double getInternalElevation(LatLon ll) {
-		if (ll != null) {
-		    	// Try to read data from SRTM file
-		    	// TODO: Option to switch this off
-		    	double eleHgt = hgt.getElevationFromHgt(ll);
-		    	
-		    	//System.out.println("Get elevation from HGT " + ll + " => " + eleHgt);
-		    	if (isValidElevation(eleHgt)) {		    	    
-		    	    return eleHgt;
-		    	}
-		}
-		return NO_ELEVATION;
-	}
-
+	return NO_ELEVATION;
+    }
+
+    /*
+     * Gets the geoid height for the given way point. See also {@link
+     * GeoidData}.
+     */
+    public static byte getGeoidCorrection(WayPoint wpt) {
 	/*
-	 * Gets the geoid height for the given way point. See also {@link
-	 * GeoidData}.
-	 */
-	public static byte getGeoidCorrection(WayPoint wpt) {
-	    	/*
 		int lat = (int)Math.round(wpt.getCoor().lat());
 		int lon = (int)Math.round(wpt.getCoor().lon());
 		byte geoid = GeoidData.getGeoid(lat, lon);
-		
+
 		System.out.println(
 				String.format("Geoid(%d, %d) = %d", lat, lon, geoid));
-	    	 */
-		return 0;
-	}
-
-	/**
-	 * Reduces a given list of way points to the specified target size.
-	 * 
-	 * @param origList
-	 *            The original list containing the way points.
-	 * @param targetSize
-	 *            The desired target size of the list. The resulting list may
-	 *            contain fewer items, so targetSize should be considered as
-	 *            maximum.
-	 * @return A list containing the reduced list.
 	 */
-	public static List<WayPoint> downsampleWayPoints(List<WayPoint> origList,
-			int targetSize) {
-		if (origList == null)
-			return null;
-		if (targetSize <= 0)
-			throw new IllegalArgumentException(
-					"targetSize must be greater than zero");
-
-		int origSize = origList.size();
-		if (origSize <= targetSize) {
-			return origList;
-		}
-
-		int delta = (int) Math.max(Math.ceil(origSize / targetSize), 2);
-
-		List<WayPoint> res = new ArrayList<WayPoint>(targetSize);
-		for (int i = 0; i < origSize; i += delta) {
-			res.add(origList.get(i));
-		}
-
-		return res;
-	}
-	
-	/**
-	 * Gets the hour value of a way point in 24h format.
-	 * @param wpt
-	 * @return
-	 */
-	public static int getHourOfWayPoint(WayPoint wpt) {
-		if (wpt == null) return -1;
-		
-		Calendar calendar = GregorianCalendar.getInstance(); // creates a new calendar instance
-		calendar.setTime(wpt.getTime());   // assigns calendar to given date 
-		return calendar.get(Calendar.HOUR_OF_DAY); 
-	}
-	
-	/**
-	 * Gets the minute value of a way point in 24h format.
-	 * @param wpt
-	 * @return
-	 */
-	public static int getMinuteOfWayPoint(WayPoint wpt) {
-		if (wpt == null) return -1;
-		
-		Calendar calendar = GregorianCalendar.getInstance(); // creates a new calendar instance
-		calendar.setTime(wpt.getTime());   // assigns calendar to given date 
-		return calendar.get(Calendar.MINUTE); 
-	}
+	return 0;
+    }
+
+    /**
+     * Reduces a given list of way points to the specified target size.
+     * 
+     * @param origList
+     *            The original list containing the way points.
+     * @param targetSize
+     *            The desired target size of the list. The resulting list may
+     *            contain fewer items, so targetSize should be considered as
+     *            maximum.
+     * @return A list containing the reduced list.
+     */
+    public static List<WayPoint> downsampleWayPoints(List<WayPoint> origList,
+	    int targetSize) {
+	if (origList == null)
+	    return null;
+	if (targetSize <= 0)
+	    throw new IllegalArgumentException(
+		    "targetSize must be greater than zero");
+
+	int origSize = origList.size();
+	if (origSize <= targetSize) {
+	    return origList;
+	}
+
+	int delta = (int) Math.max(Math.ceil(origSize / targetSize), 2);
+
+	List<WayPoint> res = new ArrayList<WayPoint>(targetSize);
+	for (int i = 0; i < origSize; i += delta) {
+	    res.add(origList.get(i));
+	}
+
+	return res;
+    }
+
+    /**
+     * Gets the hour value of a way point in 24h format.
+     * @param wpt
+     * @return
+     */
+    public static int getHourOfWayPoint(WayPoint wpt) {
+	if (wpt == null) return -1;
+
+	Calendar calendar = GregorianCalendar.getInstance(); // creates a new calendar instance
+	calendar.setTime(wpt.getTime());   // assigns calendar to given date
+	return calendar.get(Calendar.HOUR_OF_DAY);
+    }
+
+    /**
+     * Gets the minute value of a way point in 24h format.
+     * @param wpt
+     * @return
+     */
+    public static int getMinuteOfWayPoint(WayPoint wpt) {
+	if (wpt == null) return -1;
+
+	Calendar calendar = GregorianCalendar.getInstance(); // creates a new calendar instance
+	calendar.setTime(wpt.getTime());   // assigns calendar to given date
+	return calendar.get(Calendar.MINUTE);
+    }
 }
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/EleVertex.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/EleVertex.java	(revision 29978)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/EleVertex.java	(revision 29979)
@@ -1,13 +1,13 @@
 /**
- * This program is free software: you can redistribute it and/or modify it under 
- * the terms of the GNU General Public License as published by the 
- * Free Software Foundation, either version 3 of the License, or 
- * (at your option) any later version. 
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
  * 
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
- * See the GNU General Public License for more details. 
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
  * 
- * You should have received a copy of the GNU General Public License along with this program. 
+ * You should have received a copy of the GNU General Public License along with this program.
  * If not, see <http://www.gnu.org/licenses/>.
  */
@@ -24,14 +24,14 @@
     private static final int NPOINTS = 3;
     private static final double MIN_DIST = 90;
-    
+
     private double avrgEle = Double.NaN;
     private double area = Double.NaN;
-    private EleCoordinate[] points = new EleCoordinate[NPOINTS];
-    
+    private final EleCoordinate[] points = new EleCoordinate[NPOINTS];
+
     public EleVertex(EleCoordinate p1, EleCoordinate p2, EleCoordinate p3) {
 	points[0] = p1;
 	points[1] = p2;
 	points[2] = p3;
-	
+
 	// compute elevation
 	double z = 0D;
@@ -45,31 +45,31 @@
 	    }
 	}
-	
-	if (eleValid) {	
+
+	if (eleValid) {
 	    avrgEle = z / NPOINTS;
 	} else {
 	    avrgEle = ElevationHelper.NO_ELEVATION;
 	}
-	
+
 	// compute the (approx.!) area of the vertex using heron's formula
 	double a = p1.greatCircleDistance(p2);
 	double b = p2.greatCircleDistance(p3);
 	double c = p1.greatCircleDistance(p3);
-	
+
 	double s = (a + b + c) / 2D;
 	double sq = s * (s - a) * (s - b) * (s - c);
 	area = Math.sqrt(sq);
     }
-    
+
     public List<EleVertex> divide() {
 	TriangleEdge[] edges = new TriangleEdge[NPOINTS];
-	
+
 	int k = 0;
 	for (int i = 0; i < points.length; i++) {
 	    EleCoordinate c1 = points[i];
-	    
+
 	    for (int j = i + 1; j < points.length; j++) {
 		EleCoordinate c2 = points[j];
-		
+
 		edges[k++] = new TriangleEdge(i, j, c1.greatCircleDistance(c2));
 	    }
@@ -81,11 +81,11 @@
 	    System.out.println("#" + i + ": " +triangleEdge);
 	}*/
-	
+
 	// sort by distance
 	Arrays.sort(edges);
 	// pick the longest edge
 	TriangleEdge longest = edges[0];
-	
-	
+
+
 	//System.out.println("Longest " + longest);
 	EleCoordinate pI = points[longest.getI()];
@@ -98,15 +98,15 @@
 	System.out.println(pK);
 	System.out.println(newP);
-	*/
+	 */
 	List<EleVertex> res = new ArrayList<EleVertex>();
 	res.add(new EleVertex(pI, pK, newP));
 	res.add(new EleVertex(pJ, pK, newP));
-	
+
 	return res;
     }
-    
+
     /**
      * Checks if vertex requires further processing or is finished. Currently this
-     * method returns <code>true</code>, if the average deviation is < 5m 
+     * method returns <code>true</code>, if the average deviation is < 5m
      *
      * @return true, if is finished
@@ -115,13 +115,13 @@
 	double z = 0D;
 	double avrgEle = getEle();
-	
+
 	for (EleCoordinate point : points) {
 	    z += (avrgEle - point.getEle()) * (avrgEle - point.getEle());
 	}
-	
+
 	// TODO: Check for proper limit
 	return /*z < 75 || */getArea() < (30 * 30); // = 3 * 25
-    }    
-    
+    }
+
     /**
      * Gets the approximate area of this vertex in square meters.
@@ -130,5 +130,5 @@
      */
     public double getArea() {
-        return area;
+	return area;
     }
 
@@ -143,21 +143,21 @@
 	double x = (c1.getX() + c2.getX()) / 2.0;
 	double y = (c1.getY() + c2.getY()) / 2.0;
-	
+
 	double z = (c1.getEle() + c2.getEle()) / 2.0;
 	if (c1.greatCircleDistance(c2) > MIN_DIST) {
-	    double hgtZ = ElevationHelper.getElevation(new LatLon(y, x));
-	    
+	    double hgtZ = ElevationHelper.getSrtmElevation(new LatLon(y, x));
+
 	    if (ElevationHelper.isValidElevation(hgtZ)) {
 		z = hgtZ;
-	    }	    
-    	}
-	
+	    }
+	}
+
 	return new EleCoordinate(y, x, z);
     }
-    
+
     /**
      * Gets the coordinate for the given index.
      *
-     * @param index the index between 0 and NPOINTS: 
+     * @param index the index between 0 and NPOINTS:
      * @return the elevation coordinate instance
      * @throws IllegalArgumentException, if index is invalid
@@ -165,8 +165,8 @@
     public EleCoordinate get(int index) {
 	if (index < 0 || index >= NPOINTS) throw new IllegalArgumentException("Invalid index: " + index);
-	
+
 	return points[index];
     }
-    
+
     /**
      * Gets the average elevation of this vertex.
@@ -175,8 +175,8 @@
      */
     public double getEle() {
-	
+
 	return avrgEle;
     }
-    
+
     @Override
     public String toString() {
@@ -189,8 +189,8 @@
 
     class TriangleEdge implements Comparable<TriangleEdge> {
-	private int i;
-	private int j;
-	private double dist;
-	
+	private final int i;
+	private final int j;
+	private final double dist;
+
 	public TriangleEdge(int i, int j, double dist) {
 	    super();
@@ -207,5 +207,5 @@
 	    return j;
 	}
-	
+
 	public int getK() {
 	    if (i == 0) {
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/ElevationGridTile.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/ElevationGridTile.java	(revision 29978)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/ElevationGridTile.java	(revision 29979)
@@ -1,3 +1,5 @@
 package org.openstreetmap.josm.plugins.elevation.grid;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
 
 import java.awt.Graphics;
@@ -22,9 +24,9 @@
 
 public class ElevationGridTile extends Tile {
-    private BlockingDeque<EleVertex> toDo = new LinkedBlockingDeque<EleVertex>();
-    private BlockingDeque<EleVertex> vertices = new LinkedBlockingDeque<EleVertex>();
+    private final BlockingDeque<EleVertex> toDo = new LinkedBlockingDeque<EleVertex>();
+    private final BlockingDeque<EleVertex> vertices = new LinkedBlockingDeque<EleVertex>();
 
     private Bounds box;
-    
+
     public ElevationGridTile(TileSource source, int xtile, int ytile, int zoom) {
 	super(source, xtile, ytile, zoom);
@@ -37,6 +39,6 @@
 	    BufferedImage image) {
 	super(source, xtile, ytile, zoom, image);
-	
-	
+
+
     }
 
@@ -45,5 +47,5 @@
 	// TODO Auto-generated method stub
 	super.loadPlaceholderFromCache(cache);
-	
+
 	//System.out.println("loadPlaceholderFromCache");
     }
@@ -61,9 +63,9 @@
     public void paint(Graphics g, int x, int y) {
 	super.paint(g, x, y);
-	
+
 	//g.drawString(String.format("EGT %d/%d ", getXtile(), getYtile()), x, y);
 	g.drawString(getStatus(), x, y);
     }
-    
+
     /**
      * Paints the vertices of this tile.
@@ -90,14 +92,14 @@
     @Override
     public void loadImage(InputStream input) throws IOException {
-	if (isLoaded()) return;	
-	
-	// TODO: Save 
-	
+	if (isLoaded()) return;
+
+	// TODO: Save
+
 	// We abuse the loadImage method to render the vertices...
-	// 
+	//
 	while (toDo.size() > 0) {
 	    EleVertex vertex = toDo.poll();
-	    
-	    if (vertex.isFinished()) {		
+
+	    if (vertex.isFinished()) {
 		vertices.add(vertex);
 	    } else {
@@ -110,7 +112,7 @@
 	setLoaded(true);
     }
-    
+
     public BlockingDeque<EleVertex> getVertices() {
-        return vertices;
+	return vertices;
     }
 
@@ -136,15 +138,24 @@
 	LatLon min = box.getMin();
 	LatLon max = box.getMax();
-	
+
 	// compute missing coordinates
-	LatLon h1 = new LatLon(min.lat(), max.lon()); 
+	LatLon h1 = new LatLon(min.lat(), max.lon());
 	LatLon h2 = new LatLon(max.lat(), min.lon());
-	
+
+	double eleMin = ElevationHelper.getSrtmElevation(min);
+	double eleMax = ElevationHelper.getSrtmElevation(max);
+
+	// SRTM files present?
+	if (!ElevationHelper.isValidElevation(eleMax) || !ElevationHelper.isValidElevation(eleMin)) {
+	    setError(tr("No SRTM data"));
+	    return;
+	}
+
 	// compute elevation coords
-	EleCoordinate p0 = new EleCoordinate(min, ElevationHelper.getElevation(min));	
-	EleCoordinate p1 = new EleCoordinate(h1, ElevationHelper.getElevation(h1));
-	EleCoordinate p2 = new EleCoordinate(max, ElevationHelper.getElevation(max));
-	EleCoordinate p3 = new EleCoordinate(h2, ElevationHelper.getElevation(h2));
-		
+	EleCoordinate p0 = new EleCoordinate(min, eleMin);
+	EleCoordinate p1 = new EleCoordinate(h1, ElevationHelper.getSrtmElevation(h1));
+	EleCoordinate p2 = new EleCoordinate(max, eleMax);
+	EleCoordinate p3 = new EleCoordinate(h2, ElevationHelper.getSrtmElevation(h2));
+
 	// compute initial vertices
 	EleVertex v1 = new EleVertex(p0, p1, p2);
@@ -160,5 +171,5 @@
 		+ ", ytile=" + ytile + "]";
     }
-    
-    
+
+
 }
