Index: /applications/editors/josm/plugins/ElevationProfile/LICENSE
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/LICENSE	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/LICENSE	(revision 36309)
Index: /applications/editors/josm/plugins/ElevationProfile/README
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/README	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/README	(revision 36309)
@@ -7,4 +7,2 @@
 
 SRTM data in test/data is downloaded from http://dds.cr.usgs.gov/srtm/version2_1/SRTM3/Eurasia/
-
-Please report bugs to oliver.wieland@online.de.
Index: /applications/editors/josm/plugins/ElevationProfile/build.xml
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/build.xml	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/build.xml	(revision 36309)
@@ -4,5 +4,5 @@
     <property name="commit.message" value="[josm_elevationprofile]"/>
     <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
-    <property name="plugin.main.version" value="18494"/>
+    <property name="plugin.main.version" value="18970"/>
     
     <!-- Configure these properties (replace "..." accordingly).
Index: plications/editors/josm/plugins/ElevationProfile/pub.bat
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/pub.bat	(revision 36308)
+++ 	(revision )
@@ -1,3 +1,0 @@
-svn update
-call ant clean
-call ant dist
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/ColorMap.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/ColorMap.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/ColorMap.java	(revision 36309)
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 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/ElevationHelper.java	(revision 36309)
@@ -247,5 +247,5 @@
         }
 
-        int delta = (int) Math.max(Math.ceil(origSize / targetSize), 2);
+        int delta = (int) Math.max(origSize / targetSize, 2);
 
         List<WayPoint> res = new ArrayList<>(targetSize);
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/ElevationMapMode.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/ElevationMapMode.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/ElevationMapMode.java	(revision 36309)
@@ -9,6 +9,6 @@
 
 /**
+ * Provides the map mode and controls visibility of the elevation profile layer/panel.
  * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
- * Provides the map mode and controls visibility of the elevation profile layer/panel.
  */
 public class ElevationMapMode extends MapMode implements IElevationModelListener {
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/HgtReader.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/HgtReader.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/HgtReader.java	(revision 36309)
@@ -107,8 +107,7 @@
         try (InputStream fis = Compression.getUncompressedFileInputStream(Paths.get(file))) {
             // choose the right endianness
-            ByteBuffer bb = ByteBuffer.wrap(IOUtils.toByteArray(fis));
-            //System.out.println(Arrays.toString(bb.array()));
+            ByteBuffer bb = ByteBuffer.wrap(fis.readAllBytes());
             bb.order(ByteOrder.BIG_ENDIAN);
-            int size = (int) Math.sqrt(bb.array().length / 2);
+            int size = (int) Math.sqrt(bb.array().length / 2.0);
             data = new short[size][size];
             int x = 0;
@@ -130,5 +129,5 @@
      * Reads the elevation value for the given coordinate.
      *
-     * See also <a href="http://gis.stackexchange.com/questions/43743/how-to-extract-elevation-from-hgt-file">stackexchange.com</a>
+     * See also <a href="https://gis.stackexchange.com/questions/43743/how-to-extract-elevation-from-hgt-file">stackexchange.com</a>
      * @param coor the coordinate to get the elevation data for
      * @return the elevation value or <code>Double.NaN</code>, if no value is present
@@ -142,5 +141,5 @@
      * Reads the elevation value for the given coordinate.
      *
-     * See also <a href="http://gis.stackexchange.com/questions/43743/how-to-extract-elevation-from-hgt-file">stackexchange.com</a>
+     * See also <a href="https://gis.stackexchange.com/questions/43743/how-to-extract-elevation-from-hgt-file">stackexchange.com</a>
      * @param coor the coordinate to get the elevation data for
      * @param fileName The expected filename
@@ -205,6 +204,6 @@
 
         float fraction = ((float) SRTM_EXTENT) / (mapSize - 1);
-        int latitude = (int) Math.round(frac(latDegrees) / fraction);
-        int longitude = (int) Math.round(frac(lonDegrees) / fraction);
+        int latitude = (int) Math.round(frac(Math.abs(latDegrees)) / fraction);
+        int longitude = (int) Math.round(frac(Math.abs(lonDegrees)) / fraction);
         if (latDegrees >= 0)
         {
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IEleRenderingListener.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IEleRenderingListener.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IEleRenderingListener.java	(revision 36309)
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IElevationModel.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IElevationModel.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IElevationModel.java	(revision 36309)
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IElevationProfile.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IElevationProfile.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IElevationProfile.java	(revision 36309)
@@ -9,6 +9,6 @@
 
 /**
+ * Interface for an elevation profile providing special properties/values.
  * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
- * Interface for an elevation profile providing special properties/values.
  */
 public interface IElevationProfile {
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IVertexRenderer.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IVertexRenderer.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/IVertexRenderer.java	(revision 36309)
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/UnitMode.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/UnitMode.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/UnitMode.java	(revision 36309)
@@ -3,6 +3,6 @@
 
 /**
+ * Enumeration for different unit types.
  * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
- * Enumeration for different unit types.
  */
 public enum UnitMode {
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/actions/AddElevationLayerAction.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/actions/AddElevationLayerAction.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/actions/AddElevationLayerAction.java	(revision 36309)
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/ElevationModel.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/ElevationModel.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/ElevationModel.java	(revision 36309)
@@ -24,5 +24,4 @@
  */
 public class ElevationModel implements IGpxVisitor, IElevationModel {
-    // private int sliceSize;
     private int trackCounter;
     private final GpxData gpxData;
@@ -61,4 +60,5 @@
 
     /**
+     * Return the tracks of the elevation model
      * @return the tracks
      */
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/ElevationProfile.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/ElevationProfile.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/ElevationProfile.java	(revision 36309)
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/ElevationWayPointKind.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/ElevationWayPointKind.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/ElevationWayPointKind.java	(revision 36309)
@@ -3,6 +3,6 @@
 
 /**
+ * Enumeration which classifies way points within an elevation profile.
  * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
- * Enumeration which classifies way points within an elevation profile.
  */
 public enum ElevationWayPointKind {
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/GeoidCorrectionKind.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/GeoidCorrectionKind.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/GeoidCorrectionKind.java	(revision 36309)
@@ -3,6 +3,6 @@
 
 /**
+ * Enumeration for available elevation correction modes.
  * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
- * Enumeration for available elevation correction modes.
  */
 public enum GeoidCorrectionKind {
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/GpxIterator.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/GpxIterator.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/GpxIterator.java	(revision 36309)
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/IGpxVisitor.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/IGpxVisitor.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/IGpxVisitor.java	(revision 36309)
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/IGpxWaypointVisitor.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/IGpxWaypointVisitor.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/IGpxWaypointVisitor.java	(revision 36309)
@@ -5,6 +5,6 @@
 
 /**
+ * Interface for all GPX data visitors. Hopefully this will be part of JOSM some day.
  * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
- * Interface for all GPX data visitors. Hopefully this will be part of JOSM some day.
  */
 public interface IGpxWaypointVisitor {
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/WayPointMap.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/WayPointMap.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gpx/WayPointMap.java	(revision 36309)
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/EleCoordinate.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/EleCoordinate.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/EleCoordinate.java	(revision 36309)
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 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/EleVertex.java	(revision 36309)
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/ElevationGridLayer.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/ElevationGridLayer.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/ElevationGridLayer.java	(revision 36309)
@@ -41,4 +41,5 @@
 
 /**
+ * Elevation grid display layer
  * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
  *
@@ -284,5 +285,5 @@
 
     @Override
-    public void destroy() {
+    public synchronized void destroy() {
         super.destroy();
         HgtReader.clearCache();
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 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/ElevationGridTile.java	(revision 36309)
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/ElevationGridTileController.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/ElevationGridTileController.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/ElevationGridTileController.java	(revision 36309)
@@ -44,7 +44,3 @@
         return tile;
     }
-
-    /**
-     *
-     */
 }
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/ElevationGridTileLoader.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/ElevationGridTileLoader.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/ElevationGridTileLoader.java	(revision 36309)
@@ -19,4 +19,5 @@
 
 /**
+ * Tile loader for the elevation grid display
  * @author Olli
  *
@@ -24,14 +25,12 @@
 public class ElevationGridTileLoader extends TMSCachedTileLoader {
 
-    class ElevationGridTileJob extends JCSCachedTileLoaderJob<String, BufferedImageCacheEntry> implements TileJob {
+    static class ElevationGridTileJob extends JCSCachedTileLoaderJob<String, BufferedImageCacheEntry> implements TileJob {
 
         private final Tile tile;
         private final TileLoaderListener listener;
-        private final ICacheAccess<String, BufferedImageCacheEntry> cache;
 
         protected ElevationGridTileJob(TileLoaderListener listener, Tile tile, ICacheAccess<String, BufferedImageCacheEntry> cache, TileJobOptions options,
                 ThreadPoolExecutor downloadJobExecutor) {
             super(cache, options, downloadJobExecutor);
-            this.cache = cache;
             this.tile = tile;
             this.listener = listener;
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/ElevationGridTileSource.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/ElevationGridTileSource.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/ElevationGridTileSource.java	(revision 36309)
@@ -8,6 +8,6 @@
 
 /**
+ * Tile source class for the tile loader
  * @author Olli
- *
  */
 public class ElevationGridTileSource extends TMSTileSource {
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/SimpleVertexRenderer.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/SimpleVertexRenderer.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/grid/SimpleVertexRenderer.java	(revision 36309)
@@ -8,4 +8,5 @@
 
 /**
+ * Simple implementation of vertex renderer
  * @author Olli
  *
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfileDialog.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfileDialog.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/ElevationProfileDialog.java	(revision 36309)
@@ -46,7 +46,7 @@
 
 /**
- * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
  * Implements a JOSM ToggleDialog to show the elevation profile. It monitors the
  * connection between layer and elevation profile.
+ * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
  */
 public class ElevationProfileDialog extends ToggleDialog
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/TextAlignment.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/TextAlignment.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/TextAlignment.java	(revision 36309)
@@ -3,6 +3,6 @@
 
 /**
+ * Different text alignments
  * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
- *
  */
 public enum TextAlignment {
Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/TriangleDir.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/TriangleDir.java	(revision 36308)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/gui/TriangleDir.java	(revision 36309)
@@ -3,6 +3,6 @@
 
 /**
+ * All the triangle directions
  * @author Oliver Wieland &lt;oliver.wieland@online.de&gt;
- *
  */
 public enum TriangleDir {
