MCPcopy Index your code
hub / github.com/Grover-c13/PokeGOAPI-Java / getCellIds

Method getCellIds

src/main/java/com/pokegoapi/api/map/Map.java:496–518  ·  view source on GitHub ↗

Get a list of all the Cell Ids. @param latitude latitude @param longitude longitude @param width width @return List of Cells

(double latitude, double longitude, int width)

Source from the content-addressed store, hash-verified

494 * @return List of Cells
495 */
496 public List<Long> getCellIds(double latitude, double longitude, int width) {
497 S2LatLng latLng = S2LatLng.fromDegrees(latitude, longitude);
498 S2CellId cellId = S2CellId.fromLatLng(latLng).parent(15);
499
500 MutableInteger index = new MutableInteger(0);
501 MutableInteger jindex = new MutableInteger(0);
502
503
504 int level = cellId.level();
505 int size = 1 << (S2CellId.MAX_LEVEL - level);
506 int face = cellId.toFaceIJOrientation(index, jindex, null);
507
508 List<Long> cells = new ArrayList<Long>();
509
510 int halfWidth = (int) Math.floor(width / 2);
511 for (int x = -halfWidth; x <= halfWidth; x++) {
512 for (int y = -halfWidth; y <= halfWidth; y++) {
513 cells.add(S2CellId.fromFaceIJ(face, index.intValue() + x * size, jindex.intValue() + y * size)
514 .parent(15).id());
515 }
516 }
517 return cells;
518 }
519
520 /**
521 * Gets fort details.

Callers 3

getMapObjectsAsyncMethod · 0.95
getMapObjectsMethod · 0.95
getDefaultCellsMethod · 0.95

Calls 9

fromDegreesMethod · 0.95
fromLatLngMethod · 0.95
levelMethod · 0.95
toFaceIJOrientationMethod · 0.95
fromFaceIJMethod · 0.95
intValueMethod · 0.95
parentMethod · 0.80
addMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected