-use absolute x/y position and scale in MapPosition

- scale calculations look much nicer now, better always
   use 'double' unless you are sure about precision required
- finally got rid of zoomLevel relative coordinates
- cleanup MapPosition and MercatorProjection API functions
This commit is contained in:
Hannes Janetzek
2013-04-07 15:58:45 +02:00
parent a6a729244f
commit 8e01dce85e
29 changed files with 658 additions and 710 deletions

View File

@@ -14,7 +14,7 @@
*/
package org.oscim.database.mapfile.header;
import org.oscim.core.MercatorProjection;
import org.oscim.database.mapfile.Projection;
/**
* Holds all parameters of a sub-file.
@@ -110,6 +110,7 @@ public class SubFileParameter {
*/
private final int hashCodeValue;
SubFileParameter(SubFileParameterBuilder subFileParameterBuilder) {
this.startAddress = subFileParameterBuilder.startAddress;
this.indexStartAddress = subFileParameterBuilder.indexStartAddress;
@@ -120,16 +121,16 @@ public class SubFileParameter {
this.hashCodeValue = calculateHashCode();
// calculate the XY numbers of the boundary tiles in this sub-file
this.boundaryTileBottom = MercatorProjection.latitudeToTileY(
this.boundaryTileBottom = Projection.latitudeToTileY(
subFileParameterBuilder.boundingBox.minLatitudeE6
/ COORDINATES_DIVISOR, this.baseZoomLevel);
this.boundaryTileLeft = MercatorProjection.longitudeToTileX(
this.boundaryTileLeft = Projection.longitudeToTileX(
subFileParameterBuilder.boundingBox.minLongitudeE6
/ COORDINATES_DIVISOR, this.baseZoomLevel);
this.boundaryTileTop = MercatorProjection.latitudeToTileY(
this.boundaryTileTop = Projection.latitudeToTileY(
subFileParameterBuilder.boundingBox.maxLatitudeE6
/ COORDINATES_DIVISOR, this.baseZoomLevel);
this.boundaryTileRight = MercatorProjection.longitudeToTileX(
this.boundaryTileRight = Projection.longitudeToTileX(
subFileParameterBuilder.boundingBox.maxLongitudeE6
/ COORDINATES_DIVISOR, this.baseZoomLevel);