Skip to content
Permalink
Browse files

MercatorProjection: minor code improvements

  • Loading branch information...
devemux86 committed Nov 4, 2019
1 parent be1fccf commit 121b93d52048fa013238c1ed1a62f61e438a648f
Showing with 8 additions and 8 deletions.
  1. +8 −8 mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java
@@ -117,14 +117,14 @@ public static long getMapSize(byte zoomLevel, int tileSize) {
}

public static Point getPixelWithScaleFactor(LatLong latLong, double scaleFactor, int tileSize) {
double pixelX = MercatorProjection.longitudeToPixelXWithScaleFactor(latLong.longitude, scaleFactor, tileSize);
double pixelY = MercatorProjection.latitudeToPixelYWithScaleFactor(latLong.latitude, scaleFactor, tileSize);
double pixelX = longitudeToPixelXWithScaleFactor(latLong.longitude, scaleFactor, tileSize);
double pixelY = latitudeToPixelYWithScaleFactor(latLong.latitude, scaleFactor, tileSize);
return new Point(pixelX, pixelY);
}

public static Point getPixel(LatLong latLong, long mapSize) {
double pixelX = MercatorProjection.longitudeToPixelX(latLong.longitude, mapSize);
double pixelY = MercatorProjection.latitudeToPixelY(latLong.latitude, mapSize);
double pixelX = longitudeToPixelX(latLong.longitude, mapSize);
double pixelY = latitudeToPixelY(latLong.latitude, mapSize);
return new Point(pixelX, pixelY);
}

@@ -148,8 +148,8 @@ public static Point getPixelAbsolute(LatLong latLong, long mapSize) {
* @return the relative pixel position to the origin values (e.g. for a tile)
*/
public static Point getPixelRelative(LatLong latLong, long mapSize, double x, double y) {
double pixelX = MercatorProjection.longitudeToPixelX(latLong.longitude, mapSize) - x;
double pixelY = MercatorProjection.latitudeToPixelY(latLong.latitude, mapSize) - y;
double pixelX = longitudeToPixelX(latLong.longitude, mapSize) - x;
double pixelY = latitudeToPixelY(latLong.latitude, mapSize) - y;
return new Point(pixelX, pixelY);
}

@@ -310,7 +310,7 @@ public static int longitudeToTileX(double longitude, byte zoomLevel) {
* @return pixels that represent the meters at the given zoom-level and latitude.
*/
public static double metersToPixelsWithScaleFactor(float meters, double latitude, double scaleFactor, int tileSize) {
return meters / MercatorProjection.calculateGroundResolutionWithScaleFactor(latitude, scaleFactor, tileSize);
return meters / calculateGroundResolutionWithScaleFactor(latitude, scaleFactor, tileSize);
}

/**
@@ -322,7 +322,7 @@ public static double metersToPixelsWithScaleFactor(float meters, double latitude
* @return pixels that represent the meters at the given zoom-level and latitude.
*/
public static double metersToPixels(float meters, double latitude, long mapSize) {
return meters / MercatorProjection.calculateGroundResolution(latitude, mapSize);
return meters / calculateGroundResolution(latitude, mapSize);
}

/**

0 comments on commit 121b93d

Please sign in to comment.
You can’t perform that action at this time.