本文整理汇总了Java中mil.nga.geopackage.BoundingBox类的典型用法代码示例。如果您正苦于以下问题:Java BoundingBox类的具体用法?Java BoundingBox怎么用?Java BoundingBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BoundingBox类属于mil.nga.geopackage包,在下文中一共展示了BoundingBox类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getBoundingBox
import mil.nga.geopackage.BoundingBox; //导入依赖的package包/类
/**
* Get the WGS84 bounding box of the current map view screen.
* The max longitude will be larger than the min resulting in values larger than 180.0.
*
* @param map google map
* @return current bounding box
*/
public static BoundingBox getBoundingBox(GoogleMap map) {
LatLngBounds visibleBounds = map.getProjection()
.getVisibleRegion().latLngBounds;
LatLng southwest = visibleBounds.southwest;
LatLng northeast = visibleBounds.northeast;
double minLatitude = southwest.latitude;
double maxLatitude = northeast.latitude;
double minLongitude = southwest.longitude;
double maxLongitude = northeast.longitude;
if (maxLongitude < minLongitude) {
maxLongitude += (2 * ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH);
}
BoundingBox boundingBox = new BoundingBox(minLongitude, minLatitude, maxLongitude, maxLatitude);
return boundingBox;
}
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:28,代码来源:MapUtils.java
示例2: buildClickBoundingBox
import mil.nga.geopackage.BoundingBox; //导入依赖的package包/类
/**
* Build a bounding box using the location coordinate click location and map view bounds
*
* @param latLng click location
* @param mapBounds map bounds
* @return bounding box
* @since 1.2.7
*/
public BoundingBox buildClickBoundingBox(LatLng latLng, BoundingBox mapBounds) {
// Get the screen width and height a click occurs from a feature
double width = TileBoundingBoxMapUtils.getLongitudeDistance(mapBounds) * screenClickPercentage;
double height = TileBoundingBoxMapUtils.getLatitudeDistance(mapBounds) * screenClickPercentage;
LatLng leftCoordinate = SphericalUtil.computeOffset(latLng, width, 270);
LatLng upCoordinate = SphericalUtil.computeOffset(latLng, height, 0);
LatLng rightCoordinate = SphericalUtil.computeOffset(latLng, width, 90);
LatLng downCoordinate = SphericalUtil.computeOffset(latLng, height, 180);
BoundingBox boundingBox = new BoundingBox(leftCoordinate.longitude, downCoordinate.latitude, rightCoordinate.longitude, upCoordinate.latitude);
return boundingBox;
}
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:24,代码来源:FeatureOverlayQuery.java
示例3: isWithinBoundingBox
import mil.nga.geopackage.BoundingBox; //导入依赖的package包/类
/**
* Check if the tile request is within the desired tile bounds
*
* @param x
* @param y
* @param zoom
* @return
*/
public boolean isWithinBoundingBox(int x, int y, int zoom) {
boolean withinBounds = true;
// If a bounding box is set, check if it overlaps with the request
if (webMercatorBoundingBox != null) {
// Get the bounding box of the requested tile
BoundingBox requestWebMercatorBoundingBox = TileBoundingBoxUtils
.getWebMercatorBoundingBox(x, y, zoom);
// Check if the request overlaps
withinBounds = TileBoundingBoxUtils.overlap(webMercatorBoundingBox,
requestWebMercatorBoundingBox) != null;
}
return withinBounds;
}
开发者ID:ngageoint,项目名称:geopackage-android-map,代码行数:26,代码来源:BoundedOverlay.java
示例4: drawFeature
import mil.nga.geopackage.BoundingBox; //导入依赖的package包/类
/**
* Draw the feature
*
* @param zoom
* zoom level
* @param boundingBox
* @param transform
* @param graphics
* @param row
*/
private void drawFeature(int zoom, BoundingBox boundingBox,
ProjectionTransform transform, Graphics2D graphics, FeatureRow row) {
try {
GeoPackageGeometryData geomData = row.getGeometry();
if (geomData != null) {
Geometry geometry = geomData.getGeometry();
double simplifyTolerance = TileBoundingBoxUtils
.toleranceDistance(zoom, tileWidth, tileHeight);
drawGeometry(simplifyTolerance, boundingBox, transform,
graphics, geometry);
}
} catch (Exception e) {
log.log(Level.SEVERE, "Failed to draw feature in tile. Table: "
+ featureDao.getTableName(), e);
}
}
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:27,代码来源:DefaultFeatureTiles.java
示例5: getResults
import mil.nga.geopackage.BoundingBox; //导入依赖的package包/类
/**
* Get the elevation tile results for a specified tile matrix
*
* @param requestProjectedBoundingBox
* request projected bounding box
* @param tileMatrix
* tile matrix
* @param overlappingPixels
* number of overlapping pixels used by the algorithm
* @return tile matrix results
*/
private ElevationTileMatrixResults getResults(
BoundingBox requestProjectedBoundingBox, TileMatrix tileMatrix,
int overlappingPixels) {
ElevationTileMatrixResults results = null;
BoundingBox paddedBoundingBox = padBoundingBox(tileMatrix,
requestProjectedBoundingBox, overlappingPixels);
TileResultSet tileResults = retrieveSortedTileResults(
paddedBoundingBox, tileMatrix);
if (tileResults != null) {
if (tileResults.getCount() > 0) {
results = new ElevationTileMatrixResults(tileMatrix,
tileResults);
} else {
tileResults.close();
}
}
return results;
}
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:30,代码来源:ElevationTilesCommon.java
示例6: drawTile
import mil.nga.geopackage.BoundingBox; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public BufferedImage drawTile(int zoom, BoundingBox boundingBox,
FeatureResultSet resultSet) {
BufferedImage image = createNewImage();
Graphics2D graphics = getGraphics(image);
ProjectionTransform webMercatorTransform = getWebMercatorTransform();
while (resultSet.moveToNext()) {
FeatureRow row = resultSet.getRow();
drawFeature(zoom, boundingBox, webMercatorTransform, graphics, row);
}
resultSet.close();
return image;
}
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:22,代码来源:DefaultFeatureTiles.java
示例7: retrieveSortedTileResults
import mil.nga.geopackage.BoundingBox; //导入依赖的package包/类
/**
* Get the tile row results of elevation tiles needed to create the
* requested bounding box elevations, sorted by row and then column
*
* @param projectedRequestBoundingBox bounding box projected to the elevations
* @param tileMatrix tile matrix
* @return tile results or null
*/
private TileCursor retrieveSortedTileResults(
BoundingBox projectedRequestBoundingBox, TileMatrix tileMatrix) {
TileCursor tileResults = null;
if (tileMatrix != null) {
// Get the tile grid
TileGrid tileGrid = TileBoundingBoxUtils.getTileGrid(
elevationBoundingBox, tileMatrix.getMatrixWidth(),
tileMatrix.getMatrixHeight(), projectedRequestBoundingBox);
// Query for matching tiles in the tile grid
tileResults = tileDao.queryByTileGrid(tileGrid,
tileMatrix.getZoomLevel(), TileTable.COLUMN_TILE_ROW + ","
+ TileTable.COLUMN_TILE_COLUMN);
}
return tileResults;
}
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:30,代码来源:ElevationTilesCommon.java
示例8: createTileTableWithMetadata
import mil.nga.geopackage.BoundingBox; //导入依赖的package包/类
/**
* Create the elevation tile table with metadata and extension
*
* @param geoPackage
* @param tableName
* @param contentsBoundingBox
* @param contentsSrsId
* @param tileMatrixSetBoundingBox
* @param tileMatrixSetSrsId
* @return elevation tiles
*/
public static ElevationTilesTiff createTileTableWithMetadata(
GeoPackage geoPackage, String tableName,
BoundingBox contentsBoundingBox, long contentsSrsId,
BoundingBox tileMatrixSetBoundingBox, long tileMatrixSetSrsId) {
TileMatrixSet tileMatrixSet = ElevationTilesCore
.createTileTableWithMetadata(geoPackage, tableName,
contentsBoundingBox, contentsSrsId,
tileMatrixSetBoundingBox, tileMatrixSetSrsId);
TileDao tileDao = geoPackage.getTileDao(tileMatrixSet);
ElevationTilesTiff elevationTiles = new ElevationTilesTiff(geoPackage,
tileDao);
elevationTiles.getOrCreate();
return elevationTiles;
}
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:28,代码来源:ElevationTilesTiff.java
示例9: query
import mil.nga.geopackage.BoundingBox; //导入依赖的package包/类
/**
* Query for feature index results within the bounding box in
* the provided projection
*
* @param boundingBox bounding box
* @param projection projection
* @return feature index results, close when done
*/
public FeatureIndexResults query(BoundingBox boundingBox, Projection projection) {
FeatureIndexResults results = null;
switch (getIndexedType()) {
case GEOPACKAGE:
long count = featureTableIndex.count(boundingBox, projection);
CloseableIterator<GeometryIndex> geometryIndices = featureTableIndex.query(boundingBox, projection);
results = new FeatureIndexGeoPackageResults(featureTableIndex, count, geometryIndices);
break;
case METADATA:
Cursor geometryMetadata = featureIndexer.query(boundingBox, projection);
results = new FeatureIndexMetadataResults(featureIndexer, geometryMetadata);
break;
}
return results;
}
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:24,代码来源:FeatureIndexManager.java
示例10: testGenerateTilesRandom
import mil.nga.geopackage.BoundingBox; //导入依赖的package包/类
/**
* Test generating tiles with random bounds and zoomss
*
* @param geoPackage
* @throws SQLException
* @throws IOException
*/
public static void testGenerateTilesRandom(GeoPackage geoPackage)
throws SQLException, IOException {
for (int i = 0; i < 10; i++) {
int minZoom = (int) (Math.random() * 3.0);
int maxZoom = minZoom + ((int) (Math.random() * 3.0));
Point point1 = TestUtils.createPoint(false, false);
Point point2 = TestUtils.createPoint(false, false);
BoundingBox boundingBox = new BoundingBox(Math.min(point1.getX(),
point2.getX()), Math.min(point1.getY(), point2.getY()),
Math.max(point1.getX(), point2.getX()), Math.max(
point1.getY(), point2.getY()));
UrlTileGenerator tileGenerator = new UrlTileGenerator(geoPackage,
TABLE_NAME + i, URL, minZoom, maxZoom, boundingBox,
getProjection());
testGenerateTiles(tileGenerator);
}
}
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:28,代码来源:UrlTileGeneratorUtils.java
示例11: UrlTileGenerator
import mil.nga.geopackage.BoundingBox; //导入依赖的package包/类
/**
* Constructor
*
* @param geoPackage
* GeoPackage
* @param tableName
* table name
* @param tileUrl
* tile url
* @param minZoom
* min zoom
* @param maxZoom
* max zoom
* @param boundingBox
* tiles bounding box
* @param projection
* tiles projection
* @since 1.2.0
*/
public UrlTileGenerator(GeoPackage geoPackage, String tableName,
String tileUrl, int minZoom, int maxZoom, BoundingBox boundingBox,
Projection projection) {
super(geoPackage, tableName, minZoom, maxZoom, boundingBox, projection);
try {
this.tileUrl = URLDecoder.decode(tileUrl, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new GeoPackageException("Failed to decode tile url: "
+ tileUrl, e);
}
this.urlHasXYZ = hasXYZ(tileUrl);
this.urlHasBoundingBox = hasBoundingBox(tileUrl);
if (!this.urlHasXYZ && !this.urlHasBoundingBox) {
throw new GeoPackageException(
"URL does not contain x,y,z or bounding box variables: "
+ tileUrl);
}
}
开发者ID:ngageoint,项目名称:geopackage-java,代码行数:41,代码来源:UrlTileGenerator.java
示例12: getFloatRectangle
import mil.nga.geopackage.BoundingBox; //导入依赖的package包/类
/**
* Get a rectangle with floating point boundaries using the tile width,
* height, bounding box, and the bounding box section within the outer box
* to build the rectangle from
*
* @param width width
* @param height height
* @param boundingBox full bounding box
* @param boundingBoxSection rectangle bounding box section
* @return floating point rectangle
*/
public static RectF getFloatRectangle(long width, long height,
BoundingBox boundingBox, BoundingBox boundingBoxSection) {
float left = TileBoundingBoxUtils.getXPixel(width, boundingBox,
boundingBoxSection.getMinLongitude());
float right = TileBoundingBoxUtils.getXPixel(width, boundingBox,
boundingBoxSection.getMaxLongitude());
float top = TileBoundingBoxUtils.getYPixel(height, boundingBox,
boundingBoxSection.getMaxLatitude());
float bottom = TileBoundingBoxUtils.getYPixel(height, boundingBox,
boundingBoxSection.getMinLatitude());
RectF rect = new RectF(left, top, right, bottom);
return rect;
}
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:28,代码来源:TileBoundingBoxAndroidUtils.java
示例13: drawTile
import mil.nga.geopackage.BoundingBox; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Bitmap drawTile(int zoom, BoundingBox webMercatorBoundingBox, FeatureIndexResults results) {
// Create bitmap and canvas
Bitmap bitmap = createNewBitmap();
Canvas canvas = new Canvas(bitmap);
ProjectionTransform transform = getProjectionToWebMercatorTransform(featureDao.getProjection());
for (FeatureRow featureRow : results) {
drawFeature(zoom, webMercatorBoundingBox, transform, canvas, featureRow);
}
return bitmap;
}
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:19,代码来源:DefaultFeatureTiles.java
示例14: 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
示例15: addRing
import mil.nga.geopackage.BoundingBox; //导入依赖的package包/类
/**
* Add a ring
*
* @param simplifyTolerance simplify tolerance in meters
* @param boundingBox
* @param transform
* @param path
* @param points
*/
private void addRing(double simplifyTolerance, BoundingBox boundingBox, ProjectionTransform transform, Path path, List<Point> points) {
// Try to simplify the number of points in the LineString
points = simplifyPoints(simplifyTolerance, points);
for (int i = 0; i < points.size(); i++) {
Point point = points.get(i);
Point webMercatorPoint = getPoint(transform, point);
float x = TileBoundingBoxUtils.getXPixel(tileWidth, boundingBox,
webMercatorPoint.getX());
float y = TileBoundingBoxUtils.getYPixel(tileHeight, boundingBox,
webMercatorPoint.getY());
if (i == 0) {
path.moveTo(x, y);
} else {
path.lineTo(x, y);
}
}
path.close();
}
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:30,代码来源:DefaultFeatureTiles.java
示例16: loadTiles
import mil.nga.geopackage.BoundingBox; //导入依赖的package包/类
/**
* Load tiles from a URL
*
* @param activity
* @param callback
* @param active
* @param database
* @param tableName
* @param tileUrl
* @param minZoom
* @param maxZoom
* @param compressFormat
* @param compressQuality
* @param googleTiles
* @param boundingBox
* @param epsg
*/
public static void loadTiles(Activity activity, ILoadTilesTask callback,
GeoPackageDatabases active, String database, String tableName,
String tileUrl, int minZoom, int maxZoom,
CompressFormat compressFormat, Integer compressQuality,
boolean googleTiles, BoundingBox boundingBox, long epsg) {
GeoPackageManager manager = GeoPackageFactory.getManager(activity);
GeoPackage geoPackage = manager.open(database);
Projection projection = ProjectionFactory.getProjection(epsg);
BoundingBox bbox = transform(boundingBox, projection);
TileGenerator tileGenerator = new UrlTileGenerator(activity, geoPackage,
tableName, tileUrl, minZoom, maxZoom, bbox, projection);
setTileGenerator(activity, tileGenerator, minZoom, maxZoom, compressFormat, compressQuality, googleTiles, boundingBox);
loadTiles(activity, callback, active, geoPackage, tableName, tileGenerator);
}
开发者ID:ngageoint,项目名称:geopackage-mapcache-android,代码行数:36,代码来源:LoadTilesTask.java
示例17: queryIndexedFeaturesCount
import mil.nga.geopackage.BoundingBox; //导入依赖的package包/类
/**
* Draw a tile bitmap from the x, y, and zoom level by querying features in the tile location
*
* @param x
* @param y
* @param zoom
* @return feature count
* @since 1.1.0
*/
public long queryIndexedFeaturesCount(int x, int y, int zoom) {
// Get the web mercator bounding box
BoundingBox webMercatorBoundingBox = TileBoundingBoxUtils
.getWebMercatorBoundingBox(x, y, zoom);
// Query for geometries matching the bounds in the index
FeatureIndexResults results = queryIndexedFeatures(webMercatorBoundingBox);
long count = 0;
try {
count = results.count();
} finally {
results.close();
}
return count;
}
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:29,代码来源:FeatureTiles.java
示例18: queryIndexedFeatures
import mil.nga.geopackage.BoundingBox; //导入依赖的package包/类
/**
* Query for feature results in the x, y, and zoom level by querying features in the tile location
*
* @param webMercatorBoundingBox
* @return feature index results
* @since 1.1.0
*/
public FeatureIndexResults queryIndexedFeatures(BoundingBox webMercatorBoundingBox) {
// Create an expanded bounding box to handle features outside the tile that overlap
double minLongitude = TileBoundingBoxUtils.getLongitudeFromPixel(tileWidth, webMercatorBoundingBox, 0 - widthOverlap);
double maxLongitude = TileBoundingBoxUtils.getLongitudeFromPixel(tileWidth, webMercatorBoundingBox, tileWidth + widthOverlap);
double maxLatitude = TileBoundingBoxUtils.getLatitudeFromPixel(tileHeight, webMercatorBoundingBox, 0 - heightOverlap);
double minLatitude = TileBoundingBoxUtils.getLatitudeFromPixel(tileHeight, webMercatorBoundingBox, tileHeight + heightOverlap);
BoundingBox expandedQueryBoundingBox = new BoundingBox(
minLongitude,
minLatitude,
maxLongitude,
maxLatitude);
// Query for geometries matching the bounds in the index
FeatureIndexResults results = indexManager.query(expandedQueryBoundingBox, WEB_MERCATOR_PROJECTION);
return results;
}
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:26,代码来源:FeatureTiles.java
示例19: getWebMercatorBoundingBox
import mil.nga.geopackage.BoundingBox; //导入依赖的package包/类
/**
* Get the Web Mercator tile bounding box from the Google Maps API tile
* coordinates and zoom level
*
* @param x
* x coordinate
* @param y
* y coordinate
* @param zoom
* zoom level
* @return bounding box
*/
public static BoundingBox getWebMercatorBoundingBox(long x, long y, int zoom) {
double tileSize = tileSizeWithZoom(zoom);
double minLon = (-1 * ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH)
+ (x * tileSize);
double maxLon = (-1 * ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH)
+ ((x + 1) * tileSize);
double minLat = ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH
- ((y + 1) * tileSize);
double maxLat = ProjectionConstants.WEB_MERCATOR_HALF_WORLD_WIDTH
- (y * tileSize);
BoundingBox box = new BoundingBox(minLon, minLat, maxLon, maxLat);
return box;
}
开发者ID:ngageoint,项目名称:geopackage-core-java,代码行数:30,代码来源:TileBoundingBoxUtils.java
示例20: UrlTileGenerator
import mil.nga.geopackage.BoundingBox; //导入依赖的package包/类
/**
* Constructor
*
* @param context app context
* @param geoPackage GeoPackage
* @param tableName table name
* @param tileUrl tile url
* @param minZoom min zoom
* @param maxZoom max zoom
* @param boundingBox tiles bounding box
* @param projection tiles projection
* @since 1.3.0
*/
public UrlTileGenerator(Context context, GeoPackage geoPackage,
String tableName, String tileUrl, int minZoom, int maxZoom, BoundingBox boundingBox, Projection projection) {
super(context, geoPackage, tableName, minZoom, maxZoom, boundingBox, projection);
try {
this.tileUrl = URLDecoder.decode(tileUrl, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new GeoPackageException("Failed to decode tile url: "
+ tileUrl, e);
}
this.urlHasXYZ = hasXYZ(tileUrl);
this.urlHasBoundingBox = hasBoundingBox(tileUrl);
if (!this.urlHasXYZ && !this.urlHasBoundingBox) {
throw new GeoPackageException(
"URL does not contain x,y,z or bounding box variables: "
+ tileUrl);
}
}
开发者ID:ngageoint,项目名称:geopackage-android,代码行数:34,代码来源:UrlTileGenerator.java
注:本文中的mil.nga.geopackage.BoundingBox类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论