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


Java BoundingBox.getMaxLongitude方法代码示例

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


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

示例1: getTileColumn

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

	double minX = totalBox.getMinLongitude();
	double maxX = totalBox.getMaxLongitude();

	long tileId;
	if (longitude < minX) {
		tileId = -1;
	} else if (longitude >= maxX) {
		tileId = matrixWidth;
	} else {
		double matrixWidthMeters = totalBox.getMaxLongitude()
				- totalBox.getMinLongitude();
		double tileWidth = matrixWidthMeters / matrixWidth;
		tileId = (long) ((longitude - minX) / tileWidth);
	}

	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: 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

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

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

示例11: 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

示例12: 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

示例13: 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-java,代码行数:37,代码来源:TileCreator.java

示例14: 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;
}
 
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:39,代码来源:TileDao.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.getMaxLongitude方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。