本文整理汇总了Java中mil.nga.geopackage.BoundingBox.getMinLongitude方法的典型用法代码示例。如果您正苦于以下问题:Java BoundingBox.getMinLongitude方法的具体用法?Java BoundingBox.getMinLongitude怎么用?Java BoundingBox.getMinLongitude使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mil.nga.geopackage.BoundingBox
的用法示例。
在下文中一共展示了BoundingBox.getMinLongitude方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTileGrid
import mil.nga.geopackage.BoundingBox; //导入方法依赖的package包/类
/**
* Get the tile grid that includes the entire tile bounding box
*
* @param webMercatorBoundingBox
* web mercator bounding box
* @param zoom
* zoom level
* @return tile grid
*/
public static TileGrid getTileGrid(BoundingBox webMercatorBoundingBox,
int zoom) {
int tilesPerSide = tilesPerSide(zoom);
double tileSize = tileSize(tilesPerSide);
int minX = (int) ((webMercatorBoundingBox.getMinLongitude() + ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH) / tileSize);
double tempMaxX = (webMercatorBoundingBox.getMaxLongitude() + ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH)
/ tileSize;
int maxX = (int) (tempMaxX - ProjectionConstants.WEB_MERCATOR_PRECISION);
maxX = Math.min(maxX, tilesPerSide - 1);
int minY = (int) (((webMercatorBoundingBox.getMaxLatitude() - ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH) * -1) / tileSize);
double tempMaxY = ((webMercatorBoundingBox.getMinLatitude() - ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH) * -1)
/ tileSize;
int maxY = (int) (tempMaxY - ProjectionConstants.WEB_MERCATOR_PRECISION);
maxY = Math.min(maxY, tilesPerSide - 1);
TileGrid grid = new TileGrid(minX, minY, maxX, maxY);
return grid;
}
示例2: getZoomLevel
import mil.nga.geopackage.BoundingBox; //导入方法依赖的package包/类
/**
* Get the zoom level of where the web mercator bounding box fits into the
* complete world
*
* @param webMercatorBoundingBox
* web mercator bounding box
* @return zoom level
*/
public static int getZoomLevel(BoundingBox webMercatorBoundingBox) {
double worldLength = ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH * 2;
int widthTiles = (int) (worldLength / (webMercatorBoundingBox
.getMaxLongitude() - webMercatorBoundingBox.getMinLongitude()));
int heightTiles = (int) (worldLength / (webMercatorBoundingBox
.getMaxLatitude() - webMercatorBoundingBox.getMinLatitude()));
int tilesPerSide = Math.min(widthTiles, heightTiles);
tilesPerSide = Math.max(tilesPerSide, 1);
int zoom = zoomFromTilesPerSide(tilesPerSide);
return zoom;
}
示例3: expandBoundingBox
import mil.nga.geopackage.BoundingBox; //导入方法依赖的package包/类
/**
* Expand the bounding box by the LatLng
*
* @param boundingBox
* @param latLng
*/
private void expandBoundingBox(BoundingBox boundingBox, LatLng latLng) {
double latitude = latLng.latitude;
double longitude = latLng.longitude;
if (boundingBox.getMinLongitude() <= 3 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH && boundingBox.getMaxLongitude() >= 3 * -ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH) {
if (longitude < boundingBox.getMinLongitude()) {
if (boundingBox.getMinLongitude()
- longitude > (longitude + (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH)) - boundingBox.getMaxLongitude()) {
longitude += (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH);
}
} else if (longitude > boundingBox.getMaxLongitude()) {
if (longitude - boundingBox.getMaxLongitude() > boundingBox.getMinLongitude()
- (longitude - (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH))) {
longitude -= (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH);
}
}
}
if (latitude < boundingBox.getMinLatitude()) {
boundingBox.setMinLatitude(latitude);
}
if (latitude > boundingBox.getMaxLatitude()) {
boundingBox.setMaxLatitude(latitude);
}
if (longitude < boundingBox.getMinLongitude()) {
boundingBox.setMinLongitude(longitude);
}
if (longitude > boundingBox.getMaxLongitude()) {
boundingBox.setMaxLongitude(longitude);
}
}
示例4: getLength
import mil.nga.geopackage.BoundingBox; //导入方法依赖的package包/类
/**
* Get the length of the bounding box
*
* @param boundingBox
* @return length
*/
private static double getLength(BoundingBox boundingBox) {
double width = boundingBox.getMaxLongitude()
- boundingBox.getMinLongitude();
double height = boundingBox.getMaxLatitude()
- boundingBox.getMinLatitude();
double length = Math.min(width, height);
return length;
}
示例5: isGoogleTiles
import mil.nga.geopackage.BoundingBox; //导入方法依赖的package包/类
/**
* Determine if the tiles are in the Google tile coordinate format
*
* @return
*/
public boolean isGoogleTiles() {
// Convert the bounding box to wgs84
BoundingBox boundingBox = tileMatrixSet.getBoundingBox();
BoundingBox wgs84BoundingBox = projection.getTransformation(
ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM).transform(
boundingBox);
boolean googleTiles = false;
// Verify the bounds are the entire world
if (wgs84BoundingBox.getMinLatitude() <= ProjectionConstants.WEB_MERCATOR_MIN_LAT_RANGE
&& wgs84BoundingBox.getMaxLatitude() >= ProjectionConstants.WEB_MERCATOR_MAX_LAT_RANGE
&& wgs84BoundingBox.getMinLongitude() <= -ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH
&& wgs84BoundingBox.getMaxLongitude() >= ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH) {
googleTiles = true;
// Verify each tile matrix is the correct width and height
for (TileMatrix tileMatrix : tileMatrices) {
long zoomLevel = tileMatrix.getZoomLevel();
long tilesPerSide = TileBoundingBoxUtils
.tilesPerSide((int) zoomLevel);
if (tileMatrix.getMatrixWidth() != tilesPerSide
|| tileMatrix.getMatrixHeight() != tilesPerSide) {
googleTiles = false;
break;
}
}
}
return googleTiles;
}
示例6: getTileMatrix
import mil.nga.geopackage.BoundingBox; //导入方法依赖的package包/类
/**
* Get the tile matrix that contains the tiles for the bounding box, matches against the bounding box and zoom level
*
* @param projectedRequestBoundingBox bounding box projected to the tiles
* @return tile matrix or null
*/
private TileMatrix getTileMatrix(BoundingBox projectedRequestBoundingBox) {
TileMatrix tileMatrix = null;
// Check if the request overlaps the tile matrix set
if (TileBoundingBoxUtils.overlap(projectedRequestBoundingBox,
tileSetBoundingBox) != null) {
// Get the tile distance
double distanceWidth = projectedRequestBoundingBox
.getMaxLongitude()
- projectedRequestBoundingBox.getMinLongitude();
double distanceHeight = projectedRequestBoundingBox
.getMaxLatitude()
- projectedRequestBoundingBox.getMinLatitude();
// Get the zoom level to request based upon the tile size
Long zoomLevel = tileDao
.getZoomLevel(distanceWidth, distanceHeight);
// If there is a matching zoom level
if (zoomLevel != null) {
tileMatrix = tileDao.getTileMatrix(zoomLevel);
}
}
return tileMatrix;
}
示例7: transform
import mil.nga.geopackage.BoundingBox; //导入方法依赖的package包/类
/**
* Transform the bounding box
*
* @param boundingBox
* bounding box
* @return bounding box
*/
public BoundingBox transform(BoundingBox boundingBox) {
ProjCoordinate lowerLeft = new ProjCoordinate(
boundingBox.getMinLongitude(), boundingBox.getMinLatitude());
ProjCoordinate lowerRight = new ProjCoordinate(
boundingBox.getMaxLongitude(), boundingBox.getMinLatitude());
ProjCoordinate upperRight = new ProjCoordinate(
boundingBox.getMaxLongitude(), boundingBox.getMaxLatitude());
ProjCoordinate upperLeft = new ProjCoordinate(
boundingBox.getMinLongitude(), boundingBox.getMaxLatitude());
ProjCoordinate projectedLowerLeft = transform(lowerLeft);
ProjCoordinate projectedLowerRight = transform(lowerRight);
ProjCoordinate projectedUpperRight = transform(upperRight);
ProjCoordinate projectedUpperLeft = transform(upperLeft);
double minX = Math.min(projectedLowerLeft.x, projectedUpperLeft.x);
double maxX = Math.max(projectedLowerRight.x, projectedUpperRight.x);
double minY = Math.min(projectedLowerLeft.y, projectedLowerRight.y);
double maxY = Math.max(projectedUpperLeft.y, projectedUpperRight.y);
BoundingBox projectedBoundingBox = new BoundingBox(minX, minY, maxX,
maxY);
return projectedBoundingBox;
}
示例8: padBoundingBox
import mil.nga.geopackage.BoundingBox; //导入方法依赖的package包/类
/**
* Pad the bounding box with extra space for the overlapping pixels
*
* @param tileMatrix
* tile matrix
* @param boundingBox
* bounding box
* @param overlap
* overlapping pixels
* @return padded bounding box
*/
protected BoundingBox padBoundingBox(TileMatrix tileMatrix,
BoundingBox boundingBox, int overlap) {
double lonPixelPadding = tileMatrix.getPixelXSize() * overlap;
double latPixelPadding = tileMatrix.getPixelYSize() * overlap;
BoundingBox paddedBoundingBox = new BoundingBox(
boundingBox.getMinLongitude() - lonPixelPadding,
boundingBox.getMinLatitude() - latPixelPadding,
boundingBox.getMaxLongitude() + lonPixelPadding,
boundingBox.getMaxLatitude() + latPixelPadding);
return paddedBoundingBox;
}
示例9: getXPixel
import mil.nga.geopackage.BoundingBox; //导入方法依赖的package包/类
/**
* Get the X pixel for where the longitude fits into the bounding box
*
* @param width
* width
* @param boundingBox
* bounding box
* @param longitude
* longitude
* @return x pixel
*/
public static float getXPixel(long width, BoundingBox boundingBox,
double longitude) {
double boxWidth = boundingBox.getMaxLongitude()
- boundingBox.getMinLongitude();
double offset = longitude - boundingBox.getMinLongitude();
double percentage = offset / boxWidth;
float pixel = (float) (percentage * width);
return pixel;
}
示例10: getLongitudeFromPixel
import mil.nga.geopackage.BoundingBox; //导入方法依赖的package包/类
/**
* Get the longitude from the pixel location, bounding box, and image width
*
* @param width
* width
* @param boundingBox
* bounding box
* @param pixel
* pixel
* @return longitude
*/
public static double getLongitudeFromPixel(long width,
BoundingBox boundingBox, float pixel) {
double boxWidth = boundingBox.getMaxLongitude()
- boundingBox.getMinLongitude();
double percentage = pixel / width;
double offset = percentage * boxWidth;
double longitude = offset + boundingBox.getMinLongitude();
return longitude;
}
示例11: getBoundingBox
import mil.nga.geopackage.BoundingBox; //导入方法依赖的package包/类
/**
* Get the bounding box of the tile grid in the tile width and height bounds
* using the total bounding box with constant units
*
* @param totalBox
* total bounding box
* @param tileMatrixWidth
* matrix width
* @param tileMatrixHeight
* matrix height
* @param tileGrid
* tile grid
* @return bounding box
* @since 1.2.0
*/
public static BoundingBox getBoundingBox(BoundingBox totalBox,
long tileMatrixWidth, long tileMatrixHeight, TileGrid tileGrid) {
// Get the tile width
double matrixMinX = totalBox.getMinLongitude();
double matrixMaxX = totalBox.getMaxLongitude();
double matrixWidth = matrixMaxX - matrixMinX;
double tileWidth = matrixWidth / tileMatrixWidth;
// Find the longitude range
double minLon = matrixMinX + (tileWidth * tileGrid.getMinX());
double maxLon = matrixMinX + (tileWidth * (tileGrid.getMaxX() + 1));
// Get the tile height
double matrixMinY = totalBox.getMinLatitude();
double matrixMaxY = totalBox.getMaxLatitude();
double matrixHeight = matrixMaxY - matrixMinY;
double tileHeight = matrixHeight / tileMatrixHeight;
// Find the latitude range
double maxLat = matrixMaxY - (tileHeight * tileGrid.getMinY());
double minLat = matrixMaxY - (tileHeight * (tileGrid.getMaxY() + 1));
BoundingBox boundingBox = new BoundingBox(minLon, minLat, maxLon,
maxLat);
return boundingBox;
}
示例12: getTileGridWGS84
import mil.nga.geopackage.BoundingBox; //导入方法依赖的package包/类
/**
* Get the tile grid that includes the entire tile bounding box
*
* @param boundingBox
* wgs84 bounding box
* @param zoom
* zoom level
*
* @return tile grid
* @since 1.2.0
*/
public static TileGrid getTileGridWGS84(BoundingBox boundingBox, int zoom) {
int tilesPerLat = tilesPerWGS84LatSide(zoom);
int tilesPerLon = tilesPerWGS84LonSide(zoom);
double tileSizeLat = tileSizeLatPerWGS84Side(tilesPerLat);
double tileSizeLon = tileSizeLonPerWGS84Side(tilesPerLon);
int minX = (int) ((boundingBox.getMinLongitude() + ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH) / tileSizeLon);
double tempMaxX = (boundingBox.getMaxLongitude() + ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH)
/ tileSizeLon;
int maxX = (int) tempMaxX;
if (tempMaxX % 1 == 0) {
maxX--;
}
maxX = Math.min(maxX, tilesPerLon - 1);
int minY = (int) (((boundingBox.getMaxLatitude() - ProjectionConstants.WGS84_HALF_WORLD_LAT_HEIGHT) * -1) / tileSizeLat);
double tempMaxY = ((boundingBox.getMinLatitude() - ProjectionConstants.WGS84_HALF_WORLD_LAT_HEIGHT) * -1)
/ tileSizeLat;
int maxY = (int) tempMaxY;
if (tempMaxY % 1 == 0) {
maxY--;
}
maxY = Math.min(maxY, tilesPerLat - 1);
TileGrid grid = new TileGrid(minX, minY, maxX, maxY);
return grid;
}
示例13: getTileMatrix
import mil.nga.geopackage.BoundingBox; //导入方法依赖的package包/类
/**
* Get the tile matrix for the zoom level as defined by the area of the
* request
*
* @param request
* elevation request
* @return tile matrix or null
*/
private TileMatrix getTileMatrix(ElevationRequest request) {
TileMatrix tileMatrix = null;
// Check if the request overlaps elevation bounding box
if (request.overlap(elevationBoundingBox) != null) {
// Get the tile distance
BoundingBox projectedBoundingBox = request
.getProjectedBoundingBox();
double distanceWidth = projectedBoundingBox.getMaxLongitude()
- projectedBoundingBox.getMinLongitude();
double distanceHeight = projectedBoundingBox.getMaxLatitude()
- projectedBoundingBox.getMinLatitude();
// Get the zoom level to request based upon the tile size
Long zoomLevel = tileDao.getClosestZoomLevel(distanceWidth,
distanceHeight);
// If there is a matching zoom level
if (zoomLevel != null) {
tileMatrix = tileDao.getTileMatrix(zoomLevel);
}
}
return tileMatrix;
}
示例14: getTileMatrix
import mil.nga.geopackage.BoundingBox; //导入方法依赖的package包/类
/**
* Get the tile matrix that contains the tiles for the bounding box, matches
* against the bounding box and zoom level
*
* @param projectedRequestBoundingBox
* bounding box projected to the tiles
* @return tile matrix or null
*/
private TileMatrix getTileMatrix(BoundingBox projectedRequestBoundingBox) {
TileMatrix tileMatrix = null;
// Check if the request overlaps the tile matrix set
if (TileBoundingBoxUtils.overlap(projectedRequestBoundingBox,
tileSetBoundingBox) != null) {
// Get the tile distance
double distanceWidth = projectedRequestBoundingBox
.getMaxLongitude()
- projectedRequestBoundingBox.getMinLongitude();
double distanceHeight = projectedRequestBoundingBox
.getMaxLatitude()
- projectedRequestBoundingBox.getMinLatitude();
// Get the zoom level to request based upon the tile size
Long zoomLevel = tileDao
.getZoomLevel(distanceWidth, distanceHeight);
// If there is a matching zoom level
if (zoomLevel != null) {
tileMatrix = tileDao.getTileMatrix(zoomLevel);
}
}
return tileMatrix;
}
示例15: isGoogleTiles
import mil.nga.geopackage.BoundingBox; //导入方法依赖的package包/类
/**
* Determine if the tiles are in the Google tile coordinate format
*
* @return true if Google tile format
*/
public boolean isGoogleTiles() {
// Convert the bounding box to wgs84
BoundingBox boundingBox = tileMatrixSet.getBoundingBox();
BoundingBox wgs84BoundingBox = projection.getTransformation(
ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM).transform(
boundingBox);
boolean googleTiles = false;
// Verify the bounds are the entire world
if (wgs84BoundingBox.getMinLatitude() <= ProjectionConstants.WEB_MERCATOR_MIN_LAT_RANGE
&& wgs84BoundingBox.getMaxLatitude() >= ProjectionConstants.WEB_MERCATOR_MAX_LAT_RANGE
&& wgs84BoundingBox.getMinLongitude() <= -ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH
&& wgs84BoundingBox.getMaxLongitude() >= ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH) {
googleTiles = true;
// Verify each tile matrix is the correct width and height
for (TileMatrix tileMatrix : tileMatrices) {
long zoomLevel = tileMatrix.getZoomLevel();
long tilesPerSide = TileBoundingBoxUtils
.tilesPerSide((int) zoomLevel);
if (tileMatrix.getMatrixWidth() != tilesPerSide
|| tileMatrix.getMatrixHeight() != tilesPerSide) {
googleTiles = false;
break;
}
}
}
return googleTiles;
}