当前位置: 首页>>代码示例>>Java>>正文


Java BoundingBox.getMaxLatitude方法代码示例

本文整理汇总了Java中mil.nga.geopackage.BoundingBox.getMaxLatitude方法的典型用法代码示例。如果您正苦于以下问题:Java BoundingBox.getMaxLatitude方法的具体用法?Java BoundingBox.getMaxLatitude怎么用?Java BoundingBox.getMaxLatitude使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mil.nga.geopackage.BoundingBox的用法示例。


在下文中一共展示了BoundingBox.getMaxLatitude方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTileRow

import mil.nga.geopackage.BoundingBox; //导入方法依赖的package包/类
/**
 * Get the tile row of the latitude in constant units
 *
 * @param totalBox
 *            total bounding box
 * @param matrixHeight
 *            matrix height
 * @param latitude
 *            in constant units
 * @return tile row if in the range, -1 if before,
 *         {@link TileMatrix#getMatrixHeight()} if after
 */
public static long getTileRow(BoundingBox totalBox, long matrixHeight,
		double latitude) {

	double minY = totalBox.getMinLatitude();
	double maxY = totalBox.getMaxLatitude();

	long tileId;
	if (latitude <= minY) {
		tileId = matrixHeight;
	} else if (latitude > maxY) {
		tileId = -1;
	} else {
		double matrixHeightMeters = totalBox.getMaxLatitude()
				- totalBox.getMinLatitude();
		double tileHeight = matrixHeightMeters / matrixHeight;
		tileId = (long) ((maxY - latitude) / tileHeight);
	}

	return tileId;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:33,代码来源:TileBoundingBoxUtils.java

示例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;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:25,代码来源:TileBoundingBoxUtils.java

示例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);
    }

}
 
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:40,代码来源:GoogleMapShape.java

示例4: 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;
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:35,代码来源:ElevationTilesCommon.java

示例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;
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:39,代码来源:TileDao.java

示例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;
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:35,代码来源:TileCreator.java

示例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;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:34,代码来源:ProjectionTransform.java

示例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;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:23,代码来源:ElevationTilesCore.java

示例9: getYPixel

import mil.nga.geopackage.BoundingBox; //导入方法依赖的package包/类
/**
 * Get the Y pixel for where the latitude fits into the bounding box
 *
 * @param height
 *            height
 * @param boundingBox
 *            bounding box
 * @param latitude
 *            latitude
 * @return y pixel
 */
public static float getYPixel(long height, BoundingBox boundingBox,
		double latitude) {

	double boxHeight = boundingBox.getMaxLatitude()
			- boundingBox.getMinLatitude();
	double offset = boundingBox.getMaxLatitude() - latitude;
	double percentage = offset / boxHeight;
	float pixel = (float) (percentage * height);

	return pixel;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:23,代码来源:TileBoundingBoxUtils.java

示例10: getLatitudeFromPixel

import mil.nga.geopackage.BoundingBox; //导入方法依赖的package包/类
/**
 * Get the latitude from the pixel location, bounding box, and image height
 * 
 * @param height
 *            height
 * @param boundingBox
 *            bounding box
 * @param pixel
 *            pixel
 * @return latitude
 */
public static double getLatitudeFromPixel(long height,
		BoundingBox boundingBox, float pixel) {

	double boxHeight = boundingBox.getMaxLatitude()
			- boundingBox.getMinLatitude();
	double percentage = pixel / height;
	double offset = percentage * boxHeight;
	double latitude = boundingBox.getMaxLatitude() - offset;

	return latitude;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:23,代码来源:TileBoundingBoxUtils.java

示例11: boundDegreesBoundingBoxWithWebMercatorLimits

import mil.nga.geopackage.BoundingBox; //导入方法依赖的package包/类
/**
 * Bound the upper and lower bounds of the degrees bounding box with web
 * mercator limits
 * 
 * @param boundingBox
 *            degrees bounding box
 * @return bounding box
 * @since 1.3.1
 */
public static BoundingBox boundDegreesBoundingBoxWithWebMercatorLimits(
		BoundingBox boundingBox) {
	BoundingBox bounded = new BoundingBox(boundingBox);
	if (bounded.getMinLatitude() < ProjectionConstants.WEB_MERCATOR_MIN_LAT_RANGE) {
		bounded.setMinLatitude(ProjectionConstants.WEB_MERCATOR_MIN_LAT_RANGE);
	}
	if (bounded.getMaxLatitude() > ProjectionConstants.WEB_MERCATOR_MAX_LAT_RANGE) {
		bounded.setMaxLatitude(ProjectionConstants.WEB_MERCATOR_MAX_LAT_RANGE);
	}
	return bounded;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:21,代码来源:TileBoundingBoxUtils.java

示例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;
}
 
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:42,代码来源:TileBoundingBoxUtils.java

示例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;
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:36,代码来源:ElevationTilesCommon.java

示例14: 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;
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:17,代码来源:TileWriter.java

示例15: reprojectTile

import mil.nga.geopackage.BoundingBox; //导入方法依赖的package包/类
/**
 * Reproject the tile to the requested projection
 *
 * @param tile                    tile in the tile matrix projection
 * @param requestedTileWidth      requested tile width
 * @param requestedTileHeight     requested tile height
 * @param requestBoundingBox      request bounding box in the request projection
 * @param transformRequestToTiles transformation from request to tiles
 * @param tilesBoundingBox        request bounding box in the tile matrix projection
 * @return projected tile
 */
private Bitmap reprojectTile(Bitmap tile, int requestedTileWidth, int requestedTileHeight, BoundingBox requestBoundingBox, ProjectionTransform transformRequestToTiles, BoundingBox tilesBoundingBox) {

    final double requestedWidthUnitsPerPixel = (requestBoundingBox.getMaxLongitude() - requestBoundingBox.getMinLongitude()) / requestedTileWidth;
    final double requestedHeightUnitsPerPixel = (requestBoundingBox.getMaxLatitude() - requestBoundingBox.getMinLatitude()) / requestedTileHeight;

    final double tilesDistanceWidth = tilesBoundingBox.getMaxLongitude() - tilesBoundingBox.getMinLongitude();
    final double tilesDistanceHeight = tilesBoundingBox.getMaxLatitude() - tilesBoundingBox.getMinLatitude();

    final int width = tile.getWidth();
    final int height = tile.getHeight();

    // Tile pixels of the tile matrix tiles
    int[] pixels = new int[width * height];
    tile.getPixels(pixels, 0, width, 0, 0, width, height);

    // Projected tile pixels to draw the reprojected tile
    int[] projectedPixels = new int[requestedTileWidth * requestedTileHeight];

    // Retrieve each pixel in the new tile from the unprojected tile
    for (int y = 0; y < requestedTileHeight; y++) {
        for (int x = 0; x < requestedTileWidth; x++) {

            double longitude = requestBoundingBox.getMinLongitude() + (x * requestedWidthUnitsPerPixel);
            double latitude = requestBoundingBox.getMaxLatitude() - (y * requestedHeightUnitsPerPixel);
            ProjCoordinate fromCoord = new ProjCoordinate(longitude, latitude);
            ProjCoordinate toCoord = transformRequestToTiles.transform(fromCoord);
            double projectedLongitude = toCoord.x;
            double projectedLatitude = toCoord.y;

            int xPixel = (int) Math.round(((projectedLongitude - tilesBoundingBox.getMinLongitude()) / tilesDistanceWidth) * width);
            int yPixel = (int) Math.round(((tilesBoundingBox.getMaxLatitude() - projectedLatitude) / tilesDistanceHeight) * height);

            xPixel = Math.max(0, xPixel);
            xPixel = Math.min(width - 1, xPixel);

            yPixel = Math.max(0, yPixel);
            yPixel = Math.min(height - 1, yPixel);

            int color = pixels[(yPixel * width) + xPixel];
            projectedPixels[(y * requestedTileWidth) + x] = color;
        }
    }

    // Draw the new tile bitmap
    Bitmap projectedTileBitmap = Bitmap.createBitmap(requestedTileWidth,
            requestedTileHeight, tile.getConfig());
    projectedTileBitmap.setPixels(projectedPixels, 0, requestedTileWidth, 0, 0, requestedTileWidth, requestedTileHeight);

    return projectedTileBitmap;
}
 
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:62,代码来源:TileCreator.java


注:本文中的mil.nga.geopackage.BoundingBox.getMaxLatitude方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。