Java Code Examples for processing.core.PApplet#pow()
The following examples show how to use
processing.core.PApplet#pow() .
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: MapProvider.java From constellation with Apache License 2.0 | 6 votes |
@Override public Coordinate sourceCoordinate(final Coordinate coordinate) { final float columnSize = PApplet.pow(2, coordinate.zoom); float wrappedColumn = coordinate.column % columnSize; while (wrappedColumn < 0) { wrappedColumn += columnSize; } final float rowSize = PApplet.pow(2, coordinate.zoom); float wrappedRow = coordinate.row % rowSize; while (wrappedRow < 0) { wrappedRow += rowSize; } return new Coordinate(wrappedRow, wrappedColumn, coordinate.zoom); }
Example 2
Source File: EsriMapProvider.java From constellation with Apache License 2.0 | 5 votes |
/** * Calculate a bounding box to emulate tile boundaries when using the * {@link MapServerType#EXPORT} option. * * @param coordinate the requested tile coordinate. * @return a {@link String} representing a bounding box. */ protected String getBoundingBox(final Coordinate coordinate) { final float n = PApplet.pow(2, coordinate.zoom); final double minLon = (coordinate.column / n) * 360 - 180; final double minLat = Math.atan(Math.sinh(Math.PI * (1 - 2 * (coordinate.row / n)))) * (180 / Math.PI); final double maxLon = ((coordinate.column + 1) / n) * 360 - 180; final double maxLat = Math.atan(Math.sinh(Math.PI * (1 - 2 * ((coordinate.row + 1) / n)))) * (180 / Math.PI); return String.format("%f,%f,%f,%f", minLon, minLat, maxLon, maxLat); }
Example 3
Source File: DefaultMapProvider.java From constellation with Apache License 2.0 | 4 votes |
@Override public String getZoomString(final Coordinate coordinate) { final float gridSize = PApplet.pow(2, coordinate.zoom); final float negativeRow = gridSize - coordinate.row - 1; return (int) coordinate.zoom + "/" + (int) coordinate.column + "/" + (int) negativeRow; }