formatting
This commit is contained in:
@@ -80,7 +80,7 @@ public class MapFileHeader {
|
||||
|
||||
/**
|
||||
* Reads and validates the header block from the map file.
|
||||
*
|
||||
*
|
||||
* @param readBuffer
|
||||
* the ReadBuffer for the file data.
|
||||
* @param fileSize
|
||||
|
||||
@@ -19,7 +19,7 @@ import org.oscim.database.mapfile.MapDatabase;
|
||||
|
||||
/**
|
||||
* Contains the immutable metadata of a map file.
|
||||
*
|
||||
*
|
||||
* @see MapDatabase#getMapInfo()
|
||||
*/
|
||||
public class MapFileInfo extends org.oscim.database.MapInfo {
|
||||
|
||||
@@ -59,7 +59,8 @@ final class OptionalFields {
|
||||
*/
|
||||
private static final int START_ZOOM_LEVEL_MAX = 22;
|
||||
|
||||
static OpenResult readOptionalFields(ReadBuffer readBuffer, MapFileInfoBuilder mapFileInfoBuilder) {
|
||||
static OpenResult readOptionalFields(ReadBuffer readBuffer,
|
||||
MapFileInfoBuilder mapFileInfoBuilder) {
|
||||
OptionalFields optionalFields = new OptionalFields(readBuffer.readByte());
|
||||
mapFileInfoBuilder.optionalFields = optionalFields;
|
||||
|
||||
@@ -106,13 +107,15 @@ final class OptionalFields {
|
||||
if (this.hasStartPosition) {
|
||||
// get and check the start position latitude (4 byte)
|
||||
int mapStartLatitude = readBuffer.readInt();
|
||||
if (mapStartLatitude < RequiredFields.LATITUDE_MIN || mapStartLatitude > RequiredFields.LATITUDE_MAX) {
|
||||
if (mapStartLatitude < RequiredFields.LATITUDE_MIN
|
||||
|| mapStartLatitude > RequiredFields.LATITUDE_MAX) {
|
||||
return new OpenResult("invalid map start latitude: " + mapStartLatitude);
|
||||
}
|
||||
|
||||
// get and check the start position longitude (4 byte)
|
||||
int mapStartLongitude = readBuffer.readInt();
|
||||
if (mapStartLongitude < RequiredFields.LONGITUDE_MIN || mapStartLongitude > RequiredFields.LONGITUDE_MAX) {
|
||||
if (mapStartLongitude < RequiredFields.LONGITUDE_MIN
|
||||
|| mapStartLongitude > RequiredFields.LONGITUDE_MAX) {
|
||||
return new OpenResult("invalid map start longitude: " + mapStartLongitude);
|
||||
}
|
||||
|
||||
|
||||
@@ -104,11 +104,13 @@ final class RequiredFields {
|
||||
return new OpenResult("invalid longitude range: " + minLongitude + SPACE + maxLongitude);
|
||||
}
|
||||
|
||||
mapFileInfoBuilder.boundingBox = new BoundingBox(minLatitude, minLongitude, maxLatitude, maxLongitude);
|
||||
mapFileInfoBuilder.boundingBox = new BoundingBox(minLatitude, minLongitude, maxLatitude,
|
||||
maxLongitude);
|
||||
return OpenResult.SUCCESS;
|
||||
}
|
||||
|
||||
static OpenResult readFileSize(ReadBuffer readBuffer, long fileSize, MapFileInfoBuilder mapFileInfoBuilder) {
|
||||
static OpenResult readFileSize(ReadBuffer readBuffer, long fileSize,
|
||||
MapFileInfoBuilder mapFileInfoBuilder) {
|
||||
// get and check the file size (8 bytes)
|
||||
long headerFileSize = readBuffer.readLong();
|
||||
if (headerFileSize != fileSize) {
|
||||
@@ -174,7 +176,8 @@ final class RequiredFields {
|
||||
return OpenResult.SUCCESS;
|
||||
}
|
||||
|
||||
static OpenResult readProjectionName(ReadBuffer readBuffer, MapFileInfoBuilder mapFileInfoBuilder) {
|
||||
static OpenResult readProjectionName(ReadBuffer readBuffer,
|
||||
MapFileInfoBuilder mapFileInfoBuilder) {
|
||||
// get and check the projection name
|
||||
String projectionName = readBuffer.readUTF8EncodedString();
|
||||
if (!MERCATOR.equals(projectionName)) {
|
||||
|
||||
@@ -120,14 +120,18 @@ public class SubFileParameter {
|
||||
this.hashCodeValue = calculateHashCode();
|
||||
|
||||
// calculate the XY numbers of the boundary tiles in this sub-file
|
||||
this.boundaryTileBottom = MercatorProjection.latitudeToTileY(subFileParameterBuilder.boundingBox.minLatitudeE6
|
||||
/ COORDINATES_DIVISOR, this.baseZoomLevel);
|
||||
this.boundaryTileLeft = MercatorProjection.longitudeToTileX(subFileParameterBuilder.boundingBox.minLongitudeE6
|
||||
/ COORDINATES_DIVISOR, this.baseZoomLevel);
|
||||
this.boundaryTileTop = MercatorProjection.latitudeToTileY(subFileParameterBuilder.boundingBox.maxLatitudeE6
|
||||
/ COORDINATES_DIVISOR, this.baseZoomLevel);
|
||||
this.boundaryTileRight = MercatorProjection.longitudeToTileX(subFileParameterBuilder.boundingBox.maxLongitudeE6
|
||||
/ COORDINATES_DIVISOR, this.baseZoomLevel);
|
||||
this.boundaryTileBottom = MercatorProjection.latitudeToTileY(
|
||||
subFileParameterBuilder.boundingBox.minLatitudeE6
|
||||
/ COORDINATES_DIVISOR, this.baseZoomLevel);
|
||||
this.boundaryTileLeft = MercatorProjection.longitudeToTileX(
|
||||
subFileParameterBuilder.boundingBox.minLongitudeE6
|
||||
/ COORDINATES_DIVISOR, this.baseZoomLevel);
|
||||
this.boundaryTileTop = MercatorProjection.latitudeToTileY(
|
||||
subFileParameterBuilder.boundingBox.maxLatitudeE6
|
||||
/ COORDINATES_DIVISOR, this.baseZoomLevel);
|
||||
this.boundaryTileRight = MercatorProjection.longitudeToTileX(
|
||||
subFileParameterBuilder.boundingBox.maxLongitudeE6
|
||||
/ COORDINATES_DIVISOR, this.baseZoomLevel);
|
||||
|
||||
// calculate the horizontal and vertical amount of blocks in this sub-file
|
||||
this.blocksWidth = this.boundaryTileRight - this.boundaryTileLeft + 1;
|
||||
|
||||
Reference in New Issue
Block a user