Java Code Examples for mil.nga.geopackage.tiles.TileBoundingBoxUtils#getXPixel()
The following examples show how to use
mil.nga.geopackage.tiles.TileBoundingBoxUtils#getXPixel() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultFeatureTiles.java From geopackage-android with MIT License | 6 votes |
/** * Add the linestring to the path * * @param simplifyTolerance simplify tolerance in meters * @param boundingBox bounding box * @param transform projection transform * @param path path * @param lineString line string */ private void addLineString(double simplifyTolerance, BoundingBox boundingBox, ProjectionTransform transform, Path path, LineString lineString) { List<Point> points = lineString.getPoints(); if (points.size() >= 2) { // 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 = transform.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); } } } }
Example 2
Source File: DefaultFeatureTiles.java From geopackage-android with MIT License | 6 votes |
/** * Add a ring * * @param simplifyTolerance simplify tolerance in meters * @param boundingBox bounding box * @param transform projection transform * @param path path * @param points 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 = transform.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(); }
Example 3
Source File: DefaultFeatureTiles.java From geopackage-java with MIT License | 5 votes |
/** * Get the path of the line string * * @param simplifyTolerance * simplify tolerance in meters * @param boundingBox * @param transform * @param lineString */ private Path2D getPath(double simplifyTolerance, BoundingBox boundingBox, ProjectionTransform transform, LineString lineString) { Path2D path = null; // Try to simplify the number of points in the LineString List<Point> lineStringPoints = simplifyPoints(simplifyTolerance, lineString.getPoints()); for (Point point : lineStringPoints) { Point projectedPoint = transform.transform(point); float x = TileBoundingBoxUtils.getXPixel(tileWidth, boundingBox, projectedPoint.getX()); float y = TileBoundingBoxUtils.getYPixel(tileHeight, boundingBox, projectedPoint.getY()); if (path == null) { path = new Path2D.Double(); path.moveTo(x, y); } else { path.lineTo(x, y); } } return path; }